Package org.formulacompiler.compiler.internal.expressions

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


  }


  public final ExpressionNode rewrite() throws CompilerException
  {
    final ArrayDescriptor tableDescriptor = this.table.arrayDescriptor();
    if (tableDescriptor.numberOfColumns() == ArrayDescriptor.DYNAMIC) {
      throw new CompilerException.SectionOrientation( "The function "
          + this.fun.getFunction() + " can only operate on vertically repeating sections." );
    }

    // We need the type info to properly treat by-example criteria contained in strings.
    TypeAnnotator.annotateExpr( this.table );

    final List<ExpressionNode> tableElements = this.table.arguments();
    final List<String> tableLabels = getLabelsFromTable( tableDescriptor, tableElements );
    final List<ExpressionNode> dataElements = stripLabelsFromTable( tableDescriptor, tableElements );
    final List<CellModel> firstRow = getFirstRowFromTable( tableDescriptor, dataElements );
    final DataType[] colTypes = getColTypesFromFirstRow( firstRow );
    final int[] foldableColumnKeys = getFoldableColumnKeys( colTypes );
    final ExpressionNode data = getShapedDataFromTable( tableDescriptor, dataElements );

    final ArrayDescriptor critDescriptor = this.criteria.arrayDescriptor();
    final List<ExpressionNode> critElements = this.criteria.arguments();
    final List<String> critLabels = getLabelsFromTable( critDescriptor, critElements );
    final List<ExpressionNode> critData = stripLabelsFromTable( critDescriptor, critElements );
    final int[] critCols = associateCriteriaColumnsWithTableLabels( tableLabels, critLabels );
View Full Code Here


  {
    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 {
View Full Code Here


  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

    // Push receiver for index switch method.
    mtd.mv().visitVarInsn( Opcodes.ALOAD, mtd.objectInContext() );

    // Compute index value.
    final ArrayDescriptor desc = _array.arrayDescriptor();
    final int cols = desc.numberOfColumns();
    if (cols == 1 && isNullOrZeroOrOne( _col )) {
      // <row> - 1;
      numCompiler.compileInt( _row );
      mv.push( 1 );
      mv.visitInsn( Opcodes.ISUB );
    }
    else {
      final int rows = desc.numberOfRows();
      if (rows == 1 && isNullOrZeroOrOne( _row )) {
        // <col> - 1;
        numCompiler.compileInt( _col );
        mv.push( 1 );
        mv.visitInsn( Opcodes.ISUB );
View Full Code Here

  @Override
  protected void compileBody() throws CompilerException
  {
    final GeneratorAdapter mv = mv();
    final ArrayDescriptor dim = this.arrayNode.arrayDescriptor();
    final int n = dim.numberOfElements();
    final DataType eltDataType = this.arrayNode.getDataType();
    final TypeCompiler eltCompiler = section().engineCompiler().typeCompiler( eltDataType );
    final Type eltType = eltCompiler.type();

    // private double[] xy;
View Full Code Here

TOP

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

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.