org.shapelogic.scripting
Class FunctionCalcInvoke<E>

java.lang.Object
  extended by org.shapelogic.scripting.BaseScriptingFunction
      extended by org.shapelogic.scripting.FunctionCalc0<E>
          extended by org.shapelogic.scripting.FunctionCalcInvoke<E>
All Implemented Interfaces:
Calc0<E>, CalcInvoke<E>, CalcValue<E>, LazyCalc<E>

public class FunctionCalcInvoke<E>
extends FunctionCalc0<E>
implements CalcInvoke<E>

FunctionCalcInvoke based on an expression in a Scripting language using JSR 223.
Requires Groovy to be installed. Need special installation of groovy-engine.jar that need to be downloade from Sun.
Requires that the scripting language support the invocable interface.

Author:
Sami Badawi

Field Summary
protected  boolean _dirty
           
protected  E _value
           
 
Fields inherited from class org.shapelogic.scripting.BaseScriptingFunction
_expression, _functionName, _language, _scriptEngine, DEFAULT_LANGUAGE
 
Constructor Summary
FunctionCalcInvoke(java.lang.String functionName, java.lang.String expression)
           
FunctionCalcInvoke(java.lang.String functionName, java.lang.String expression, java.lang.String language)
           
 
Method Summary
 E getValue()
          Starts a lazy calculation.
 boolean isDirty()
          When dirty is false that means that the calculated value can be used
 void setup()
          Currently not super well define used for 2 purposes: Reset: called from the outside if you want to reuse it init: Called from the inside when calculation start to have everything setup maybe the semantic could work for both? TODO: This should be separated better.
 
Methods inherited from class org.shapelogic.scripting.FunctionCalc0
invoke
 
Methods inherited from class org.shapelogic.scripting.BaseScriptingFunction
getScriptEngine, put
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.shapelogic.calculation.Calc0
invoke
 

Field Detail

_dirty

protected boolean _dirty

_value

protected E _value
Constructor Detail

FunctionCalcInvoke

public FunctionCalcInvoke(java.lang.String functionName,
                          java.lang.String expression,
                          java.lang.String language)

FunctionCalcInvoke

public FunctionCalcInvoke(java.lang.String functionName,
                          java.lang.String expression)
Method Detail

isDirty

public boolean isDirty()
Description copied from interface: LazyCalc
When dirty is false that means that the calculated value can be used

Specified by:
isDirty in interface LazyCalc<E>

setup

public void setup()
Description copied from interface: LazyCalc
Currently not super well define used for 2 purposes: Reset: called from the outside if you want to reuse it init: Called from the inside when calculation start to have everything setup maybe the semantic could work for both? TODO: This should be separated better.

Specified by:
setup in interface LazyCalc<E>

getValue

public E getValue()
Description copied from interface: CalcValue
Starts a lazy calculation. If dirty do calc() else return cached value. This should maybe be moved up in the hierarchy

Specified by:
getValue in interface CalcValue<E>


Copyright © 2009. All Rights Reserved.