Package com.neemsoft.jmep

Examples of com.neemsoft.jmep.Expression.evaluate()


  }

  private float doEvaluateCalculation(String calculation) throws ParseException {
    try {
      Expression exp = new Expression(calculation, env);
      Object result = exp.evaluate();
      if (result instanceof Double) {
        return ((Double) result).floatValue();
      } else if (result instanceof Integer) {
        return ((Integer) result).floatValue();
      } else throw new ArgumentParseException("Parse exception: expected Double or Integer, but got:"
View Full Code Here


   * @return true if condition matches, false otherwhise
   */
  private boolean doEvaluateCondition(String condition) throws ParseException {
    try {
      Expression exp = new Expression(condition, env);
      Object result = exp.evaluate();
      if (result instanceof Double) {
        return (((Double) result).doubleValue() == 1.0) ? true : false;
      } else if (result instanceof Integer) {
        return (((Integer) result).intValue() == 1) ? true : false;
      } else return false;
View Full Code Here

       * syntaxTestExpression should never be called directly or in a non editor
       * environment.
       */
      String conditionString = condExpr.getExptressionString();
      Expression exp = new Expression(conditionString, env);
      exp.evaluate();
      Exception[] condExceptions = condExpr.getExceptions();
      ConditionErrorMessage[] cems = null;
      if (condExceptions != null && condExceptions.length > 0) {
        // create an error message from the first error in the expression
        cems=new ConditionErrorMessage[condExceptions.length];
View Full Code Here

   * @deprecated TODO: remove as it is no longer referenced, except test?
   */
  public ConditionErrorMessage syntaxTestCalculation(String expression) {
    try {
      Expression exp = new Expression(expression, env);
      exp.evaluate();
    } catch (Exception e) {
      return handleExpressionExceptions(e);
    }
    return null;
  }
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.