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

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


        double vMean = 0.0;
        double nValCount = 0.0;
        double[] values = new double[parameterCount];
        for (int i = 0; i < parameterCount; i++) {

            final Type type1 = parameters.getType(i);
            final Object value1 = parameters.getValue(i);
            final Number result = context.getTypeRegistry().convertToNumber(type1, value1);
            if (result == null) {
                throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
            }
View Full Code Here


    {
      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);
    return new TypeValuePair(DateTimeType.DATE_TYPE, date1);
View Full Code Here

    public TypeValuePair evaluate(FormulaContext context, ParameterCallback parameters) throws EvaluationException {
        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 Number result = context.getTypeRegistry().convertToNumber(type1, value1);
        if (result == null ) {
            throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
        }
View Full Code Here

    if (arrayCallback == null)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_NA_VALUE);
    }

    final Type rowType = parameters.getType(1);
    final Object rowValue = parameters.getValue(1);
    Number rowNumber;
    if (rowValue == null)
    {
      rowNumber = null;
    }
    else
    {
      rowNumber = context.getTypeRegistry().convertToNumber(rowType, rowValue);
    }
    if (rowNumber == null)
    {
      rowNumber = new BigDecimal(1);
    }
    else if (rowNumber.intValue() <= 0)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
    }
    if (parameterCount == 3)
    {
      Number columnNumber;
      final Type columnType = parameters.getType(2);
      final Object columnValue = parameters.getValue(2);
      if (columnValue == null)
      {
        columnNumber = null;
      }
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)
    {
View Full Code Here

    String quote = "\"";
    String separator = ",";
    if (parameterCount > 1)
    {
      final Type indexType = parameters.getType(1);
      final Object indexValue = parameters.getValue(1);
      separator = context.getTypeRegistry().convertToText(indexType, indexValue);
    }

    if (parameterCount > 2)
    {
      final Type indexType = parameters.getType(2);
      final Object indexValue = parameters.getValue(2);
      quote = context.getTypeRegistry().convertToText(indexType, indexValue);
    }

    StringBuilder b = new StringBuilder();
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);

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

    }

    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 NumberSequence sequence = typeRegistry.convertToNumberSequence(type, value, isStrictSequenceNeeded());

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

    public TypeValuePair evaluate(FormulaContext context, ParameterCallback parameters) throws EvaluationException {
        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 Number result = context.getTypeRegistry().convertToNumber(type1, value1);
        if (result == 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 type1 = parameters.getType(0);
    final Object value1 = parameters.getValue(0);
    final TypeRegistry typeRegistry = context.getTypeRegistry();
    if (parameterCount == 1)
    {
      final String result = typeRegistry.convertToText(type1, value1);
      if(result == null)
      {
        throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
      }

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

    try
    {
      final Type type2 = parameters.getType(1);
      final Object value2 = parameters.getValue(1);
      final String formatString = typeRegistry.convertToText(type2, value2);
      final Locale locale = context.getLocalizationContext().getLocale();
      if (value1 instanceof Date)
      {
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.