Examples of ExpressionNodeForArrayReference


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

  private ExpressionNodeForArrayReference vectorsToMatrix( ExpressionNodeForArrayReference... _vectors )
  {
    final int rows = _vectors[ 0 ].arguments().size();
    final int cols = _vectors.length;
    final ArrayDescriptor desc = new ArrayDescriptor( 1, rows, cols );
    final ExpressionNodeForArrayReference result = new ExpressionNodeForArrayReference( desc );

    for (int row = 0; row < rows; row++)
      for (int col = 0; col < cols; col++)
        result.addArgument( _vectors[ col ].argument( row ) );

    return result;
  }
View Full Code Here

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

      List<ExpressionNode> _result )
  {
    final Iterator<ExpressionNode> iElt = _tableElements.iterator();
    final ExpressionNode first = iElt.next();
    if (first instanceof ExpressionNodeForArrayReference) {
      final ExpressionNodeForArrayReference firstArr = (ExpressionNodeForArrayReference) first;
      final ArrayDescriptor firstArrDesc = firstArr.arrayDescriptor();
      final int firstArrRows = firstArrDesc.numberOfRows();
      if (firstArrRows > 1) {
        final ExpressionNodeForArrayReference newFirstArr = new ExpressionNodeForArrayReference(
            new ArrayDescriptor( firstArrDesc, +0, 0, -1, 0 ) );
        stripLabelsFromTableInto( firstArrDesc, firstArr.arguments(), newFirstArr.arguments() );
        _result.add( newFirstArr );
      }
    }
    else {
      final int nCol = _tableDesc.numberOfColumns();
View Full Code Here

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

  private ExpressionNodeForArrayReference getShapedDataFromTable( ArrayDescriptor _tableDesc,
      List<ExpressionNode> _tableElements )
  {
    final ArrayDescriptor dd = new ArrayDescriptor( _tableDesc, +1, 0, -1, 0 );
    final ExpressionNodeForArrayReference result = new ExpressionNodeForArrayReference( dd );
    result.arguments().addAll( _tableElements );
    return result;
  }
View Full Code Here

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


  @Override
  protected void compileBody() throws CompilerException
  {
    final ExpressionNodeForArrayReference arrayNode = this.node;
    final ExpressionCompiler valCompiler = expressionCompiler( arrayNode.getDataType() );
    final int valReturn = valCompiler.typeCompiler().returnOpcode();
    final GeneratorAdapter mv = mv();

    final List<ExpressionNode> vals = arrayNode.arguments();
    final int valCnt = vals.size();
    if (valCnt > 0) {
      mv.visitVarInsn( Opcodes.ILOAD, 1 ); // index

      // gen switch
View Full Code Here

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

  private static final String[] TYPE_SUFFIXES = { "Descending", "Exact", "Ascending" };

  private void compileMatch( ExpressionNodeForFunction _node, int _type ) throws CompilerException
  {
    final ExpressionNode valNode = _node.argument( 0 );
    final ExpressionNodeForArrayReference arrayNode = (ExpressionNodeForArrayReference) _node.argument( 1 );
    if (valNode.getDataType() != arrayNode.getDataType()) {
      throw new CompilerException.UnsupportedExpression(
          "MATCH must have the same type of argument in the first and second slot." );
    }
    final int type = (_type > 0) ? +1 : (_type < 0) ? -1 : 0;
View Full Code Here

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

  private static final Type[] NA_TYPES = { NOT_AVAILABLE_ERROR_TYPE };


  private final void compileIndex( ExpressionNodeForFunction _node ) throws CompilerException
  {
    final ExpressionNodeForArrayReference array = (ExpressionNodeForArrayReference) _node.argument( 0 );
    switch (_node.cardinality()) {
      case 2:
        if (array.arrayDescriptor().numberOfColumns() == 1) {
          compileIndex( array, _node.argument( 1 ), null );
        }
        else if (array.arrayDescriptor().numberOfRows() == 1) {
          compileIndex( array, null, _node.argument( 1 ) );
        }
        else {
          throw new CompilerException.UnsupportedExpression(
              "INDEX with single index expression must not have two-dimensional range argument." );
View Full Code Here

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


  protected final void compileArray( ExpressionNode _arrayNode ) throws CompilerException
  {
    final GeneratorAdapter mv = mv();
    final ExpressionNodeForArrayReference arr = (ExpressionNodeForArrayReference) _arrayNode;
    mv.push( arr.arrayDescriptor().numberOfElements() );
    compileNewArray();
    int i = 0;
    for (ExpressionNode arg : arr.arguments()) {
      mv.visitInsn( Opcodes.DUP );
      mv.push( i++ );
      compile( arg );
      mv.visitInsn( arrayStoreOpcode() );
    }
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.