Package org.formulacompiler.compiler

Examples of org.formulacompiler.compiler.Function



  @Override
  protected TypedResult eval() throws CompilerException
  {
    final Function function = ((ExpressionNodeForFunction) node()).getFunction();
    switch (function) {

      case AND:
        return evalBooleanSequence( false );
View Full Code Here



  @Override
  protected TypedResult evaluateToConst( TypedResult... _args ) throws InterpreterException
  {
    final Function function = ((ExpressionNodeForFunction) node()).getFunction();
    if (function.isVolatile()) {
      return evaluateToNode( _args );
    }
    else {
      switch (function) {
View Full Code Here

          if (parenthesesNeeded) _stringBuilder.append( ')' );
          break;
      }
    }
    else if (_expr instanceof ExpressionNodeForFunction) {
      final Function function = ((ExpressionNodeForFunction) _expr).getFunction();
      _stringBuilder.append( function );
      _stringBuilder.append( '(' );
      final List<ExpressionNode> argList = _expr.arguments();
      appendArguments( _stringBuilder, argList, ",", _baseCell, null );
      _stringBuilder.append( ')' );
View Full Code Here

          if (parenthesesNeeded) _stringBuilder.append( ')' );
          break;
      }
    }
    else if (_expr instanceof ExpressionNodeForFunction) {
      final Function function = ((ExpressionNodeForFunction) _expr).getFunction();
      _stringBuilder.append( function );
      _stringBuilder.append( '(' );
      final List<ExpressionNode> argList = _expr.arguments();
      appendArguments( _stringBuilder, argList, ";", _baseCell, null );
      _stringBuilder.append( ')' );
View Full Code Here

  {
    final ExpressionNodeForArrayReference array = (ExpressionNodeForArrayReference) _fun.argument( 1 );
    final ArrayDescriptor desc = array.arrayDescriptor();
    final int cols = desc.numberOfColumns();
    final int rows = desc.numberOfRows();
    final Function lookupFun;
    final int index;
    if (cols > rows) {
      lookupFun = HLOOKUP;
      index = rows;
    }
View Full Code Here

  }


  private ExpressionNode rewriteHVLookup( ExpressionNodeForFunction _fun )
  {
    final Function fun = _fun.getFunction();
    final ExpressionNode valueNode = _fun.argument( 0 );
    final ExpressionNodeForArrayReference arrayNode = (ExpressionNodeForArrayReference) _fun.argument( 1 );
    final ExpressionNode indexNode = _fun.argument( 2 );
    final ExpressionNode lookupArrayNode = getHVLookupSubArray( fun, arrayNode, 0 );

    final ExpressionNode matchNode;
    final Function matchFun = (indexNode instanceof ExpressionNodeForConstantValue) ? INTERNAL_MATCH_INT : MATCH;
    if (_fun.cardinality() >= 4) {
      final ExpressionNode typeNode = _fun.argument( 3 );
      matchNode = new ExpressionNodeForFunction( matchFun, valueNode, lookupArrayNode, typeNode );
    }
    else {
View Full Code Here

  {
    final ExpressionNodeForArrayReference array = (ExpressionNodeForArrayReference) _fun.argument( 1 );
    final ArrayDescriptor desc = array.arrayDescriptor();
    final int cols = desc.numberOfColumns();
    final int rows = desc.numberOfRows();
    final Function lookupFun;
    final int index;
    if (cols > rows) {
      lookupFun = HLOOKUP;
      index = rows;
    }
View Full Code Here

  }


  private ExpressionNode rewriteHVLookup( ExpressionNodeForFunction _fun )
  {
    final Function fun = _fun.getFunction();
    final ExpressionNode valueNode = _fun.argument( 0 );
    final ExpressionNodeForArrayReference arrayNode = (ExpressionNodeForArrayReference) _fun.argument( 1 );
    final ExpressionNode indexNode = _fun.argument( 2 );
    final ExpressionNode lookupArrayNode = getHVLookupSubArray( fun, arrayNode, 0 );

    final ExpressionNode matchNode;
    final Function matchFun = (indexNode instanceof ExpressionNodeForConstantValue) ? INTERNAL_MATCH_INT : MATCH;
    if (_fun.cardinality() >= 4) {
      final ExpressionNode typeNode = _fun.argument( 3 );
      matchNode = new ExpressionNodeForFunction( matchFun, valueNode, lookupArrayNode, typeNode );
    }
    else {
View Full Code Here

        }
      }

      else if (this.node instanceof ExpressionNodeForFunction) {
        final ExpressionNodeForFunction fnNode = (ExpressionNodeForFunction) this.node;
        final Function fn = fnNode.getFunction();

        switch (fn) {

          case AND:
            compileAnd();
View Full Code Here

  protected abstract void innerCompileConversionToResultOf( Method _method ) throws CompilerException;


  protected void compileFunction( ExpressionNodeForFunction _node ) throws CompilerException
  {
    final Function fun = _node.getFunction();
    switch (fun) {

      case INDEX:
        compileIndex( _node );
        break;
View Full Code Here

TOP

Related Classes of org.formulacompiler.compiler.Function

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.