Package org.formulacompiler.compiler.internal.model

Examples of org.formulacompiler.compiler.internal.model.CellModel



  public CellModel createCellModel( CellBinding _cellDef ) throws CompilerException
  {
    final boolean isInput = _cellDef instanceof InputCellBinding;
    final CellModel result = createCellModel( _cellDef.getIndex(), isInput );
    if (isInput) {
      result.makeInput( ((InputCellBinding) _cellDef).getCallChainToCall() );
    }
    return result;
  }
View Full Code Here


  {
    final CellInstance cell = _cellIndex.getCell();
    final boolean nonNull = (null != cell);
    if (nonNull || _isInput) {
      final CellAddress cellAddress = _cellIndex.getCellAddress();
      final CellModel result = new CellModel( this.sectionModel, cellAddress );
      this.compiler.addCellModel( _cellIndex, result );
      if (nonNull) {
        buildCellModel( cell, result );
      }
      return result;
View Full Code Here

  }


  CellModel getOrCreateCellModel( CellIndex _cellIndex ) throws CompilerException
  {
    CellModel result = this.compiler.getCellModel( _cellIndex );
    if (null == result) {
      result = createCellModel( _cellIndex );
    }
    return result;
  }
View Full Code Here

    }
  }

  private ExpressionNode buildExpressionModelForLocalCell( CellIndex _cellIndex ) throws CompilerException
  {
    final CellModel cellModel = getOrCreateCellModel( _cellIndex );
    return new ExpressionNodeForCellModel( cellModel );
  }
View Full Code Here


  private void buildModel() throws CompilerException
  {
    for (OutputCellBinding outputDef : getEngineDef().getOutputs()) {
      CellModel model = getOrCreateCellModel( outputDef.getIndex() );
      model.makeOutput( outputDef.getCallToImplement() );
    }
    for (Entry<CellIndex, InputCellBinding> inputEntry : getEngineDef().getInputs().entrySet()) {
      InputCellBinding inputDef = inputEntry.getValue();
      CellModel model = getCellModel( inputDef.getIndex() );
      if (null != model) {
        model.makeInput( mapDynamicParams( inputDef.getCallChainToCall() ) );
      }
    }
  }
View Full Code Here

    boolean changed = false;
    if (null != args) {
      for (int i = 0; i < args.length; i++) {
        if (args[ i ] instanceof CellIndex) {
          CellIndex cell = (CellIndex) args[ i ];
          CellModel model = getOrCreateCellModel( cell );
          args[ i ] = model;
          changed = true;
        }
      }
    }
View Full Code Here

  }


  private CellModel getOrCreateCellModel( CellIndex _index ) throws CompilerException
  {
    CellModel result = getCellModel( _index );
    if (null == result) {
      result = createCellModel( _index );
    }
    return result;
  }
View Full Code Here

  private CellModel createCellModel( CellIndex _index ) throws CompilerException
  {
    SectionBinding sectionDef = getEngineDef().getSectionFor( _index );
    SectionModelCompiler sectionCompiler = getOrCreateSectionCompiler( sectionDef );
    CellModel result = sectionCompiler.createCellModel( _index );
    return result;
  }
View Full Code Here

  }

  private TypedResult compute() throws CompilerException
  {
    final ExpressionNodeForCellModel cellNode = (ExpressionNodeForCellModel) node();
    final CellModel cellModel = cellNode.getCellModel();

    if (null == cellModel) {
      return ConstResult.NULL;
    }

    if (cellModel.isInput()) {
      return node();
    }

    final Object constantValue = cellModel.getConstantValue();
    if (null != constantValue) {
      if (constantValue instanceof Boolean) {
        boolean bool = ((Boolean) constantValue).booleanValue();
        return new ConstResult( type().adjustConstantValue( Double.valueOf( bool ? 1 : 0 ) ),
            cellModel.getDataType() );
      }
      return cellModel;
    }

    final ExpressionNode expression = cellModel.getExpression();
    if (null != expression) {
      final TypedResult constResult = EvalShadow.evaluate( expression, type() );
      if (constResult instanceof ExpressionNode) {

        // Do not need to clone leaf node.
View Full Code Here

    private ExpressionNode replaceTableCellsByColRefs( ExpressionNode _node, List<CellModel> _firstRow )
        throws CompilerException
    {
      if (_node instanceof ExpressionNodeForCellModel) {
        final ExpressionNodeForCellModel cellNode = (ExpressionNodeForCellModel) _node;
        final CellModel cellModel = cellNode.getCellModel();
        final int iCol = _firstRow.indexOf( cellModel );
        if (iCol >= 0) {
          return var( colPrefix() + iCol );
        }
        else {
View Full Code Here

TOP

Related Classes of org.formulacompiler.compiler.internal.model.CellModel

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.