Examples of TypeValuePair


Examples of org.pentaho.reporting.libraries.formula.lvalues.TypeValuePair

  public TypeValuePair evaluateTyped()
  {
    try
    {
      final TypeValuePair typeValuePair = rootReference.evaluate();
      if (typeValuePair == null)
      {
        throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_NA_VALUE);
      }
      final Type type = typeValuePair.getType();
      if (type.isFlagSet(Type.ERROR_TYPE))
      {
        logger.debug("Error: " + typeValuePair.getValue());
      }
      else if (type.isFlagSet(Type.ARRAY_TYPE))
      {
        final Object value = typeValuePair.getValue();
        if (value instanceof ArrayCallback)
        {
          return new TypeValuePair(type, new StaticArrayCallback((ArrayCallback) value));
        }
      }
      else
      {
        final Object value = typeValuePair.getValue();
        if (value instanceof Number)
        {
          return new TypeValuePair(type, NumberUtil.performTuneRounding(NumberUtil.getAsBigDecimal((Number) value)));
        }
      }
      return typeValuePair;
    }
    catch (EvaluationException ee)
    {
      return new TypeValuePair(ErrorType.TYPE, ee.getErrorValue());
    }
    catch (Exception e)
    {
      logger.warn("Evaluation failed unexpectedly: ", e);
      return new TypeValuePair(ErrorType.TYPE, LibFormulaErrorValue.ERROR_UNEXPECTED_VALUE);
    }
  }
View Full Code Here

Examples of org.pentaho.reporting.libraries.formula.lvalues.TypeValuePair

    }
  }

  public Object evaluate()
  {
    final TypeValuePair pair = evaluateTyped();
    final Object value = pair.getValue();
    if (LibFormulaErrorValue.ERROR_NA_VALUE.equals(value))
    {
      return null;
    }
    return value;
View Full Code Here

Examples of org.pentaho.reporting.libraries.formula.lvalues.TypeValuePair

    {
      for (int col = 0; col < colCount; col += 1)
      {
        final Type type = source.getType(row, col);
        final Object value = source.getValue(row, col);
        backend[row][col] = new TypeValuePair(type, value);
      }
    }
  }
View Full Code Here

Examples of org.pentaho.reporting.libraries.formula.lvalues.TypeValuePair

      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_NA_VALUE);
    }

    final Number number1 = convertToNumber(typeRegistry, value1.getType(), raw1, ZERO);
    final Number number2 = convertToNumber(typeRegistry, value2.getType(), raw2, ZERO);
    return new TypeValuePair(NumberType.GENERIC_NUMBER, evaluate(number1, number2));
  }
View Full Code Here

Examples of org.pentaho.reporting.libraries.formula.lvalues.TypeValuePair

    // return the same as zero minus value.
    final Number number = typeRegistry.convertToNumber(type, rawValue);
    final BigDecimal value = NumberUtil.getAsBigDecimal(number);
    final BigDecimal percentage = NumberUtil.divide(value, HUNDRED);
    return new TypeValuePair(NumberType.GENERIC_NUMBER, percentage);
  }
View Full Code Here

Examples of org.pentaho.reporting.libraries.formula.lvalues.TypeValuePair

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

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

Examples of org.pentaho.reporting.libraries.formula.lvalues.TypeValuePair

      if (o != null)
      {
        resultList.add(o);
      }
    }
    return new TypeValuePair(AnyType.TYPE, resultList.toArray(new String[resultList.size()]));
  }
View Full Code Here

Examples of org.pentaho.reporting.libraries.formula.lvalues.TypeValuePair

    final LocalizationContext localizationContext = context.getLocalizationContext();
    final Date prevweekday = prevweekday(type, localizationContext);

    final Date date = DateUtil.normalizeDate(prevweekday, DateTimeType.DATE_TYPE);
    return new TypeValuePair(DateTimeType.DATE_TYPE, date);
  }
View Full Code Here

Examples of org.pentaho.reporting.libraries.formula.lvalues.TypeValuePair

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

    return new TypeValuePair(NumberType.GENERIC_NUMBER, new BigDecimal(result.length()));
  }
View Full Code Here

Examples of org.pentaho.reporting.libraries.formula.lvalues.TypeValuePair

        list.remove(0);
      }
    }

    final Object[] retval = list.toArray(new Object[list.size()]);
    return new TypeValuePair(AnyType.ANY_ARRAY, retval);
  }
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.