|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ai.planning.propositional.Action
public class Action
An Action is an activity that may be executable by some agent. Every Action must be an instance of some ActionType. In propositional planning the only distinction between an Action and the ActionType it instantiates is the unique label that may be given to an Action. This can be used to distinguish multiple occurrences of Actions of the same ActionType in a plan, for example.
Field Summary | |
---|---|
protected ai.krr.NamedSymbol |
label
the unique label for this Action or null |
protected ActionType |
type
the ActionType which this Action instantiates |
Constructor Summary | |
---|---|
Action(ActionType type)
This constructor creates a new Action of the given type. |
Method Summary | |
---|---|
WorldState |
applyIn(WorldState<ai.krr.propositions.Atom> state)
This function computes a new WorldState that is the result of applying this Action in the given state. |
protected Action |
clone()
This class does not support cloning and an Exception will be thrown if this method is called. |
boolean |
equals(java.lang.Object obj)
This function compares this Action to the given Object which must be an Action. |
ActionType |
getActionType()
This function returns the ActionType of this Action. |
ai.krr.NamedSymbol |
getLabel()
This function returns the unique label that distinguishes this Action from other Actions of the same ActionType. |
int |
hashCode()
This function returns a hash value for this action. |
boolean |
isApplicableIn(WorldState<ai.krr.propositions.Atom> state)
This function tests whether this Action is applicable in the given state. |
void |
setLabel(ai.krr.NamedSymbol label)
This function sets the unique label for this Action. |
java.lang.String |
toString()
This function creates a String representation for this ActionType. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected ai.krr.NamedSymbol label
protected final ActionType type
Constructor Detail |
---|
public Action(ActionType type)
This constructor creates a new Action of the given type. The Action is not given a unique label at this point.
type
- the ActionType which this Action instantiatesMethod Detail |
---|
protected Action clone() throws java.lang.CloneNotSupportedException
This class does not support cloning and an Exception will be thrown if this method is called.
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
- will be thrownpublic final ActionType getActionType()
This function returns the ActionType of this Action.
getActionType
in interface Action<ai.krr.propositions.Atom>
public boolean isApplicableIn(WorldState<ai.krr.propositions.Atom> state)
This function tests whether this Action is applicable in the given state. It returns true iff all the Action's preconditions are satisfied in the given WolrdState.
isApplicableIn
in interface Action<ai.krr.propositions.Atom>
state
- the WorldState in which applicability is to be tested
public WorldState applyIn(WorldState<ai.krr.propositions.Atom> state)
This function computes a new WorldState that is the result of applying this Action in the given state. The Action should be applicable or the result of this function may not be as expected. If assertions are switched on, applicability will be tested. The resulting WorldState is computed by first removing all the negative effects of the given Action from this state and then adding all the positive effects.
applyIn
in interface Action<ai.krr.propositions.Atom>
state
- the WorldState in which this Action to be applied
public void setLabel(ai.krr.NamedSymbol label)
This function sets the unique label for this Action. Note that no test for uniqueness is performed here. Once a label has been assigned to an Action it should not be changed.
label
- the label to be assigned to this Actionpublic ai.krr.NamedSymbol getLabel()
This function returns the unique label that distinguishes this Action from other Actions of the same ActionType.
public boolean equals(java.lang.Object obj)
This function compares this Action to the given Object which must be an Action. If either of the Actions has a label assigned, equality of the Actions is determined by the identity of the labels. Otherwise two Actions are equal iff they are the same Object in memory (using the == test). Note that two Actions that have the same label should also have the same ActionType.
equals
in class java.lang.Object
obj
- the Action to which this is compared
public int hashCode()
This function returns a hash value for this action. If a label has been assigned to this Action the hash code of the label is returned. Otherwise the Object-level hashCode() is used.
hashCode
in class java.lang.Object
public java.lang.String toString()
This function creates a String representation for this ActionType.
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |