Package org.pentaho.reporting.libraries.formula.lvalues

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


  {
    final String pathText;
    if (pathValue instanceof StaticValue)
    {
      // the configuration cannot be computed, if we are expected to successfully edit it.
      final StaticValue pathStaticValue = (StaticValue) pathValue;
      pathText = String.valueOf(pathStaticValue.getValue());
    }
    else
    {
      pathText = null;
    }
View Full Code Here


    }
  }

  public LValue getRaw(final int row, final int column) throws EvaluationException
  {
    return new StaticValue(getValue(row, column), getType(row, column));
  }
View Full Code Here

      value = jj_consume_token(COLUMN_LOOKUP);
                                retval = new ContextLookup (ParserTools.stripReferenceQuote(value.image), createPosition(value));
      break;
    case STRING_LITERAL:
      value = jj_consume_token(STRING_LITERAL);
                                 retval = new StaticValue (ParserTools.stripQuote(value.image), TextType.TYPE, createPosition(value));
      break;
    case UNSIGNED_NUMERIC_LITERAL:
      value = jj_consume_token(UNSIGNED_NUMERIC_LITERAL);
                                           retval = new StaticValue (new BigDecimal (value.image), NumberType.GENERIC_NUMBER, createPosition(value));
      break;
    case UNSIGNED_INTEGER:
      value = jj_consume_token(UNSIGNED_INTEGER);
                                   retval = new StaticValue (new BigDecimal (value.image), NumberType.GENERIC_NUMBER, createPosition(value));
      break;
    case NULL:
      jj_consume_token(NULL);
               retval = new StaticValue (null, createPosition(value));
      break;
    case L_BRACE:
      jj_consume_token(L_BRACE);
                  retval = parseArray();
      jj_consume_token(R_BRACE);
View Full Code Here

    case NULL:
      switch (jj_nt.kind) {
      case SEMICOLON:
        value = jj_consume_token(SEMICOLON);
           parameterExpected = false;
           params.add(new StaticValue(null, createPosition(value)));
        break;
      case UNSIGNED_INTEGER:
      case L_PAREN:
      case L_BRACE:
      case PLUS:
      case MINUS:
      case IDENTIFIER:
      case COLUMN_LOOKUP:
      case STRING_LITERAL:
      case UNSIGNED_NUMERIC_LITERAL:
      case NULL:
        parameter = getExpression();
           parameterExpected = false;
           params.add(parameter);
        break;
      default:
        jj_la1[8] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
      label_4:
      while (true) {
        switch (jj_nt.kind) {
        case SEMICOLON:
          ;
          break;
        default:
          jj_la1[9] = jj_gen;
          break label_4;
        }
        value = jj_consume_token(SEMICOLON);
           if (parameterExpected == true)
           {
             params.add(new StaticValue(null, createPosition(value)));
           }
           parameterExpected = true;
        switch (jj_nt.kind) {
        case UNSIGNED_INTEGER:
        case L_PAREN:
        case L_BRACE:
        case PLUS:
        case MINUS:
        case IDENTIFIER:
        case COLUMN_LOOKUP:
        case STRING_LITERAL:
        case UNSIGNED_NUMERIC_LITERAL:
        case NULL:
          parameter = getExpression();
           params.add(parameter);
           parameterExpected = false;
          break;
        default:
          jj_la1[10] = jj_gen;
          ;
        }
      }
      break;
    default:
      jj_la1[11] = jj_gen;
      ;
    }
     if (parameterExpected == true)
     {
       params.add(new StaticValue(null, createPosition(value)));
     }

     if (params == null)
     {
       {if (true) return new FormulaFunction(name, new LValue[0], parsePosition);}
View Full Code Here

      final LValue lValue = parser.parse(formula);
      if (lValue.isConstant())
      {
        if (lValue instanceof StaticValue)
        {
          final StaticValue staticValue = (StaticValue) lValue;
          final Object o = staticValue.getValue();
          if (o == null)
          {
            return null; // NON-NLS
          }
          return String.valueOf(o);
View Full Code Here

      if (lValue.isConstant())
      {
        if (lValue instanceof StaticValue)
        {
          final StaticValue staticValue = (StaticValue) lValue;
          final Object o = staticValue.getValue();
          if (o == null)
          {
            return "=NA()"; // NON-NLS
          }
          return String.valueOf(o);
View Full Code Here

      lValue.initialize(formulaContext);
      if (lValue.isConstant())
      {
        if (lValue instanceof StaticValue)
        {
          final StaticValue staticValue = (StaticValue) lValue;
          final Object o = staticValue.getValue();
          if (o == null)
          {
            return "=NA()";
          }
          if (o instanceof Number)
View Full Code Here

        final DefaultDataTable table = new DefaultDataTable();
        final Iterator iterator = colVal.iterator();
        int i = 0;
        while (iterator.hasNext())
        {
          table.setObject(i, 0, new StaticValue(iterator.next()));
          i += 1;
        }
        return table.getAsArray();
      }
      return new ArrayConverterCallback(value, type);
    }

    final Class componentType = valueType.getComponentType();
    if (componentType.isArray())
    {
      final DefaultDataTable table = new DefaultDataTable();
      final int length = Array.getLength(value);
      for (int row = 0; row < length; row++)
      {
        final Object innerArray = Array.get(value, row);
        final int innerLength = Array.getLength(innerArray);
        for (int col = 0; col < innerLength; col++)
        {
          table.setObject(row, col, new StaticValue(Array.get(innerArray, col)));
        }
      }
      return table.getAsArray();
    }

    final DefaultDataTable table = new DefaultDataTable();
    final int length = Array.getLength(value);
    for (int i = 0; i < length; i++)
    {
      table.setObject(i, 0, new StaticValue(Array.get(value, i)));
    }
    return table.getAsArray();
  }
View Full Code Here

  public Sequence convertToSequence(final Type type, final Object value) throws EvaluationException
  {
    // sclar
    if (type.isFlagSet(Type.SCALAR_TYPE))
    {
      return new AnySequence(new StaticValue(value, type), context);
    }
    // else already a sequence
    else if (type.isFlagSet(Type.SEQUENCE_TYPE))
    {
      if (value instanceof Sequence)
View Full Code Here

    }
    // else scalar
    if (type.isFlagSet(Type.SCALAR_TYPE) || type.isFlagSet(Type.NUMERIC_TYPE))
    {
      return new DefaultNumberSequence
          (new StaticValue(convertToNumber(type, value), NumberType.GENERIC_NUMBER), context);
    }
    else
    {
      return new DefaultNumberSequence(context);
    }
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.libraries.formula.lvalues.StaticValue

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.