Package org.jfree.formula.lvalues

Examples of org.jfree.formula.lvalues.TypeValuePair


    if(length.doubleValue() < 0 || start.doubleValue() < 1)
    {
      throw new EvaluationException(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
    }

    return new TypeValuePair(TextType.TYPE, process(text, start, length));
  }
View Full Code Here


    {
      n = new BigDecimal(result.toString());
    }
    Integer ret = NumberUtil.performIntRounding(n);

    return new TypeValuePair(NumberType.GENERIC_NUMBER, ret);
  }
View Full Code Here

  public TypeValuePair evaluateTyped ()
  {
    try
    {
      final TypeValuePair typeValuePair = rootReference.evaluate();
      if (typeValuePair == null)
      {
        // Should no longer happen..
        return new TypeValuePair
            (ErrorType.TYPE, LibFormulaErrorValue.ERROR_NA_VALUE);
      }
      if(typeValuePair.getType().isFlagSet(Type.ERROR_TYPE))
      {
        Log.debug ("Error: " + typeValuePair.getValue());
      }
      return typeValuePair;
    }
    catch(EvaluationException ee)
    {
      Log.warn ("Evaluation failed: ", ee);
      return new TypeValuePair(ErrorType.TYPE, ee.getErrorValue());
    }
    catch (Exception e)
    {
      Log.warn ("Evaluation failed: ", e);
      return new TypeValuePair(ErrorType.TYPE, LibFormulaErrorValue.ERROR_UNEXPECTED_VALUE);
    }
  }
View Full Code Here

      throw new EvaluationException
          (LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
    }
    if (text1 == null)
    {
      return new TypeValuePair(TextType.TYPE, text2);
    }
    if (text2 == null)
    {
      return new TypeValuePair(TextType.TYPE, text1);
    }

    return new TypeValuePair(TextType.TYPE, text1 + text2);
  }
View Full Code Here

    {
      final TypeRegistry typeRegistry = context.getTypeRegistry();
      // return the same as zero minus value.
      final Number number = typeRegistry.convertToNumber(type, val);
      final BigDecimal value = getAsBigDecimal(number);
      return new TypeValuePair(type, ZERO.subtract(value));
    }

    if(val instanceof Number)
    {
      final BigDecimal value = getAsBigDecimal((Number)val);
      return new TypeValuePair(type, ZERO.subtract(value));
    }

    throw new EvaluationException
        (LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
  }
View Full Code Here

    if(result == null)
    {
      throw new EvaluationException(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
    }

    return new TypeValuePair(TextType.TYPE, result.toUpperCase(context.getLocalizationContext().getLocale()));
  }
View Full Code Here

    final Type type1 = parameters.getType(0);
    final Object value1 = parameters.getValue(0);

    if(type1 instanceof TextType || value1 instanceof String)
    {
      return new TypeValuePair(TextType.TYPE, value1);
    }
    else
    {
      return EMPTY_STRING;
    }
View Full Code Here

    if(result == null)
    {
      throw new EvaluationException(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
    }

    return new TypeValuePair(TextType.TYPE, result);
  }
View Full Code Here

    }
    if (Boolean.TRUE.equals(condition))
    {
      final Object value = parameters.getValue(1);
      final Type type = parameters.getType(1);
      return new TypeValuePair(type, value);
    }
    // if condition is false and no third parameter, return false
    if(parameterCount == 2 || parameters.getValue(2) == null)
    {
      return RETURN_FALSE;
    }
    // else return third parameter
    final Object value = parameters.getValue(2);
    final Type type = parameters.getType(2);
    return new TypeValuePair(type, value);
  }
View Full Code Here

    if (index < 0)
    {
      throw new EvaluationException(LibFormulaErrorValue.ERROR_NOT_FOUND_VALUE);
    }

    return new TypeValuePair(NumberType.GENERIC_NUMBER, new BigDecimal(index + 1));
  }
View Full Code Here

TOP

Related Classes of org.jfree.formula.lvalues.TypeValuePair

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.