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
ActionType
protected 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 ActionType
public 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()
ActionType
ActionType
typeName
in interface ActionType
String
name of this ActionType
public Action associatedAction(java.lang.String strRep)
ActionType
Action
whose parameters are specified by the given String
representation (if
the ActionType
manages multiple parameterizations)associatedAction
in interface ActionType
strRep
- the String
representation of the Action
parameters, if any, or null if there are no parameters.Action
public java.util.List<Action> allApplicableActions(State s)
ActionType
State
.allApplicableActions
in interface ActionType
s
- the State
in which all applicable actions of this ActionType
object should be returned.Action
s of this ActionType
object in in the given State