public class UniversalActionType extends java.lang.Object implements ActionType
ActionType implementation for unparameterized actions (or at least a single action
whose parameters are full specified at construction time of this ActionType) that have no preconditions (can be executed anywhere).
The UniversalActionType(String) constructor will cause this type to return SimpleAction instances whose name
match the provided type name for this object. The other constructors allow you to have this ActionType return a different
instance of Action.
Will generate a single SimpleAction whose action name is the same as the type for name for this ActionType.| Modifier and Type | Field and Description |
|---|---|
Action |
action
The
Action object that will be returned. |
protected java.util.List<Action> |
allActions
The list single element list of the
Action to be returned by the allApplicableActions(State)
method. |
java.lang.String |
typeName
The type name of this
ActionType |
| Constructor and Description |
|---|
UniversalActionType(Action action)
Initializes to return the given action.
|
UniversalActionType(java.lang.String typeName)
Initializes with the type name and sets to return a
SimpleAction whose action name is the same as the
type name. |
UniversalActionType(java.lang.String typeName,
Action action)
Initializes.
|
| Modifier and Type | Method and Description |
|---|---|
java.util.List<Action> |
allApplicableActions(State s)
Returns all possible actions of this type that can be applied in the provided
State. |
Action |
associatedAction(java.lang.String strRep)
Returns an
Action whose parameters are specified by the given String representation (if
the ActionType manages multiple parameterizations) |
java.lang.String |
typeName()
The unique name of this
ActionType |
public java.lang.String typeName
ActionTypeprotected java.util.List<Action> allActions
Action to be returned by the allApplicableActions(State)
method.public UniversalActionType(java.lang.String typeName)
SimpleAction whose action name is the same as the
type name.typeName - The type name for this ActionTypepublic UniversalActionType(Action action)
Action.actionName()
for the input actionaction - the input action to returnpublic UniversalActionType(java.lang.String typeName,
Action action)
typeName - the type name of this action typeaction - the action to returnpublic java.lang.String typeName()
ActionTypeActionTypetypeName in interface ActionTypeString name of this ActionTypepublic Action associatedAction(java.lang.String strRep)
ActionTypeAction whose parameters are specified by the given String representation (if
the ActionType manages multiple parameterizations)associatedAction in interface ActionTypestrRep - the String representation of the Action parameters, if any, or null if there are no parameters.Actionpublic java.util.List<Action> allApplicableActions(State s)
ActionTypeState.allApplicableActions in interface ActionTypes - the State in which all applicable actions of this ActionType object should be returned.Actions of this ActionType object in in the given State