Package org.formulacompiler.compiler.internal.expressions

Examples of org.formulacompiler.compiler.internal.expressions.ExpressionNodeForConstantValue


    else {
      matchNode = new ExpressionNodeForFunction( matchFun, valueNode, lookupArrayNode );
    }

    if (indexNode instanceof ExpressionNodeForConstantValue) {
      final ExpressionNodeForConstantValue constIndex = (ExpressionNodeForConstantValue) indexNode;
      final int index = this.numericType.toInt( constIndex.value(), -1 ) - 1;
      final ExpressionNode valueArrayNode = getHVLookupSubArray( fun, arrayNode, index );
      return fun( INDEX, valueArrayNode, matchNode );
    }
    else {
      final String matchRefName = "x";
View Full Code Here



  protected final ExpressionNode valueToNode( TypedResult _value )
  {
    if (null == _value) {
      return new ExpressionNodeForConstantValue( null, DataType.NULL );
    }
    if (_value instanceof ExpressionNode) {
      return (ExpressionNode) _value;
    }
    return new ExpressionNodeForConstantValue( _value.getConstantValue(), _value.getDataType() );
  }
View Full Code Here

  {
    if (null == _exprDef) {
      return null;
    }
    else if (_exprDef instanceof ExpressionNodeForConstantValue) {
      final ExpressionNodeForConstantValue cst = (ExpressionNodeForConstantValue) _exprDef;
      return new ExpressionNodeForConstantValue( adjustConstantValue( cst.value() ) );
    }
    else if (_exprDef instanceof ExpressionNodeForCell) {
      final CellIndex cell = ((ExpressionNodeForCell) _exprDef).getCellIndex();
      return buildExpressionModelForCell( cell );
    }
View Full Code Here

    for (TypedResult arg : _args) {
      if (arg instanceof ExpressionNode) {
        result.addArgument( (ExpressionNode) arg );
      }
      else {
        result.addArgument( new ExpressionNodeForConstantValue( arg.getConstantValue(), arg.getDataType() ) );
      }
    }
    return result;
  }
View Full Code Here

  }


  public ExprNode ref( Constant _const )
  {
    return new ExprNodeImpl( new ExpressionNodeForConstantValue( valueOf( _const ) ) );
  }
View Full Code Here

  protected static final Object NOT_CONST = new Object();

  protected final Object constantValueOf( ExpressionNode _node )
  {
    if (_node instanceof ExpressionNodeForConstantValue) {
      final ExpressionNodeForConstantValue constNode = (ExpressionNodeForConstantValue) _node;
      return constNode.value();
    }
    else if (_node instanceof ExpressionNodeForCellModel) {
      final ExpressionNodeForCellModel cellNode = (ExpressionNodeForCellModel) _node;
      final CellModel cell = cellNode.getCellModel();
      if (null == cell) {
View Full Code Here

      final ExpressionNodeForCellModel cellNode = (ExpressionNodeForCellModel) result;
      final CellModel cellModel = cellNode.getCellModel();
      if (!isInlineable( cellModel )) return result;
      result = cellModel.getExpression();
      if (null == result) {
        result = new ExpressionNodeForConstantValue( cellModel.getConstantValue(), cellModel.getDataType() );
      }
      else {
        cellModel.setExpression( null );
      }
    }
View Full Code Here

          isConst = false;
        }
      }
      if (!isConst) {
        if (buildUp != null) {
          newArgs.add( new ExpressionNodeForConstantValue( buildUp.toString(), DataType.STRING ) );
          buildUp = null;
        }
        newArgs.add( arg );
      }
    }
    if (modified) {
      if (buildUp != null) {
        newArgs.add( new ExpressionNodeForConstantValue( buildUp.toString(), DataType.STRING ) );
      }
      final ExpressionNodeForOperator res = new ExpressionNodeForOperator( Operator.CONCAT, newArgs );
      res.setDataType( DataType.STRING );
      return res;
    }
View Full Code Here

      }

      case 3: {
        final ExpressionNode typeArg = _node.arguments().get( 2 );
        if (typeArg instanceof ExpressionNodeForConstantValue) {
          final ExpressionNodeForConstantValue constTypeArg = (ExpressionNodeForConstantValue) typeArg;
          final Object typeVal = constTypeArg.value();
          if (typeVal instanceof Number) {
            compileMatch( _node, ((Number) typeVal).intValue() );
          }
          else if (typeVal instanceof Boolean) {
            compileMatch( _node, (Boolean) typeVal ? 1 : 0 );
View Full Code Here

  private final boolean isNullOrZeroOrOne( ExpressionNode _node )
  {
    if (_node == null) return true;
    if (_node instanceof ExpressionNodeForConstantValue) {
      final ExpressionNodeForConstantValue constNode = (ExpressionNodeForConstantValue) _node;
      final Number constValue = (Number) constNode.value();
      return (constValue == null || constValue.intValue() == 0 || constValue.intValue() == 1);
    }
    return false;
  }
View Full Code Here

TOP

Related Classes of org.formulacompiler.compiler.internal.expressions.ExpressionNodeForConstantValue

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.