public class State
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.util.List<ObjectInstance> |
hiddenObjectInstances
List of hidden object instances that facilitate domain dynamics and infer observable values
|
protected java.util.Map<java.lang.String,java.util.List<ObjectInstance>> |
objectIndexByTrueClass
Map of object instances organized by class name
|
protected java.util.List<ObjectInstance> |
objectInstances
List of observable object instances that define the state
|
protected java.util.Map<java.lang.String,ObjectInstance> |
objectMap
Map from object names to their instances
|
Constructor and Description |
---|
State() |
State(State s)
Initializes this state as a deep copy of the object instances in the provided source state s
|
Modifier and Type | Method and Description |
---|---|
void |
addObject(ObjectInstance o)
Adds object instance o to this state.
|
State |
copy()
Returns a deep copy of this state.
|
boolean |
equals(java.lang.Object other) |
java.util.List<GroundedAction> |
getAllGroundedActionsFor(Action a)
Deprecated.
|
java.util.List<GroundedAction> |
getAllGroundedActionsFor(java.util.List<Action> actions)
Deprecated.
|
java.util.List<GroundedProp> |
getAllGroundedPropsFor(PropositionalFunction pf)
Deprecated.
|
java.util.List<ObjectInstance> |
getAllObjects()
Returns the list of observable and hidden object instances in this state.
|
java.util.List<java.util.List<ObjectInstance>> |
getAllObjectsByTrueClass()
Returns a list of list of object instances, grouped by object class
|
java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
getAllUnsetAttributes()
Returns a mapping from object instance names to the list of attributes names that have unset values.
|
java.lang.String |
getCompleteStateDescription()
Returns a string representation of this state using observable and hidden object instances.
|
java.lang.String |
getCompleteStateDescriptionWithUnsetAttributesAsNull()
Returns a string description of the state with unset attribute values listed as null.
|
ObjectInstance |
getFirstObjectOfClass(java.lang.String oclass)
Returns the first indexed object of the object class named oclass
|
ObjectInstance |
getHiddenObjectAt(int i)
Returns the hidden object instance indexed at position i
|
java.util.List<ObjectInstance> |
getHiddenObjects()
Returns the list of hidden object instances in this state.
|
ObjectInstance |
getObject(java.lang.String oname)
Returns the object in this state with the name oname
|
java.util.Set<java.lang.String> |
getObjectClassesPresent()
Returns a set of of the object class names for all object classes that have instantiated objects in this state.
|
java.util.Map<java.lang.String,java.lang.String> |
getObjectMatchingTo(State so,
boolean enforceStateExactness)
This method computes a matching from objects in the receiver to value-identical objects in the parameter state so.
|
java.util.List<ObjectInstance> |
getObjectsOfClass(java.lang.String oclass)
Returns all objects that belong to the object class named oclass
|
java.util.List<ObjectInstance> |
getObjectsOfTrueClass(java.lang.String oclass)
Deprecated.
|
ObjectInstance |
getObservableObjectAt(int i)
Returns the observable object instance indexed at position i
|
java.util.List<ObjectInstance> |
getObservableObjects()
Returns the list of observable object instances in this state.
|
java.util.List<java.util.List<java.lang.String>> |
getPossibleBindingsGivenParamOrderGroups(java.lang.String[] paramClasses,
java.lang.String[] paramOrderGroups)
Given an array of parameter object classes and an array of their corresponding parameter order groups,
returns all possible object instance bindings to the parameters, excluding bindings that are equivalent due
to the parameter order grouping.
|
java.lang.String |
getStateDescription()
Returns a string representation of this state using only observable object instances.
|
protected void |
initDataStructures() |
int |
numHiddenObjects()
Returns the number of hidden object instances in this state.
|
int |
numObservableObjects()
Returns the number of observable object instances in this state.
|
int |
numTotalObjets()
Returns the number of observable and hidden object instances in this state.
|
void |
removeObject(ObjectInstance o)
Removes the object instance o from this state.
|
void |
removeObject(java.lang.String oname)
Removes the object instance with the name oname from this state.
|
void |
renameObject(ObjectInstance o,
java.lang.String newName)
Renames the identifier for object instance o in this state to newName.
|
void |
renameObject(java.lang.String originalName,
java.lang.String newName)
Renames the identifier for the object instance currently named originalName with the name newName.
|
State |
semiDeepCopy(ObjectInstance... deepCopyObjects)
Performs a semi-deep copy of the state in which only the objects in deepCopyObjects are deep copied and the rest of the
objects are shallowed copied.
|
State |
semiDeepCopy(java.util.Set<ObjectInstance> deepCopyObjects)
Performs a semi-deep copy of the state in which only the objects in deepCopyObjects are deep copied and the rest of the
objects are shallowed copied.
|
State |
semiDeepCopy(java.lang.String... deepCopyObjectNames)
Performs a semi-deep copy of the state in which only the objects with the names in deepCopyObjectNames are deep copied and the rest of the
objects are shallowed copied.
|
boolean |
somePFGroundingIsTrue(PropositionalFunction pf)
Deprecated.
|
java.lang.String |
toString() |
protected java.util.List<ObjectInstance> objectInstances
protected java.util.List<ObjectInstance> hiddenObjectInstances
protected java.util.Map<java.lang.String,ObjectInstance> objectMap
protected java.util.Map<java.lang.String,java.util.List<ObjectInstance>> objectIndexByTrueClass
public State()
public State(State s)
s
- the source state from which this state will be initialized.public State copy()
public State semiDeepCopy(java.lang.String... deepCopyObjectNames)
deepCopyObjectNames
- the names of the objects to be deep copied.public State semiDeepCopy(ObjectInstance... deepCopyObjects)
deepCopyObjects
- the objects to be deep copiedpublic State semiDeepCopy(java.util.Set<ObjectInstance> deepCopyObjects)
deepCopyObjects
- the objects to be deep copiedprotected void initDataStructures()
public void addObject(ObjectInstance o)
o
- the object instance to be added to this state.public void removeObject(java.lang.String oname)
oname
- the name of the object instance to remove.public void removeObject(ObjectInstance o)
o
- the object instance to remove from this state.public void renameObject(java.lang.String originalName, java.lang.String newName)
originalName
- the original name of the object instance to be renamed in this statenewName
- the new name of the object instancepublic void renameObject(ObjectInstance o, java.lang.String newName)
o
- the object instance to rename in this statenewName
- the new name of the object instancepublic java.util.Map<java.lang.String,java.lang.String> getObjectMatchingTo(State so, boolean enforceStateExactness)
so
- the state to whose objects the receiving state's objects should be matchedenforceStateExactness
- whether to require that states are identical to return a matchingpublic boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int numTotalObjets()
public int numObservableObjects()
public int numHiddenObjects()
public ObjectInstance getObject(java.lang.String oname)
oname
- the name of the object instance to returnpublic ObjectInstance getObservableObjectAt(int i)
i
- the index of the observable object instance to returnpublic ObjectInstance getHiddenObjectAt(int i)
i
- the index of the hidden object instance to returnpublic java.util.List<ObjectInstance> getObservableObjects()
public java.util.List<ObjectInstance> getHiddenObjects()
public java.util.List<ObjectInstance> getAllObjects()
@Deprecated public java.util.List<ObjectInstance> getObjectsOfTrueClass(java.lang.String oclass)
getObjectsOfClass(String)
.public java.util.List<ObjectInstance> getObjectsOfClass(java.lang.String oclass)
oclass
- the name of the object class for which objects should be returnedpublic ObjectInstance getFirstObjectOfClass(java.lang.String oclass)
oclass
- the name of the object class for which the first indexed object should be returned.public java.util.Set<java.lang.String> getObjectClassesPresent()
public java.util.List<java.util.List<ObjectInstance>> getAllObjectsByTrueClass()
public java.lang.String getStateDescription()
public java.util.Map<java.lang.String,java.util.List<java.lang.String>> getAllUnsetAttributes()
public java.lang.String getCompleteStateDescription()
public java.lang.String getCompleteStateDescriptionWithUnsetAttributesAsNull()
@Deprecated public java.util.List<GroundedAction> getAllGroundedActionsFor(Action a)
Action
class' Action.getAllApplicableGroundedActions(State)
method instead.
Returns all GroundedAction objects for the source action a in this state.a
- the action from which to generate GroundedAction objects.@Deprecated public java.util.List<GroundedAction> getAllGroundedActionsFor(java.util.List<Action> actions)
Action
class' Action.getAllApplicableGroundedActionsFromActionList(List, State)
method instead.
Returns a list of GroundedAction objects for all grounded actions that can be generated from the provided list of actions.actions
- the list of actions from which to generate GroudnedAction objects.@Deprecated public java.util.List<GroundedProp> getAllGroundedPropsFor(PropositionalFunction pf)
PropositionalFunction
class' PropositionalFunction.getAllGroundedPropsForState(State)
method instead.
Returns all GroundedProp objects for the source propositional function pf in this state.pf
- the propositional function from which to generate GroundedProp objects.@Deprecated public boolean somePFGroundingIsTrue(PropositionalFunction pf)
PropositionalFunction
class' PropositionalFunction.somePFGroundingIsTrue(State)
method instead.
Returns whether some GroundedProp of pf is true in this statepf
- the propositional function to checkpublic java.util.List<java.util.List<java.lang.String>> getPossibleBindingsGivenParamOrderGroups(java.lang.String[] paramClasses, java.lang.String[] paramOrderGroups)
paramClasses
- the name of object classes to which the bound object instances must belongparamOrderGroups
- the parameter order group names.public java.lang.String toString()
toString
in class java.lang.Object