Package info.bliki.wiki.template.expr.eval

Examples of info.bliki.wiki.template.expr.eval.DoubleEvaluator$SubtractFunction


                }
                expression = conditionBuffer.toString();
            }

            try {
                DoubleEvaluator engine = new DoubleEvaluator();
                double d = engine.evaluate(expression);
                return getWikiNumberFormat(d,model);
            } catch (Exception e) {
                if (Configuration.DEBUG) {
                    System.out.println("#expr error: "+expression);
                }
View Full Code Here


    public String parseFunction(List<String> list, IWikiModel model, char[] src, int beginIndex, int endIndex, boolean isSubst) {
        if (list.size() > 1) {
            String condition = isSubst ? list.get(0) : parseTrim(list.get(0), model);
            if (condition.length() > 0) {
                try {
                    DoubleEvaluator engine = new DoubleEvaluator();
                    double d = engine.evaluate(condition);
                    // if (d == 0.0) {
                    if (Math.abs(d - 0.0) < DoubleEvaluator.EPSILON) {
                        if (list.size() >= 3) {
                            // &lt;else text&gt;
                            return isSubst ? list.get(2) : parseTrim(list.get(2), model);
View Full Code Here

public class EvalDoubleTestCase {


    public void check(String in, String compareWith) {
        try {
            DoubleEvaluator engine = new DoubleEvaluator();
            double d = engine.evaluate(in);
            assertThat(compareWith).isEqualTo(Double.valueOf(d).toString());
        } catch (Exception e) {
            e.printStackTrace();
            assertThat(e.getMessage()).isEqualTo("");
        }
View Full Code Here

    if (list.size() > 1) {

      String condition = parse(list.get(0), model);
      if (condition.length() > 0) {
        try {
          DoubleEvaluator engine = new DoubleEvaluator();
          double d = engine.evaluate(condition);
          // if (d == 0.0) {
          if (Math.abs(d - 0.0) < DoubleEvaluator.EPSILON) {
            if (list.size() >= 3) {
              // &lt;else text&gt;
              return parse(list.get(2), model);
View Full Code Here

      }
      StringBuilder conditionBuffer = new StringBuilder(expression.length());
      TemplateParser.parse(expression, model, conditionBuffer, false);
      if (conditionBuffer.length() > 0) {
        try {
          DoubleEvaluator engine = new DoubleEvaluator();
          double d = engine.evaluate(conditionBuffer.toString());
          double dInt = Math.rint(d);
          // if (dInt == d) {
          if (Math.abs(dInt - d) < DoubleEvaluator.EPSILON) {
            return Long.toString(Math.round(d));
          }
View Full Code Here

   * @param strEval
   *
   */
  public String interpreter(final String strEval) {
    try {
      DoubleEvaluator engine = new DoubleEvaluator();
      double d = engine.evaluate(strEval);
      return Double.toString(d);
    } catch (SyntaxError e) {
      System.err.println();
      System.err.println(e.getMessage());
    } catch (Exception e) {
View Full Code Here

TOP

Related Classes of info.bliki.wiki.template.expr.eval.DoubleEvaluator$SubtractFunction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.