anl.aida.formula
Class DefaultFormula

java.lang.Object
  extended by anl.aida.formula.DefaultFormula
All Implemented Interfaces:
Formula

public class DefaultFormula
extends java.lang.Object
implements Formula

Formula implementation that produces data suitable for a tile plot. That is, the data will include every value for each x,y cell in the domain.

Version:
$Revision$ $Date$

Nested Class Summary
(package private)  class DefaultFormula.VarFramePair
           
 
Field Summary
private  javax.measure.unit.Unit<?> commonUnit
           
private  FormulaParser parser
           
private  DataTransformer transformer
           
private  ASTTreeInfo treeInfo
           
private  java.util.List<FormulaVariable> variables
           
 
Constructor Summary
DefaultFormula(FormulaParser parser, DataTransformer transformer, javax.measure.unit.Unit<?> commonUnit)
           
 
Method Summary
private  void createFormulaVars(DataManager manager)
           
private  Variable createVariable()
           
 DataFrame evaluate(DataManager manager, java.util.List<AxisRange> ranges)
          Evaluates the formula to produce a DataFrame.
private  ucar.ma2.Array evaluateFormula(java.util.List<DefaultFormula.VarFramePair> results)
           
 java.lang.String getFormulaAsString()
          Gets the String representation of the formula.
private  java.util.List<DefaultFormula.VarFramePair> readData(java.util.List<AxisRange> ranges)
           
private  java.util.List<DefaultFormula.VarFramePair> transformData(java.util.List<DefaultFormula.VarFramePair> data)
           
 ValidationResult validate(DataManager manager, java.util.List<AxisRange> ranges)
          Validates the formula.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

treeInfo

private ASTTreeInfo treeInfo

parser

private FormulaParser parser

transformer

private DataTransformer transformer

commonUnit

private javax.measure.unit.Unit<?> commonUnit

variables

private java.util.List<FormulaVariable> variables
Constructor Detail

DefaultFormula

public DefaultFormula(FormulaParser parser,
                      DataTransformer transformer,
                      javax.measure.unit.Unit<?> commonUnit)
Method Detail

getFormulaAsString

public java.lang.String getFormulaAsString()
Description copied from interface: Formula
Gets the String representation of the formula.

Specified by:
getFormulaAsString in interface Formula
Returns:
the String representation of the formula.

transformData

private java.util.List<DefaultFormula.VarFramePair> transformData(java.util.List<DefaultFormula.VarFramePair> data)

createFormulaVars

private void createFormulaVars(DataManager manager)
                        throws IllegalFormulaException
Throws:
IllegalFormulaException

readData

private java.util.List<DefaultFormula.VarFramePair> readData(java.util.List<AxisRange> ranges)
                                                      throws IllegalFormulaException
Throws:
IllegalFormulaException

validate

public ValidationResult validate(DataManager manager,
                                 java.util.List<AxisRange> ranges)
Validates the formula. This checks that the units, layers domains and timestep are coherent and within range.

Specified by:
validate in interface Formula
Parameters:
manager - the data manager used to validate the formula
ranges - the ranges that will filter or constrain the evaluation.
Returns:
a ValidationResult containing the results of the validation.

evaluate

public DataFrame evaluate(DataManager manager,
                          java.util.List<AxisRange> ranges)
                   throws IllegalFormulaException
Description copied from interface: Formula
Evaluates the formula to produce a DataFrame.

Specified by:
evaluate in interface Formula
Parameters:
manager - the DataManager used to help evaluate the formula
ranges - the ranges that constrain the evaluation
Throws:
IllegalFormulaException - if the formula is unable to be executed.

evaluateFormula

private ucar.ma2.Array evaluateFormula(java.util.List<DefaultFormula.VarFramePair> results)
                                throws IllegalFormulaException
Throws:
IllegalFormulaException

createVariable

private Variable createVariable()