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


    return new TestSuite(EvalDoubleTestCase.class);
  }

  public void check(String in, String compareWith) {
    try {
      DoubleEvaluator engine = new DoubleEvaluator();
      double d = engine.evaluate(in);
      assertEquals(Double.valueOf(d).toString(), compareWith);
    } catch (Exception e) {
      e.printStackTrace();
      assertEquals("", e.getMessage());
    }
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) : parseTrimNewlineLeft(list.get(2), model);
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

        }
        expression = conditionBuffer.toString();
      }

      try {
        DoubleEvaluator engine = new DoubleEvaluator();
        double d = engine.evaluate(expression);
        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

    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

    return new TestSuite(EvalDoubleTestCase.class);
  }

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

        }
        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

     * @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.