Examples of FormulaContext


Examples of org.jfree.formula.FormulaContext

    this.name = name;
  }

  public TypeValuePair evaluate() throws EvaluationException
  {
    final FormulaContext context = getContext();
    final Object value = context.resolveReference(name);
    final Type type = context.resolveReferenceType(name);
    return new TypeValuePair(type, value);
  }
View Full Code Here

Examples of org.jfree.formula.FormulaContext

  }

  public TypeValuePair evaluate() throws EvaluationException
  {
    // First, grab the parameters and their types.
    final FormulaContext context = getContext();
    // And if everything is ok, compute the stuff ..
    if (function == null)
    {
      throw new EvaluationException(LibFormulaErrorValue.ERROR_INVALID_FUNCTION_VALUE);
    }
View Full Code Here

Examples of org.jfree.formula.FormulaContext

  }

  public TypeValuePair evaluate() throws EvaluationException
  {
    // First, grab the parameters and their types.
    final FormulaContext context = getContext();
    // And if everything is ok, compute the stuff ..
    if (function == null)
    {
      throw new EvaluationException(LibFormulaErrorValue.ERROR_INVALID_FUNCTION_VALUE);
    }
View Full Code Here

Examples of org.jfree.formula.FormulaContext

    this.name = name;
  }

  public TypeValuePair evaluate() throws EvaluationException
  {
    final FormulaContext context = getContext();
    final Object value = context.resolveReference(name);
    final Type type = context.resolveReferenceType(name);
    return new TypeValuePair(type, value);
  }
View Full Code Here

Examples of org.openntf.formula.FormulaContext

      }
      // benchmark the evaluate with a document as context

      try {
        time = System.nanoTime();
        FormulaContext ctx1 = Formulas.createContext(ntfDoc, Formulas.getParser());
        ntfDocResult = ast.solve(ctx1);
        docEvaluateTime += System.nanoTime() - time;
      } catch (Exception e) {
        System.out.println(NTF("Doc-Evaluate failed: ") + ERROR(e));
        e.printStackTrace();
        i = count;
      }
      try {
        // benchmark the evaluate with a map as context
        time = System.nanoTime();
        FormulaContext ctx2 = Formulas.createContext(ntfMap, Formulas.getParser());
        ntfMapResult = ast.solve(ctx2);
        mapEvaluateTime += System.nanoTime() - time;
      } catch (Exception e) {
        System.out.println(NTF("Map-Evaluate failed: ") + ERROR(e));
        e.printStackTrace();
View Full Code Here

Examples of org.openntf.formula.FormulaContext

      }
      // benchmark the evaluate with a document as context

      try {
        time = System.nanoTime();
        FormulaContext ctx1 = Formulas.createContext(ntfDoc, Formulas.getParser());
        ntfDocResult = ast.solve(ctx1);
        docEvaluateTime += System.nanoTime() - time;
      } catch (Exception e) {
        System.out.println(NTF("Doc-Evaluate failed: ") + ERROR(e));
        e.printStackTrace();
        i = count;
      }
      try {
        // benchmark the evaluate with a map as context
        time = System.nanoTime();
        FormulaContext ctx2 = Formulas.createContext(ntfMap, Formulas.getParser());
        ntfMapResult = ast.solve(ctx2);
        mapEvaluateTime += System.nanoTime() - time;
      } catch (Exception e) {
        System.out.println(NTF("Map-Evaluate failed: ") + ERROR(e));
        e.printStackTrace();
View Full Code Here

Examples of org.openntf.formula.FormulaContext

    }

    if (!parserFailed) {
      if (testDoc) {
        try {
          FormulaContext ctx1 = Formulas.createContext(ntfDoc, parser);
          ntfDocResult = ast.solve(ctx1);
        } catch (EvaluateException e) {
          errors.append(NTF("\tDoc-Evaluate failed: ") + ERROR(e) + "\n");
          ntfError = e;
          parserFailed = true;
        } catch (Throwable t) {
          System.err.println(ERROR("FATAL") + NTF("\tDoc-Evaluate failed: ") + ERROR(t));
          t.printStackTrace();
        }
      }
      if (testMap) {
        try {
          // benchmark the evaluate with a map as context
          FormulaContext ctx2 = Formulas.createContext(ntfMap, parser);
          ntfMapResult = ast.solve(ctx2);
        } catch (EvaluateException e) {
          errors.append(NTF("\tMap-Evaluate failed: ") + ERROR(e) + "\n");
          ntfError = e;
          parserFailed = true;
View Full Code Here

Examples of org.openntf.formula.FormulaContext

    }

    if (!parserFailed) {
      try {
        // benchmark the evaluate with a map as context
        FormulaContext ctx2 = Formulas.createContext(ntfMap, parser);
        ntfMapResult = ast.solve(ctx2);
      } catch (EvaluateException e) {
        errors.append(NTF("\tMap-Evaluate failed: ") + ERROR(e) + "\n");
        ntfError = e;
        parserFailed = true;
View Full Code Here

Examples of org.openntf.formula.FormulaContext

        return null;
      }

    });
    ASTNode x = p.parse(System.in, true);
    FormulaContext ctx = Formulas.createContext(null, p);

    ctx.setParameterProvider(new FormulaProvider<String>() {

      public String get(final String key) {
        return args[Integer.valueOf(key)];
      }
    });
View Full Code Here

Examples of org.openntf.formula.FormulaContext

    return solve(docMap, contextMap);
  }

  /*----------------------------------------------------------------------------*/
  private String solve(final LSFocStringMap docMap, final LSFocStringMap contextMap) {
    FormulaContext ctx = Formulas.createContext(docMap, iParser);
    ctx.useBooleans(false);
    ctx.setParameterProvider(new FormulaProvider<Object>() {
      public Object get(final String what) {
        return contextMap.get(what);
      }
    });
    try {
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.