diff --git a/README.md b/README.md index 7228ebc..740bec9 100644 --- a/README.md +++ b/README.md @@ -200,9 +200,9 @@ ExecutionEnv env = new ExecutionEnv(); env.insertFunction("input", in::nextDouble); env.insertFunction("isleapyear", 1, ctx -> { - // need a FunctionContext param in order to get an int - int year = ctx.getInt(0); - // copied from java.time.Year.isLeap + // you need a FunctionContext parameter to force the input to be an int + // as all parameters are doubles implicitly + int year = ctx.getInt(0); return Utility.boolToDouble(java.time.Year.isLeap(year)); }); diff --git a/core/src/main/java/me/fourteendoggo/mathexpressionparser/ExpressionParser.java b/core/src/main/java/me/fourteendoggo/mathexpressionparser/ExpressionParser.java index 9de04b6..34c6f9e 100644 --- a/core/src/main/java/me/fourteendoggo/mathexpressionparser/ExpressionParser.java +++ b/core/src/main/java/me/fourteendoggo/mathexpressionparser/ExpressionParser.java @@ -15,11 +15,15 @@ import java.util.function.DoubleUnaryOperator; import java.util.function.ToDoubleFunction; +@SuppressWarnings("unused") public class ExpressionParser { private static ExecutionEnv DEFAULT_ENV; private ExpressionParser() {} + /** + * @see ExpressionParser#parse(String, ExecutionEnv) + */ public static double parse(String input) { return parse(input, getDefaultEnv()); } @@ -89,7 +93,7 @@ public static void insertSymbol(Symbol symbol) { getDefaultEnv().insertSymbol(symbol); } - public static ExecutionEnv getDefaultEnv() { + private static ExecutionEnv getDefaultEnv() { if (DEFAULT_ENV == null) { DEFAULT_ENV = new ExecutionEnv(); }