Package org.pentaho.reporting.libraries.formula.typing

Examples of org.pentaho.reporting.libraries.formula.typing.Type


      if (parameterCount != 1)
      {
        throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_ARGUMENTS_VALUE);
      }

      final Type type1 = parameters.getType(0);
      final Object value1 = parameters.getValue(0);
      if (type1.isFlagSet(Type.TEXT_TYPE) || value1 instanceof String)
      {
        return RETURN_TRUE;
      }

      return RETURN_FALSE;
View Full Code Here


    final TypeRegistry typeRegistry = context.getTypeRegistry();
    BigDecimal last = null;
    for (int paramIdx = 0; paramIdx < parameterCount; paramIdx++)
    {
      final Type type = parameters.getType(paramIdx);
      final Object value = parameters.getValue(paramIdx);
      final Sequence sequence = typeRegistry.convertToNumberSequence(type, value, isStrictSequenceNeeded());

      while (sequence.hasNext())
      {
View Full Code Here

    if (parameterCount < 1)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_ARGUMENTS_VALUE);
    }

     final Type type1 = parameters.getType(0);
     final Object value1 = parameters.getValue(0);
     if(value1 instanceof Boolean || type1.isFlagSet(Type.LOGICAL_TYPE))
     {
       return RETURN_TRUE;
     }

    return RETURN_FALSE;
View Full Code Here

    final int parameterCount = parameters.getParameterCount();
    if (parameterCount < 1 || parameterCount > 2)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_ARGUMENTS_VALUE);
    }
    final Type type1 = parameters.getType(0);
    final Object value1 = parameters.getValue(0);
    final TypeRegistry typeRegistry = context.getTypeRegistry();

    String result = typeRegistry.convertToText(type1, value1);
    if (result == null)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
    }


    if (parameterCount == 2)
    {
      final Type typeEncoding = parameters.getType(1);
      final Object valueEncoding = parameters.getValue(1);
      result = pruneUnprintableChars(typeRegistry, result, typeEncoding, valueEncoding);
    }

View Full Code Here

    final int parameterCount = parameters.getParameterCount();
    if (parameterCount < 1)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_ARGUMENTS_VALUE);
    }
    final Type type1 = parameters.getType(0);
    final Object value1 = parameters.getValue(0);
    final String result = context.getTypeRegistry().convertToText(type1, value1);

    if (result == null || result.length() == 0)
    {
View Full Code Here

    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_ARGUMENTS_VALUE);
    }
    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);
   
    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

    final int parameterCount = parameters.getParameterCount();
    if (parameterCount < 1)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_ARGUMENTS_VALUE);
    }
    final Type textType = parameters.getType(0);
    final Object textValue = parameters.getValue(0);
    final String textResult =
        context.getTypeRegistry().convertToText(textType, textValue);

    if (textResult == null)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
    }

    final String encodingResult;
    if (parameterCount == 2)
    {
      final Type encodingType = parameters.getType(1);
      final Object encodingValue = parameters.getValue(1);
      encodingResult = context.getTypeRegistry().convertToText(encodingType, encodingValue);
      if (encodingResult == null)
      {
        throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
View Full Code Here

        return new TypeValuePair(TextType.TYPE, s);
      }

      if(parameterCount == 3)
      {
        final Type encodingType = parameters.getType(2);
        final Object encodingValue = parameters.getValue(2);
        encodingResult = context.getTypeRegistry().convertToText(encodingType, encodingValue);
        if(encodingResult == null)
        {
          throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
View Full Code Here

      urlEncode = !(Boolean.FALSE.equals
          (context.getTypeRegistry().convertToLogical(parameters.getType(2), parameters.getValue(2))));

      if (parameterCount == 4)
      {
        final Type encodingType = parameters.getType(3);
        final Object encodingValue = parameters.getValue(3);
        encodingResult = context.getTypeRegistry().convertToText(encodingType, encodingValue);
        if (encodingResult == null)
        {
          throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
View Full Code Here

    if (parameterCount < 1)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_ARGUMENTS_VALUE);
    }

    final Type textType = parameters.getType(0);
    final Object textValue = parameters.getValue(0);
    final String query =
        context.getTypeRegistry().convertToText(textType, textValue);

    if (query == null)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
    }

    final String resultColumn;
    if (parameterCount > 1)
    {
      final Type encodingType = parameters.getType(1);
      final Object encodingValue = parameters.getValue(1);
      resultColumn = context.getTypeRegistry().convertToText(encodingType, encodingValue);
      if (resultColumn == null)
      {
        throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
      }
    }
    else
    {
      resultColumn = null;
    }


    final int queryTimeOut;
    if (parameterCount > 2)
    {
      final Type encodingType = parameters.getType(2);
      final Object encodingValue = parameters.getValue(2);
      final Number number = context.getTypeRegistry().convertToNumber(encodingType, encodingValue);
      if (number == null)
      {
        throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.libraries.formula.typing.Type

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.