org.jactr.core.production.action
Interface IAction
- All Known Subinterfaces:
- IBufferAction
- All Known Implementing Classes:
- AddAction, BindAction, DefaultAction, ExecuteAction, ModifyAction, OutputAction, ProxyAction, RemoveAction, ScriptableAction, SleepAction, StopAction
public interface IAction
The action interface provides three methods that all actions must specify.
The action is used by the IProduction when all its conditions can be matched
and the production is actually selected to fire.
- Author:
- harrison
|
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()
Dispose is called to explicitly release resources when we are done with the
IAction. |
double |
fire(IInstantiation instantiation,
double firingTime)
One the IInstantiation is fully bound and has been selected for firing, all
of its Actions? fire methods are called. |
bind
IAction bind(java.util.Map<java.lang.String,java.lang.Object> variableBindings)
throws CannotInstantiateException
- 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
- Parameters:
variableBindings -
- Returns:
-
- Throws:
CannotInstantiateException
fire
double fire(IInstantiation instantiation,
double firingTime)
- One the IInstantiation is fully bound and has been selected for firing, all
of its Actions? fire methods are called. In simulated time, all the Actions
are fired in parallel. However, in real time they are fired in the order of
their definition. IModel is the current model, IProduction is the firing
production (IInstantiation, actually), bindings contains the current
bindings to that point (since the IAction might create additional bindings
for subsequent ones). The method returns the simulated firing time of the
action. This is not currently used as the IProduction itself overrides the
firing time. It is in place now as a place keeper for the future when we
get to the point where we can empirically derive firing times for
individual actions.
- Parameters:
firingTime - when this production was fired
dispose
void dispose()
- Dispose is called to explicitly release resources when we are done with the
IAction. Why not rely upon the finalization mechanism and garbage
collection? Many of the classes contain circular linkages: parent to child
and child to parent. Since the garbage collection contract is not
standardized, circular links might prevent objects from being collected.
This method should never be called by the programmer. It is called by the
containing IProduction, which in turn has its dispose method called by the
IModel. You should only call IModel.dispose() when you are done with the
model.