public class Conditional extends AbstractAction
Condition
/Action
pairs. When executed, these pairs are searched (in order) for the first one in which both the Condition
and the Action
's Action.isEnabled()
method is satisfied, and executes that Action
.Constructor and Description |
---|
Conditional(Pair<Condition,Action>... thePairs)
Defers to
Conditional(String, Pair...) with the first parameter "Conditional". |
Conditional(String theName,
Pair<Condition,Action>... thePairs) |
Modifier and Type | Method and Description |
---|---|
protected Status |
run(Object... theParameters)
Finds the first pair in which the Condition is satisfied AND the preconditions of the Action
are satisfied, and calls
AbstractAction.execute(Object...) on that Action with this method's parameters,
returning the result. |
addPostCondition, addPostConditions, addPreCondition, addPreConditions, clearPostConditions, clearPreConditions, compareTo, equals, execute, getName, getPostConditions, getPreConditions, isEnabled, removePostCondition, removePreCondition
public Conditional(Pair<Condition,Action>... thePairs)
Conditional(String, Pair...)
with the first parameter "Conditional".thePairs
- The Condition/action pairs for each of the clauses.public Conditional(String theName, Pair<Condition,Action>... thePairs)
theName
- The name of this Action.thePairs
- The pairs as described in AbstractAction
.AbstractAction}
protected Status run(Object... theParameters) throws IllegalOperationException
AbstractAction.execute(Object...)
on that Action with this method's parameters,
returning the result. If none of the pairs can be
executed, a 0-status is returned.run
in class AbstractAction
theParameters
- Any parameters required by the specific override of this method.Status
object, according the the specific override of this method.IllegalOperationException