Examples of TypeRegistry


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

    if (parameters.getParameterCount() > 1)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_ARGUMENTS_VALUE);
    }

    final TypeRegistry typeRegistry = context.getTypeRegistry();

    int type = 1; // default is Type 1
    if (parameters.getParameterCount() == 1)
    {
      final Number n = typeRegistry.convertToNumber(parameters.getType(0), parameters.getValue(0));
      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

    final int parameterCount = parameters.getParameterCount();
    if (parameterCount < 1 || parameterCount > 2)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_ARGUMENTS_VALUE);
    }
    final TypeRegistry typeRegistry = context.getTypeRegistry();

    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

    if (parameters.getParameterCount() != 1)
    {
      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

    if(length != 2)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_ARGUMENTS_VALUE);
    }
   
    final TypeRegistry typeRegistry = context.getTypeRegistry();
    final Object value1Raw = parameters.getValue(0);
    final Object value2Raw = parameters.getValue(1);
    if (value1Raw == null || value2Raw == null)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_NA_VALUE);
    }

    final Type type1 = parameters.getType(0);
    final Type type2 = parameters.getType(1);
    final ExtendedComparator comparator = typeRegistry.getComparator(type1, type2);
    final boolean result = comparator.isEqual (type1, value1Raw, type2, value2Raw);
    if (result)
    {
      return RETURN_TRUE;
    }
View Full Code Here

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

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

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

      while (sequence.hasNext())
      {
        final LValue lValue = sequence.nextRawValue();
        final TypeValuePair pair = lValue.evaluate();
        final Type type1 = pair.getType();
        final Object o = pair.getValue();
        final String str = typeRegistry.convertToText(type1, o);
        computedResult.append(str);
      }
    }

    return new TypeValuePair(TextType.TYPE, computedResult.toString());
View Full Code Here

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

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

    final TypeRegistry typeRegistry = context.getTypeRegistry();
    final Type type = parameters.getType(0);
    final Object value = parameters.getValue(0);

    final Date date1 = typeRegistry.convertToDate(type, value);
    final Date time = DateUtil.normalizeDate(date1, DateTimeType.TIME_TYPE);
    return new TypeValuePair(DateTimeType.TIME_TYPE, time);
  }
View Full Code Here

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

    final int parameterCount = parameters.getParameterCount();
    if (parameterCount != 2)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_ARGUMENTS_VALUE);
    }
    final TypeRegistry typeRegistry = context.getTypeRegistry();

    final Type textType1 = parameters.getType(0);
    final Object textValue1 = parameters.getValue(0);
    final Type textType2 = parameters.getType(1);
    final Object textValue2 = parameters.getValue(1);

    final String text = typeRegistry.convertToText(textType1, textValue1);
    final String substring = typeRegistry.convertToText(textType2, textValue2);

    return text.startsWith(substring) ? RETURN_TRUE : RETURN_FALSE;
  }
View Full Code Here

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

    final int parameterCount = parameters.getParameterCount();
    if (parameterCount != 2)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_ARGUMENTS_VALUE);
    }
    final TypeRegistry typeRegistry = context.getTypeRegistry();

    final Type textType1 = parameters.getType(0);
    final Object textValue1 = parameters.getValue(0);
    final Type textType2 = parameters.getType(1);
    final Object textValue2 = parameters.getValue(1);

    final String text = typeRegistry.convertToText(textType1, textValue1);
    final String substring = typeRegistry.convertToText(textType2, textValue2);

    return text.endsWith(substring) ? RETURN_TRUE : RETURN_FALSE;
  }
View Full Code Here

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

    final int parameterCount = parameters.getParameterCount();
    if (parameterCount != 3)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_ARGUMENTS_VALUE);
    }
    final TypeRegistry typeRegistry = context.getTypeRegistry();

    final Type textType = parameters.getType(0);
    final Object textValue = parameters.getValue(0);
    final Type startType = parameters.getType(1);
    final Object startValue = parameters.getValue(1);
    final Type lengthType = parameters.getType(2);
    final Object lengthValue = parameters.getValue(2);

    final String text = typeRegistry.convertToText(textType, textValue);
    final Number start = typeRegistry.convertToNumber(startType, startValue);
    final Number length = typeRegistry.convertToNumber(lengthType, lengthValue);

    if(length.doubleValue() < 0 || start.doubleValue() < 1)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
    }
View Full Code Here

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

    final int parameterCount = parameters.getParameterCount();
    if (parameterCount != 3)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_ARGUMENTS_VALUE);
    }
    final TypeRegistry typeRegistry = context.getTypeRegistry();

    final Object textValue = parameters.getValue(0);
    final Type startType = parameters.getType(1);
    final Object startValue = parameters.getValue(1);
    final Type lengthType = parameters.getType(2);
    final Object lengthValue = parameters.getValue(2);

    final Sequence text = new RecursiveSequence(textValue, context);
    final Number start = typeRegistry.convertToNumber(startType, startValue);
    final Number length = typeRegistry.convertToNumber(lengthType, lengthValue);

    if (length.doubleValue() < 0 || start.doubleValue() < 1)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
    }
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.