Examples of convertToNumber()


Examples of org.pentaho.reporting.libraries.formula.typing.TypeRegistry.convertToNumber()

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

    final TypeRegistry typeRegistry = context.getTypeRegistry();
    final Number number = typeRegistry.convertToNumber(type1, value);

    if (number == null)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
    }
View Full Code Here

Examples of org.pentaho.reporting.libraries.formula.typing.TypeRegistry.convertToNumber()

    final int length;
    if (parameterCount == 2)
    {
      final Type lengthType = parameters.getType(1);
      final Object lengthValue = parameters.getValue(1);
      final Number lengthConv = typeRegistry.convertToNumber(lengthType, lengthValue);
      if (lengthConv.doubleValue() < 0)
      {
        throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
      }
View Full Code Here

Examples of org.pentaho.reporting.libraries.formula.typing.TypeRegistry.convertToNumber()

    final Date d = typeRegistry.convertToDate(parameters.getType(0), parameters.getValue(0));
    int type = 1; // default is Type 1
    if (parameters.getParameterCount() == 2)
    {
      final Number n = typeRegistry.convertToNumber(parameters.getType(1), parameters.getValue(1));
      if (n == null)
      {
        throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
      }
      type = n.intValue();
View Full Code Here

Examples of org.pentaho.reporting.libraries.formula.typing.TypeRegistry.convertToNumber()

    final String text = typeRegistry.convertToText(textType, textValue);
    final int length;
    if(parameterCount == 2)
    {
      final Number lengthVal = typeRegistry.convertToNumber(parameters.getType(1), parameters.getValue(1));
      if (lengthVal.doubleValue() < 0)
      {
        throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
      }
      length = lengthVal.intValue();
View Full Code Here

Examples of org.pentaho.reporting.libraries.formula.typing.TypeRegistry.convertToNumber()

    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_ARGUMENTS_VALUE);
    }

    final TypeRegistry typeRegistry = context.getTypeRegistry();
    final Number n = typeRegistry.convertToNumber(parameters.getType(0), parameters.getValue(0));

    if (n == null)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
    }
View Full Code Here

Examples of org.pentaho.reporting.libraries.formula.typing.TypeRegistry.convertToNumber()

        if (rawValue == null)
        {
          throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
        }
        final TypeValuePair nextValue = rawValue.evaluate();
        final Number number = typeRegistry.convertToNumber(nextValue.getType(), nextValue.getValue());
        final BigDecimal next = NumberUtil.getAsBigDecimal(number);

        if(last == null)
        {
          last = next;
View Full Code Here

Examples of org.pentaho.reporting.libraries.formula.typing.TypeRegistry.convertToNumber()

    }
    final TypeRegistry typeRegistry = context.getTypeRegistry();

    final Type type1 = parameters.getType(0);
    final Object value1 = parameters.getValue(0);
    final Number number1 = typeRegistry.convertToNumber(type1, value1);
    if (number1 == null)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
    }
    final BigDecimal divided = NumberUtil.getAsBigDecimal(number1);
View Full Code Here

Examples of org.pentaho.reporting.libraries.formula.typing.TypeRegistry.convertToNumber()

    }
    final BigDecimal divided = NumberUtil.getAsBigDecimal(number1);
   
    final Type type2 = parameters.getType(1);
    final Object value2 = parameters.getValue(1);
    final Number number2 = typeRegistry.convertToNumber(type2, value2);
    if (number2 == null)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
    }
   
View Full Code Here

Examples of org.pentaho.reporting.libraries.formula.typing.TypeRegistry.convertToNumber()

    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_ARGUMENTS_VALUE);
    }

    final TypeRegistry typeRegistry = context.getTypeRegistry();
    final double value = typeRegistry.convertToNumber(parameters.getType(0), parameters.getValue(0)).doubleValue();

    if (value == 0)
    {
      return new TypeValuePair(TextType.TYPE, "0 ");
    }
View Full Code Here

Examples of org.pentaho.reporting.libraries.formula.typing.TypeRegistry.convertToNumber()

    int precision = 0;

    if (parameters.getParameterCount() > 1)
    {
      fixedSize = true;
      precision = typeRegistry.convertToNumber(parameters.getType(1), parameters.getValue(1)).intValue();
      if (parameters.getParameterCount() == 3)
      {
        final Boolean rawFixedSize = typeRegistry.convertToLogical(parameters.getType(2), parameters.getValue(2));
        fixedSize = rawFixedSize.booleanValue();
      }
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.