Package org.jfree.formula

Examples of org.jfree.formula.Formula


  }
 
  @Test(dataProvider="defaultTestCase", groups="functions")
  public void test(String formul, Object result)
  {
    Formula formula = null;
    try
    {
      formula = new Formula(formul);
    } catch (ParseException e1)
    {
      Assert.fail("Error while parsing the formula", e1);
    }
    try
    {
      formula.initialize(context);
    } catch (EvaluationException e)
    {
      Assert.fail("Initialization Error", e);
    }
    Object eval = formula.evaluate();
    Assert.assertEquals(eval, result);
  }
View Full Code Here


  {
    try
    {
      if (compiledFormula == null)
      {
        compiledFormula = new Formula(formulaExpression);
      }

      final ReportFormulaContext context =
          new ReportFormulaContext(getFormulaContext(), getDataRow());
      try
View Full Code Here

  public Formula getCompiledFormula()
      throws ParseException
  {
    if (compiledFormula == null)
    {
      compiledFormula = new Formula(formulaExpression);
    }
    return compiledFormula;
  }
View Full Code Here

  {
    try
    {
      if (initial != null)
      {
        final Formula initFormula = new Formula(initialExpression);
        final ReportFormulaContext context =
            new ReportFormulaContext(getFormulaContext(), getDataRow());
        context.setDeclaringElement(getRuntime().getDeclaringParent());
        try
        {
          initFormula.initialize(context);
          return initFormula.evaluate();
        }
        finally
        {
          context.setDeclaringElement(null);
          context.setDataRow(null);
View Full Code Here

  {
    try
    {
      if (compiledFormula == null)
      {
        compiledFormula = new Formula(formulaExpression);
      }

      final ReportFormulaContext context =
          new ReportFormulaContext(getFormulaContext(), getDataRow());
      context.setDeclaringElement(getRuntime().getDeclaringParent());
View Full Code Here

  public Formula getCompiledFormula()
      throws ParseException
  {
    if (compiledFormula == null)
    {
      compiledFormula = new Formula(formulaExpression);
    }
    return compiledFormula;
  }
View Full Code Here

      return false;
    }

    try
    {
      final Formula formula = formulaExpression.getCompiledFormula();
      final LValue lValue = formula.getRootReference();
      return isReferenceChanged(lValue);
    }
    catch (ParseException e)
    {
      return false;
View Full Code Here

      return;
    }

    // first parse the formula. This checks the general syntax, but does not
    // check whether the used functions or references are actually valid.
    final Formula f = new Formula(formula);

    // connects the parsed formula to the context. The context provides the
    // operator and function implementations and resolves the references.
    f.initialize(new DemoFormulaContext());

    JOptionPane.showMessageDialog(null, "The result is " + f.evaluate(),
        "Result", JOptionPane.INFORMATION_MESSAGE);

    System.exit(0);
  }
View Full Code Here

  }

  @Test(dataProvider = "defaultTestCase", groups = "operators")
  public void test(String formul, Object result)
  {
    Formula formula = null;
    try
    {
      formula = new Formula(formul);
    }
    catch (ParseException e1)
    {
      Assert.fail("Error while parsing the formula", e1);
    }
    try
    {
      formula.initialize(context);
    }
    catch (EvaluationException e)
    {
      Assert.fail("Initialization Error", e);
    }
    Assert.assertEquals(formula.evaluate().getClass(), result.getClass());
    Assert.assertEquals(formula.evaluate(), result);
  }
View Full Code Here

  }
 
  @Test(dataProvider="defaultTestCase", groups="functions")
  public void test(String formul, Object result)
  {
    Formula formula = null;
    try
    {
      formula = new Formula(formul);
    } catch (ParseException e1)
    {
      Assert.fail("Error while parsing the formula", e1);
    }
    try
    {
      formula.initialize(context);
    } catch (EvaluationException e)
    {
      Assert.fail("Initialization Error", e);
    }
    Object eval = formula.evaluate();
    Assert.assertEquals(eval, result);
  }
View Full Code Here

TOP

Related Classes of org.jfree.formula.Formula

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.