コード例 #1
0
 // To add/remove operators change evaluateOperator() and registration
 static void registerOperators(MathEval tgt) {
   tgt.setOperator(OPR_EQU);
   tgt.setOperator(OPR_PWR);
   tgt.setOperator(OPR_NEG);
   tgt.setOperator(OPR_MLT1);
   tgt.setOperator(OPR_MLT2);
   tgt.setOperator(OPR_MLT3);
   tgt.setOperator(OPR_BKT);
   tgt.setOperator(OPR_DIV1);
   tgt.setOperator(OPR_DIV2);
   tgt.setOperator(OPR_MOD);
   tgt.setOperator(OPR_ADD);
   tgt.setOperator(OPR_SUB);
 }
コード例 #2
0
 // To add/remove functions change evaluateOperator() and registration
 static void registerFunctions(MathEval tgt) {
   tgt.setFunctionHandler("abs", INSTANCE);
   tgt.setFunctionHandler("acos", INSTANCE);
   tgt.setFunctionHandler("asin", INSTANCE);
   tgt.setFunctionHandler("atan", INSTANCE);
   tgt.setFunctionHandler("cbrt", INSTANCE);
   tgt.setFunctionHandler("ceil", INSTANCE);
   tgt.setFunctionHandler("cos", INSTANCE);
   tgt.setFunctionHandler("cosh", INSTANCE);
   tgt.setFunctionHandler("exp", INSTANCE);
   tgt.setFunctionHandler("expm1", INSTANCE);
   tgt.setFunctionHandler("floor", INSTANCE);
   // t.setFunctionHandler("getExponent"   ,INSTANCE); // needs Java 6
   tgt.setFunctionHandler("log", INSTANCE);
   tgt.setFunctionHandler("log10", INSTANCE);
   tgt.setFunctionHandler("log1p", INSTANCE);
   tgt.setFunctionHandler("max", INSTANCE);
   tgt.setFunctionHandler("min", INSTANCE);
   // t.setFunctionHandler("nextUp"        ,INSTANCE); // needs Java 6
   tgt.setFunctionHandler("random", INSTANCE, true); // impure
   tgt.setFunctionHandler("round", INSTANCE);
   tgt.setFunctionHandler("roundHE", INSTANCE); // round half-even
   tgt.setFunctionHandler("signum", INSTANCE);
   tgt.setFunctionHandler("sin", INSTANCE);
   tgt.setFunctionHandler("sinh", INSTANCE);
   tgt.setFunctionHandler("sqrt", INSTANCE);
   tgt.setFunctionHandler("tan", INSTANCE);
   tgt.setFunctionHandler("tanh", INSTANCE);
   tgt.setFunctionHandler("toDegrees", INSTANCE);
   tgt.setFunctionHandler("toRadians", INSTANCE);
   tgt.setFunctionHandler("ulp", INSTANCE);
 }