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

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


      else
      {
        throw ee;
      }
    }
    final ArrayCallback parameter = typeRegistry.convertToArray(parameters.getType(2), parameters.getValue(2));

    final LinkCustomizer pattern = createLinkCustomizer(configIndicator);
    return new TypeValuePair(TextType.TYPE, pattern.format(context, configIndicator, path,
        computeParameterEntries(parameter, typeRegistry)));
  }
View Full Code Here


    final ArrayList numbers = new ArrayList();
    try
    {
      if (o instanceof ArrayCallback)
      {
        final ArrayCallback acb = (ArrayCallback) o;
        final int rowCount = acb.getRowCount();
        final int colCount = acb.getColumnCount();
        for (int row = 0; row < rowCount; row++)
        {
          for (int column = 0; column < colCount; column++)
          {
            numbers.add(acb.getValue(row, column));
          }
        }
        return (Number[]) numbers.toArray(new Number[numbers.size()]);
      }
View Full Code Here

      stack.push(s);
      return hasNext();
    }
    else if (o instanceof ArrayCallback)
    {
      final ArrayCallback array = (ArrayCallback) o;
      final AnySequence s = new AnySequence(array, context);
      stack.push(s);
      return hasNext();
    }
    else if (o instanceof Sequence)
View Full Code Here

    final ArrayList<Number> numbers = new ArrayList<Number>();
    try
    {
      if (o instanceof ArrayCallback)
      {
        final ArrayCallback acb = (ArrayCallback) o;
        final int rowCount = acb.getRowCount();
        final int colCount = acb.getColumnCount();
        for (int row = 0; row < rowCount; row++)
        {
          for (int column = 0; column < colCount; column++)
          {
            numbers.add((Number) acb.getValue(row, column));
          }
        }
        return numbers.toArray(new Number[numbers.size()]);
      }
View Full Code Here

      else
      {
        throw ee;
      }
    }
    final ArrayCallback parameter = typeRegistry.convertToArray(parameters.getType(2), parameters.getValue(2));

    final LinkCustomizer pattern = createLinkCustomizer(configIndicator);
    return new TypeValuePair(TextType.TYPE, pattern.format(context, configIndicator, path,
        computeParameterEntries(parameter, typeRegistry)));
  }
View Full Code Here

    if (parameterCount < 2 || parameterCount > 4)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_ARGUMENTS_VALUE);
    }

    final ArrayCallback arrayCallback =
        context.getTypeRegistry().convertToArray(parameters.getType(0), parameters.getValue(0));
    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;
      }
      else
      {
        columnNumber = context.getTypeRegistry().convertToNumber(columnType, columnValue);
      }
      if (columnNumber == null)
      {
        columnNumber = new BigDecimal(1);
      }
      else if (columnNumber.intValue() <= 0)
      {
        throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
      }
      return new TypeValuePair(AnyType.TYPE, arrayCallback.getValue(rowNumber.intValue() - 1, columnNumber.intValue() - 1));
    }
    else
    {
      return new TypeValuePair(AnyType.TYPE, arrayCallback.getValue(rowNumber.intValue() - 1, 0));
    }
  }
View Full Code Here

      throws EvaluationException
  {
    int count = 0;
    if (o instanceof ArrayCallback)
    {
      final ArrayCallback callback = (ArrayCallback) o;
      final int rowCount = callback.getRowCount();
      final int colCount = callback.getColumnCount();
      for (int r = 0; r < rowCount; r++)
      {
        for (int c = 0; c < colCount; c++)
        {
          final Object val = callback.getValue(r, c);
          if (val != null)
          {
            count += countElement(val);
          }
        }
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.libraries.formula.typing.ArrayCallback

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.