Examples of TypeValuePair


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

      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.lvalues.TypeValuePair

    // Multiply the minutes with 60 to get the minutes as ints
    final BigDecimal seconds = minutesFraction.multiply(SECONDS);
    final BigDecimal secondsAsInt = NumberUtil.performIntRounding(seconds);

    return new TypeValuePair(NumberType.GENERIC_NUMBER, secondsAsInt);
  }
View Full Code Here

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

  public void testRowsInlineArrays() throws Exception
  {
    final Formula formula = new Formula("{3|2|1}");
    formula.initialize(context);
    final TypeValuePair evaluation = formula.evaluateTyped();
    assertNotNull(evaluation);
    assertTrue(evaluation.getType().isFlagSet(Type.ARRAY_TYPE));

    final ArrayCallback table = (ArrayCallback) evaluation.getValue();
    assertEquals(table.getColumnCount(), 1);
    assertEquals(table.getRowCount(), 3);
  }
View Full Code Here

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

      throws EvaluationException
  {
    final Date now = DateUtil.now(context);

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

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

  public void testColumnsInlineArrays() throws Exception
  {
    final Formula formula = new Formula("{3;2;1}");
    formula.initialize(context);
    final TypeValuePair evaluation = formula.evaluateTyped();
    assertNotNull(evaluation);
    assertTrue(evaluation.getType().isFlagSet(Type.ARRAY_TYPE));

    final ArrayCallback table = (ArrayCallback) evaluation.getValue();
    assertEquals(table.getColumnCount(), 3);
    assertEquals(table.getRowCount(), 1);
  }
View Full Code Here

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

        final Object o = sequence.next();
        computedResult.add(o);
      }
    }

    return new TypeValuePair(AnyType.ANY_ARRAY, computedResult.toArray());
  }
View Full Code Here

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

  public void testInlineArrays() throws Exception
  {
    final Formula formula = new Formula("{3;2;1|2;4;6}");
    formula.initialize(context);

    final TypeValuePair evaluation = formula.evaluateTyped();
    assertNotNull(evaluation);
    assertTrue(evaluation.getType().isFlagSet(Type.ARRAY_TYPE));

    final ArrayCallback table = (ArrayCallback) evaluation.getValue();
    assertEquals(table.getColumnCount(), 3);
    assertEquals(table.getRowCount(), 2);
  }
View Full Code Here

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

        final Number result = context.getTypeRegistry().convertToNumber(type1, value1);
        if (result == null ) {
            throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
        }
        final double d = result.doubleValue();
        return new TypeValuePair(NumberType.GENERIC_NUMBER, new BigDecimal(Math.cos(d)));
    }
View Full Code Here

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

    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.lvalues.TypeValuePair

    if (result.intValue() > 255)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
    }

    return new TypeValuePair(TextType.TYPE, String.valueOf(((char) result.intValue())));
  }
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.