Package org.pentaho.reporting.libraries.formula

Examples of org.pentaho.reporting.libraries.formula.FormulaContext


            GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
  }

  public void setFormulaContext(final FormulaContext formulaContext)
  {
    final FormulaContext old = this.formulaContext;
    this.formulaContext = formulaContext;
    if (formulaContext != null && formulaContext != old)
    {
      final DefaultComboBoxModel aModel = new DefaultComboBoxModel();
      aModel.addElement(null);
View Full Code Here


    return EMPTY_DATA;
  }

  public void testDateConversion1904 ()
  {
    final FormulaContext context = getContext();
    final Date januaryFirst1904 = DateUtil.createDate(1904, 1, 1, context.getLocalizationContext());
    final Date januaryFirst1900 = DateUtil.createDate(1900, 1, 1, context.getLocalizationContext());
    final Date marchFirst1904 = DateUtil.createDate(1904, 3, 1, context.getLocalizationContext());
    final Date marchFirst1900 = DateUtil.createDate(1900, 3, 1, context.getLocalizationContext());

    // these numbers must match whatever OpenOffice computes ..
    assertEqual(HSSFDateUtil.getExcelDate(januaryFirst1900, false, HSSFDateUtil.computeZeroDate("1904", false)), new BigDecimal(-1460));
    assertEqual(HSSFDateUtil.getExcelDate(marchFirst1900, false, HSSFDateUtil.computeZeroDate("1904", false)), new BigDecimal(-1401));
    assertEqual(HSSFDateUtil.getExcelDate(januaryFirst1904, false, HSSFDateUtil.computeZeroDate("1904", false)), new BigDecimal(0));
View Full Code Here

  }

  public void testDateConversion1900 ()
  {
    final FormulaContext context = getContext();
    final Date januaryFirst1904 = DateUtil.createDate(1904, 1, 1, context.getLocalizationContext());
    final Date januaryFirst1900 = DateUtil.createDate(1900, 1, 1, context.getLocalizationContext());
    final Date marchFirst1904 = DateUtil.createDate(1904, 3, 1, context.getLocalizationContext());
    final Date marchFirst1900 = DateUtil.createDate(1900, 3, 1, context.getLocalizationContext());

    // these numbers must match whatever OpenOffice computes ..
    assertEqual(HSSFDateUtil.getExcelDate(januaryFirst1900, false, HSSFDateUtil.computeZeroDate("1900", false)), new BigDecimal(0));
    assertEqual(HSSFDateUtil.getExcelDate(marchFirst1900, false, HSSFDateUtil.computeZeroDate("1900", false)), new BigDecimal(59));
    assertEqual(HSSFDateUtil.getExcelDate(januaryFirst1904, false, HSSFDateUtil.computeZeroDate("1900", false)), new BigDecimal(1460));
View Full Code Here

  }


  public void testDateConversion1899 ()
  {
    final FormulaContext context = getContext();
    final Date januaryFirst1904 = DateUtil.createDate(1904, 1, 1, context.getLocalizationContext());
    final Date januaryFirst1900 = DateUtil.createDate(1900, 1, 1, context.getLocalizationContext());
    final Date marchFirst1904 = DateUtil.createDate(1904, 3, 1, context.getLocalizationContext());
    final Date marchFirst1900 = DateUtil.createDate(1900, 3, 1, context.getLocalizationContext());

    // these numbers must match whatever OpenOffice computes ..
    assertEqual(HSSFDateUtil.getExcelDate(januaryFirst1900, false, HSSFDateUtil.computeZeroDate("1899", false)), new BigDecimal(2));
    assertEqual(HSSFDateUtil.getExcelDate(marchFirst1900, false, HSSFDateUtil.computeZeroDate("1899", false)), new BigDecimal(61));
    assertEqual(HSSFDateUtil.getExcelDate(januaryFirst1904, false, HSSFDateUtil.computeZeroDate("1899", false)), new BigDecimal(1462));
View Full Code Here

  }

  public TypeValuePair evaluate() throws EvaluationException
  {
    // First, grab the parameters and their types.
    final FormulaContext context = getContext();
    // And if everything is ok, compute the stuff ..
    if (function == null)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_FUNCTION_VALUE);
    }
View Full Code Here

    setParsePosition(parsePosition);
  }

  public TypeValuePair evaluate() throws EvaluationException
  {
    final FormulaContext context = getContext();
    final Type type = context.resolveReferenceType(name);
    final Object value = context.resolveReference(name);
    if (value == null)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_NA_VALUE);
    }
    return new TypeValuePair(type, value);
View Full Code Here

  public Type getValueType()
  {
    try
    {
      final FormulaContext context = getContext();
      return context.resolveReferenceType(name);
    }
    catch (final EvaluationException evalex)
    {
      // exception ignored.
      return ErrorType.TYPE;
View Full Code Here

  private Trans prepareTransformation(final DataRow parameters,
                                      final DataFactoryContext context,
                                      final TransMeta transMeta) throws EvaluationException, ParseException, KettleException
  {
    final FormulaContext formulaContext = new WrappingFormulaContext(context.getFormulaContext(), parameters);
    final String[] params = fillArguments(formulaContext);

    final Trans trans = new Trans(transMeta);
    trans.setArguments(params);
    updateTransformationParameter(formulaContext, trans);
View Full Code Here

    return EMPTY_DATA;
  }

  public void testDateConversion1904 ()
  {
    final FormulaContext context = getContext();
    final Date januaryFirst1904 = DateUtil.createDate(1904, 1, 1, context.getLocalizationContext());
    final Date januaryFirst1900 = DateUtil.createDate(1900, 1, 1, context.getLocalizationContext());
    final Date marchFirst1904 = DateUtil.createDate(1904, 3, 1, context.getLocalizationContext());
    final Date marchFirst1900 = DateUtil.createDate(1900, 3, 1, context.getLocalizationContext());

    // these numbers must match whatever OpenOffice computes ..
    assertEqual(HSSFDateUtil.getExcelDate(januaryFirst1900, false, HSSFDateUtil.computeZeroDate("1904", false)), new BigDecimal(-1460));
    assertEqual(HSSFDateUtil.getExcelDate(marchFirst1900, false, HSSFDateUtil.computeZeroDate("1904", false)), new BigDecimal(-1401));
    assertEqual(HSSFDateUtil.getExcelDate(januaryFirst1904, false, HSSFDateUtil.computeZeroDate("1904", false)), new BigDecimal(0));
View Full Code Here

  }

  public void testDateConversion1900 ()
  {
    final FormulaContext context = getContext();
    final Date januaryFirst1904 = DateUtil.createDate(1904, 1, 1, context.getLocalizationContext());
    final Date januaryFirst1900 = DateUtil.createDate(1900, 1, 1, context.getLocalizationContext());
    final Date marchFirst1904 = DateUtil.createDate(1904, 3, 1, context.getLocalizationContext());
    final Date marchFirst1900 = DateUtil.createDate(1900, 3, 1, context.getLocalizationContext());

    // these numbers must match whatever OpenOffice computes ..
    assertEqual(HSSFDateUtil.getExcelDate(januaryFirst1900, false, HSSFDateUtil.computeZeroDate("1900", false)), new BigDecimal(0));
    assertEqual(HSSFDateUtil.getExcelDate(marchFirst1900, false, HSSFDateUtil.computeZeroDate("1900", false)), new BigDecimal(59));
    assertEqual(HSSFDateUtil.getExcelDate(januaryFirst1904, false, HSSFDateUtil.computeZeroDate("1900", false)), new BigDecimal(1460));
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.libraries.formula.FormulaContext

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.