org.jactr.scripting.action
Class ScriptableAction

java.lang.Object
  extended by org.jactr.core.production.action.DefaultAction
      extended by org.jactr.scripting.action.ScriptableAction
All Implemented Interfaces:
IAction

public class ScriptableAction
extends DefaultAction

ScriptableAction allows for custom actions. You set the script via setScript(String ) - it must contain a function fire(model, production, bindings) { }

Author:
harrison

Field Summary
static java.lang.String DEFAULT_SCRIPT
          Description of the Field
 
Constructor Summary
ScriptableAction()
          Constructor for the ScriptableAction object
ScriptableAction(java.lang.String script)
          Constructor for the ScriptableAction object
 
Method Summary
 IAction bind(java.util.Map<java.lang.String,java.lang.Object> variableBindings)
          Bind is called during the creation of an instantiation of a produciton.
 void dispose()
          Description of the Method
 double fire(IInstantiation instantiation, double firingTime)
          Description of the Method
 java.lang.String getScript()
          Gets the script attribute of the ScriptableAction object
 void setScriptString(java.lang.String str)
          Sets the script attribute of the ScriptableAction object
 
Methods inherited from class org.jactr.core.production.action.DefaultAction
resolve
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SCRIPT

public static final java.lang.String DEFAULT_SCRIPT
Description of the Field

See Also:
Constant Field Values
Constructor Detail

ScriptableAction

public ScriptableAction()
Constructor for the ScriptableAction object


ScriptableAction

public ScriptableAction(java.lang.String script)
Constructor for the ScriptableAction object

Parameters:
script - Description of the Parameter
Method Detail

dispose

public void dispose()
Description of the Method

Specified by:
dispose in interface IAction
Overrides:
dispose in class DefaultAction

bind

public IAction bind(java.util.Map<java.lang.String,java.lang.Object> variableBindings)
Description copied from interface: IAction
Bind is called during the creation of an instantiation of a produciton. By the time this gets called, we know that all the conditions are matched and all the variables have been assigned. This method merely creates a copy of this action and applies those bindings. the IAction returned by this method will be the actual one that is fired. Normally, an action should not change the contents of variableBindings

Returns:

getScript

public java.lang.String getScript()
Gets the script attribute of the ScriptableAction object

Returns:
The script value

setScriptString

public void setScriptString(java.lang.String str)
Sets the script attribute of the ScriptableAction object

Parameters:
str - The new script value

fire

public double fire(IInstantiation instantiation,
                   double firingTime)
Description of the Method

Specified by:
fire in interface IAction
Specified by:
fire in class DefaultAction
Parameters:
instantiation - Description of the Parameter
bindings - Description of the Parameter
Returns:
Description of the Return Value