org.formulacompiler.spreadsheet
Interface SpreadsheetBinder.Section

Enclosing interface:
SpreadsheetBinder

public static interface SpreadsheetBinder.Section

Represents both the container for the definitions of global spreadsheet cells and instances of horizontal or vertical sections within a spreadsheet. See the tutorial for details on sections.

This interface is an API only. Do not implement it yourself.

Author:
peo
See Also:
SpreadsheetBinder.getRoot(), EngineBuilder.getRootBinder()

Method Summary
 void defineInputCell(Spreadsheet.Cell _cell, CallFrame _callChainToCall)
          Marks a given spreadsheet cell as a variable input to the constructed engine and binds it to the given method call chain.
 void defineInputCell(Spreadsheet.Cell _cell, java.lang.reflect.Method _methodToCall, java.lang.Object... _args)
          Like defineInputCell(org.formulacompiler.spreadsheet.Spreadsheet.Cell, CallFrame), but constructs the CallFrame directly.
 void defineInputCell(Spreadsheet.Cell _cell, java.lang.String _nameOfMethodToCall)
          Like defineInputCell(org.formulacompiler.spreadsheet.Spreadsheet.Cell, CallFrame), but constructs the CallFrame directly from a method looked up by name on getInputClass().
 void defineOutputCell(Spreadsheet.Cell _cell, CallFrame _callToImplement)
          Marks a given spreadsheet cell as a computable output of the constructed engine and binds it to the given call.
 void defineOutputCell(Spreadsheet.Cell _cell, java.lang.reflect.Method _methodToImplement, java.lang.Object... _args)
          Like defineOutputCell(org.formulacompiler.spreadsheet.Spreadsheet.Cell, CallFrame), but constructs the CallFrame directly.
 void defineOutputCell(Spreadsheet.Cell _cell, java.lang.String _nameOfMethodToImplement)
          Like defineOutputCell(org.formulacompiler.spreadsheet.Spreadsheet.Cell, CallFrame), but constructs the CallFrame directly from a method looked up by name on getOutputClass().
 SpreadsheetBinder.Section defineRepeatingSection(Spreadsheet.Range _range, Orientation _orientation, CallFrame _inputCallChainReturningIterable, java.lang.Class _inputClass, CallFrame _outputCallReturningIterableToImplement, java.lang.Class _outputClass)
          Defines a range in the spreadsheet as a section of similar, repeating rows (or columns).
 SpreadsheetBinder.Section defineRepeatingSection(Spreadsheet.Range _range, Orientation _orientation, java.lang.reflect.Method _inputMethodReturningIterable, java.lang.Class _inputClass, java.lang.reflect.Method _outputMethodReturningIterableToImplement, java.lang.Class _outputClass)
          Like defineRepeatingSection(org.formulacompiler.spreadsheet.Spreadsheet.Range, Orientation, CallFrame, Class, CallFrame, Class), but constructs the CallFrame instances directly.
 SpreadsheetBinder.Section defineRepeatingSection(Spreadsheet.Range _range, Orientation _orientation, java.lang.String _nameOfInputMethodReturningIterable, java.lang.Class _inputClass, java.lang.String _nameOfOutputMethodReturningIterableToImplement, java.lang.Class _outputClass)
          Like defineRepeatingSection(org.formulacompiler.spreadsheet.Spreadsheet.Range, Orientation, CallFrame, Class, CallFrame, Class), but constructs the CallFrame instances directly.
 java.lang.Class getInputClass()
          The class of the input type to whose methods you are binding input elements.
 java.lang.Class getOutputClass()
          The class of the output type whose methods you are binding to output elements.
 

Method Detail

getInputClass

java.lang.Class getInputClass()
The class of the input type to whose methods you are binding input elements.


getOutputClass

java.lang.Class getOutputClass()
The class of the output type whose methods you are binding to output elements.


defineInputCell

void defineInputCell(Spreadsheet.Cell _cell,
                     CallFrame _callChainToCall)
                     throws CompilerException
Marks a given spreadsheet cell as a variable input to the constructed engine and binds it to the given method call chain.

Parameters:
_cell - is a spreadsheet cell whose value, rather than being assumed constant, will be defined later, when a specific engine computation is run. The cell is thus like a parameter to a Java method.
_callChainToCall - will be called during computations to obtain the value of the input cell. The type of the cell is inferred from the return type of the last method in the chain. The head of the chain must be callable on the input class of this name space.
Throws:
CompilerException
See Also:
defineOutputCell(Spreadsheet.Cell, CallFrame), Spreadsheet.getCell(int, int, int), Spreadsheet.getCell(String)

defineInputCell

void defineInputCell(Spreadsheet.Cell _cell,
                     java.lang.reflect.Method _methodToCall,
                     java.lang.Object... _args)
                     throws CompilerException
Like defineInputCell(org.formulacompiler.spreadsheet.Spreadsheet.Cell, CallFrame), but constructs the CallFrame directly.

Throws:
CompilerException
See Also:
defineInputCell(org.formulacompiler.spreadsheet.Spreadsheet.Cell, CallFrame), FormulaCompiler.newCallFrame(Method, Object...)

defineInputCell

void defineInputCell(Spreadsheet.Cell _cell,
                     java.lang.String _nameOfMethodToCall)
                     throws CompilerException,
                            java.lang.NoSuchMethodException
Like defineInputCell(org.formulacompiler.spreadsheet.Spreadsheet.Cell, CallFrame), but constructs the CallFrame directly from a method looked up by name on getInputClass().

Throws:
CompilerException
java.lang.NoSuchMethodException
See Also:
defineInputCell(org.formulacompiler.spreadsheet.Spreadsheet.Cell, CallFrame), getInputClass(), FormulaCompiler.newCallFrame(Method, Object...)

defineOutputCell

void defineOutputCell(Spreadsheet.Cell _cell,
                      CallFrame _callToImplement)
                      throws CompilerException
Marks a given spreadsheet cell as a computable output of the constructed engine and binds it to the given call. The call will be implemented by the constructed engine to compute the formula in the designated cell.

Parameters:
_cell - is a spreadsheet cell whose valuewill be computed later, when a specific engine computation is run. The cell is thus like a return value of a Java method.
_callToImplement - is what you call on a computation to obtain the actual value of the output cell in a specific computation. The type of the cell is inferred from the return type of the call. The call may not be a chain. The call must be applicable to the output class of this section. If the call is parametrized, the compiler generates internal lookup code that maps the given argument values to the given output cell. Other argument values can be bound to other cells. Unbound values will call the inherited implementation (which must not be abstract).
Throws:
CompilerException
See Also:
defineInputCell(Spreadsheet.Cell, CallFrame), Spreadsheet.getCell(int, int, int), Spreadsheet.getCell(String)

defineOutputCell

void defineOutputCell(Spreadsheet.Cell _cell,
                      java.lang.reflect.Method _methodToImplement,
                      java.lang.Object... _args)
                      throws CompilerException
Like defineOutputCell(org.formulacompiler.spreadsheet.Spreadsheet.Cell, CallFrame), but constructs the CallFrame directly.

Throws:
CompilerException
See Also:
defineOutputCell(org.formulacompiler.spreadsheet.Spreadsheet.Cell, CallFrame), FormulaCompiler.newCallFrame(Method, Object...)

defineOutputCell

void defineOutputCell(Spreadsheet.Cell _cell,
                      java.lang.String _nameOfMethodToImplement)
                      throws CompilerException,
                             java.lang.NoSuchMethodException
Like defineOutputCell(org.formulacompiler.spreadsheet.Spreadsheet.Cell, CallFrame), but constructs the CallFrame directly from a method looked up by name on getOutputClass().

Throws:
CompilerException
java.lang.NoSuchMethodException
See Also:
defineOutputCell(org.formulacompiler.spreadsheet.Spreadsheet.Cell, CallFrame), getOutputClass(), FormulaCompiler.newCallFrame(Method, Object...)

defineRepeatingSection

SpreadsheetBinder.Section defineRepeatingSection(Spreadsheet.Range _range,
                                                 Orientation _orientation,
                                                 CallFrame _inputCallChainReturningIterable,
                                                 java.lang.Class _inputClass,
                                                 CallFrame _outputCallReturningIterableToImplement,
                                                 java.lang.Class _outputClass)
                                                 throws CompilerException
Defines a range in the spreadsheet as a section of similar, repeating rows (or columns). At computation time, the section's effective height (or width) is determined by calling an iterator on your input interface.

The compiler uses the first row (or column) of the range as a template for all other rows (or columns). It does not currently check that all rows (or columns) are in fact similar in structure in the model spreadsheet. The compiler does not support auto-extending constant series, for example the series 1, 2, 3 ... n.

Parameters:
_range - is the range whose rows (or columns) should be repeated.
_orientation - indicates the orientation of the variable extent. Horizontal means repeating columns, vertical means repeating rows.
_inputCallChainReturningIterable - gets called on a computation's input to return an iterable for the elements that the repeating section should effectively have.
_inputClass - is the input type of the returned section.
_outputCallReturningIterableToImplement - is implemented on the output class to iterate the elements of the repeating section and compute output values for them. Can be null.
_outputClass - is the output type of the returned section.
Returns:
A new section for the repeated rows (or columns). The input and output interfaces are automatically inferred from the arguments above.
Throws:
CompilerException
See Also:
Spreadsheet.getRange(String)

defineRepeatingSection

SpreadsheetBinder.Section defineRepeatingSection(Spreadsheet.Range _range,
                                                 Orientation _orientation,
                                                 java.lang.reflect.Method _inputMethodReturningIterable,
                                                 java.lang.Class _inputClass,
                                                 java.lang.reflect.Method _outputMethodReturningIterableToImplement,
                                                 java.lang.Class _outputClass)
                                                 throws CompilerException
Like defineRepeatingSection(org.formulacompiler.spreadsheet.Spreadsheet.Range, Orientation, CallFrame, Class, CallFrame, Class), but constructs the CallFrame instances directly.

Throws:
CompilerException

defineRepeatingSection

SpreadsheetBinder.Section defineRepeatingSection(Spreadsheet.Range _range,
                                                 Orientation _orientation,
                                                 java.lang.String _nameOfInputMethodReturningIterable,
                                                 java.lang.Class _inputClass,
                                                 java.lang.String _nameOfOutputMethodReturningIterableToImplement,
                                                 java.lang.Class _outputClass)
                                                 throws CompilerException,
                                                        java.lang.NoSuchMethodException
Like defineRepeatingSection(org.formulacompiler.spreadsheet.Spreadsheet.Range, Orientation, CallFrame, Class, CallFrame, Class), but constructs the CallFrame instances directly.

Throws:
CompilerException
java.lang.NoSuchMethodException