/** Create a math evaluator. */
  public MathEval() {
    super();

    operators = new Operator[256];
    DefaultImpl.registerOperators(this);

    constants = new TreeMap<String, Double>(String.CASE_INSENSITIVE_ORDER);
    variables = new TreeMap<String, Double>(String.CASE_INSENSITIVE_ORDER);
    setConstant("E", Math.E);
    setConstant("Euler", 0.577215664901533D);
    setConstant("LN2", 0.693147180559945D);
    setConstant("LN10", 2.302585092994046D);
    setConstant("LOG2E", 1.442695040888963D);
    setConstant("LOG10E", 0.434294481903252D);
    setConstant("PHI", 1.618033988749895D);
    setConstant("PI", Math.PI);

    pureFunctions = new TreeMap<String, FunctionHandler>(String.CASE_INSENSITIVE_ORDER);
    impureFunctions = new TreeMap<String, FunctionHandler>(String.CASE_INSENSITIVE_ORDER);
    DefaultImpl.registerFunctions(this);

    relaxed = false;
    separators = null;

    offset = 0;
    isConstant = false;
  }
Beispiel #2
0
 private void addDefault(String line) {
   List<String> split = reworkLine(line);
   if (split.size() == 5) {
     DefaultImpl def = new DefaultImpl();
     def.setNboudnFT(Integer.parseInt(split.get(0)));
     def.setCombRule(Integer.parseInt(split.get(1)));
     def.setGenPair(split.get(2).equals("yes"));
     def.setC1(new BigDecimal(split.get(3)));
     def.setC2(new BigDecimal(split.get(4)));
     structure.setDef(def);
   } else {
     ch.printErrorln(String.format("some DEFAULTS values are lost! --> %s", line));
   }
 }