Package org.formulacompiler.spreadsheet.internal

Examples of org.formulacompiler.spreadsheet.internal.CellRange$Tiler


        final String name = se.getAttributeByName( XMLConstants.Main.NAME ).getValue();
        if (!name.startsWith( DEFINED_NAME_RESERVED_PREFIX )) {
          final String cellRangeAddress = getText();
          final ExpressionParser parser = new SpreadsheetExpressionParserA1OOXML( cellRangeAddress, _spreadsheet );
          try {
            final CellRange cellRange = (CellRange) parser.rangeOrCellRefA1();
            _spreadsheet.defineModelRangeName( name, cellRange );
          }
          catch (org.formulacompiler.compiler.internal.expressions.parser.ParseException e) {
            throw new SpreadsheetException.LoadError( "Error parsing named range " + name, e );
          }
View Full Code Here


      final String name = expressionNodeForRange.getName();
      if (name != null) {
        _stringBuilder.append( name );
      }
      else {
        final CellRange range = expressionNodeForRange.getRange();
        _stringBuilder.append( '[' );
        RefFormatter.append( _stringBuilder, range, _baseCell );
        _stringBuilder.append( ']' );
      }
    }
View Full Code Here

  }


  private final CellRange parseNamedRef( String _ident )
  {
    final CellRange ref = this.workbook.getModelRangeNames().get( _ident );
    if (null == ref) {
      throw new InnerParserException( new CompilerException.UnsupportedExpression( "The name '"
          + _ident + "' is not defined in this spreadsheet." ) );
    }
    return ref;
View Full Code Here

  @Override
  protected final ExpressionNode makeNamedRangeRef( Token _name )
  {
    final String name = _name.image;
    final CellRange range = parseNamedRef( name );
    if (range instanceof CellIndex) {
      final CellIndex cell = (CellIndex) range;
      return new ExpressionNodeForCell( cell, name );
    }
    else {
View Full Code Here

    if (_reference instanceof CellIndex) {
      final CellIndex cell = (CellIndex) _reference;
      return new ExpressionNodeForCell( cell );
    }
    else if (_reference instanceof CellRange) {
      final CellRange range = (CellRange) _reference;
      return new ExpressionNodeForRange( range );
    }
    throw new IllegalArgumentException( "Reference must be a cell or range" );
  }
View Full Code Here

      }
    }
    else if (!_allowRanges && node instanceof ExpressionNodeForRange) {
      try {
        final ExpressionNodeForRange nodeForRange = (ExpressionNodeForRange) node;
        final CellRange range = nodeForRange.getRange();
        final CellIndex cell = range.getCellIndexRelativeTo( this.cellIndex );
        _nodeSource.setExpressionNode( new ExpressionNodeForCell( cell, nodeForRange.getName() ) );
      } catch (SpreadsheetException e) {
        throw new InnerParserException( e );
      }
    }
View Full Code Here

  }


  SectionModelCompiler createSectionCompiler( SectionBinding _sectionDef )
  {
    final CellRange range = _sectionDef.getRange();
    final BaseSpreadsheet spreadsheet = range.getFrom().getSheet().getSpreadsheet();
    final Set<String> names = spreadsheet.getNamesFor( range );
    final String name = names != null && !names.isEmpty() ? names.iterator().next() : null;
    final RangeAddress rangeAddress = range.getRangeAddress();
    final SectionModel model = new SectionModel( getSectionModel(), rangeAddress, name,
        _sectionDef.getInputClass(), _sectionDef.getOutputClass() );
    model.makeInput( _sectionDef.getCallChainToCall() );
    if (_sectionDef.getCallToImplement() != null) {
      model.makeOutput( _sectionDef.getCallToImplement() );
View Full Code Here

      final CellIndex cell = ((ExpressionNodeForCell) _exprDef).getCellIndex();
      return buildExpressionModelForCell( cell );
    }
    else if (_exprDef instanceof ExpressionNodeForRangeShape) {
      final ExpressionNode expressionNode = _exprDef.arguments().get( 0 );
      final CellRange range;
      if (expressionNode instanceof ExpressionNodeForRange) {
        range = ((ExpressionNodeForRange) expressionNode).getRange();
      }
      else if (expressionNode instanceof ExpressionNodeForCell) {
        range = ((ExpressionNodeForCell) expressionNode).getCellIndex();
      }
      else {
        throw new IllegalArgumentException();
      }
      return new RangeExpressionBuilder( range, true ).build();
    }
    else if (_exprDef instanceof ExpressionNodeForRange) {
      final CellRange range = ((ExpressionNodeForRange) _exprDef).getRange();
      return new RangeExpressionBuilder( range, false ).build();
    }
    else {
      final ExpressionNode result = _exprDef.cloneWithoutArguments();
      for (ExpressionNode arg : _exprDef.arguments()) {
View Full Code Here

      /*
       * This loop relies on the subsections of the current section being sorted in ascending
       * flow order.
       */
      CellRange next = range;
      for (SectionBinding inner : this.sectionDef.getSections()) {
        final CellRange innerRange = inner.getRange();
        final Orientation innerOrient = inner.getOrientation();
        final CellRange[] tiling = (innerOrient == ownOrient) ? next.tilingAround( innerRange, innerOrient ) : next
            .tilingAround( innerRange );
        switch (tiling.length) {

          case CellRange.NO_INTERSECTION:
            break;

          case CellRange.CONTAINED: {
            final ExpressionNode expr = buildExpressionModelForInnerRange( inner, next );
            elts.add( expr );
            next = null;
            break;
          }

          case CellRange.FLOW_TILES: {
            final CellRange before = tiling[ CellRange.FLOW_BEFORE ];
            if (null != before) {
              /*
               * This is where we rely on proper sorting. It ensures that `before` cannot
               * possibly overlap one of the remaining inner section to scan.
               */
 
View Full Code Here

      if (this.stepOutOnly) {
        throw new CompilerException.ReferenceToOuterInnerCell();
      }

      makeDynamic( _inner.getOrientation() );
      final CellRange innerRange = _inner.getPrototypeRange( _range );
      final SectionPath path = new SectionPath( SectionModelCompiler.this );
      path.stepInto( _inner );
      final SectionModelCompiler innerDef = path.getSectionCompiler();
      final ExpressionNode expr = innerDef.new RangeExpressionBuilder( this, innerRange, shaped )
          .buildContainedRange();
View Full Code Here

TOP

Related Classes of org.formulacompiler.spreadsheet.internal.CellRange$Tiler

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.