Examples of DoubleEvaluator


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

                }
                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

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

    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

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

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

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

    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

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

      }
      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

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

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

Examples of net.astesana.javaluator.DoubleEvaluator

                    logger.debug("Eval key={}, variable={}", key, variable);

                    String tmp = replaceVariables(vals, variable);
                   
                    try {
                      double result = new DoubleEvaluator().evaluate(tmp);
                      logger.debug("Eval '{}={}={}'", variable, tmp, result);
                      state = new DecimalType(result);
                      found = true;

                    } catch (Exception e) {
View Full Code Here

Examples of net.aufdemrand.denizencore.utilities.javaluator.DoubleEvaluator

    // -->
    @EventHandler
    public void mathTag(ReplaceableTagEvent event) {
        if (!event.matches("math", "m")) return;
        try {
            Double evaluation = new DoubleEvaluator().evaluate(event.getValue());
            event.setReplaced(new Element(String.valueOf(evaluation)).getAttribute(event.getAttributes().fulfill(1)));
        }
        catch (Exception e) {
            dB.echoError("Invalid math tag!");
            event.setReplaced("0.0");
View Full Code Here

Examples of org.neo4j.graphalgo.impl.util.DoubleEvaluator

     * using the Dijkstra algorithm.
     */
    public static PathFinder<WeightedPath> dijkstra( RelationshipExpander expander,
            String relationshipPropertyRepresentingCost )
    {
        return dijkstra( expander, new DoubleEvaluator( relationshipPropertyRepresentingCost ) );
    }
View Full Code Here

Examples of org.neo4j.graphalgo.impl.util.DoubleEvaluator

*/
public abstract class CommonEvaluators
{
    public static CostEvaluator<Double> doubleCostEvaluator( String relationshipCostPropertyKey )
    {
        return new DoubleEvaluator( relationshipCostPropertyKey );
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.