public class MutableState extends OOMDPState implements State
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<java.lang.String,java.util.List<ObjectInstance>> |
objectIndexByClass
Map of object instances organized by class name
|
protected java.util.List<ObjectInstance> |
objectInstances
List of 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 |
---|
MutableState() |
MutableState(MutableState s)
Initializes this state as a deep copy of the object instances in the provided source state s
|
Modifier and Type | Method and Description |
---|---|
State |
addAllObjects(java.util.Collection<ObjectInstance> objects)
Adds the collection of objects to the state
|
State |
addObject(ObjectInstance o)
Adds object instance o to this state.
|
MutableState |
copy()
Returns a deep copy of this state.
|
boolean |
equals(java.lang.Object other) |
java.util.List<ObjectInstance> |
getAllObjects()
Returns the list of observable and hidden object instances in this state.
|
java.util.List<java.util.List<ObjectInstance>> |
getAllObjectsByClass()
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 |
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<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.
|
protected void |
initDataStructures() |
int |
numTotalObjects()
Returns the number of object instances in this state.
|
State |
removeAllObjects(java.util.Collection<ObjectInstance> objects)
Removes the collection of objects from the state
|
State |
removeObject(ObjectInstance o)
Removes the object instance o from this state.
|
State |
removeObject(java.lang.String oname)
Removes the object instance with the name oname from this state.
|
State |
renameObject(ObjectInstance o,
java.lang.String newName)
Renames the identifier for object instance o in this state to newName.
|
MutableState |
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.
|
MutableState |
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.
|
MutableState |
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.
|
java.lang.String |
toString() |
renameObject, setObjectsValue
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
renameObject, setObjectsValue
protected java.util.List<ObjectInstance> objectInstances
protected java.util.Map<java.lang.String,ObjectInstance> objectMap
protected java.util.Map<java.lang.String,java.util.List<ObjectInstance>> objectIndexByClass
public MutableState()
public MutableState(MutableState s)
s
- the source state from which this state will be initialized.public MutableState copy()
public MutableState semiDeepCopy(java.lang.String... deepCopyObjectNames)
deepCopyObjectNames
- the names of the objects to be deep copied.public MutableState semiDeepCopy(ObjectInstance... deepCopyObjects)
deepCopyObjects
- the objects to be deep copiedpublic MutableState semiDeepCopy(java.util.Set<ObjectInstance> deepCopyObjects)
deepCopyObjects
- the objects to be deep copiedprotected void initDataStructures()
public State addObject(ObjectInstance o)
public State addAllObjects(java.util.Collection<ObjectInstance> objects)
State
addAllObjects
in interface State
public State removeObject(java.lang.String oname)
removeObject
in interface State
oname
- the name of the object instance to remove.public State removeObject(ObjectInstance o)
removeObject
in interface State
o
- the object instance to remove from this state.public State removeAllObjects(java.util.Collection<ObjectInstance> objects)
State
removeAllObjects
in interface State
public State renameObject(ObjectInstance o, java.lang.String newName)
renameObject
in interface State
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)
getObjectMatchingTo
in interface State
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 numTotalObjects()
numTotalObjects
in interface State
public ObjectInstance getObject(java.lang.String oname)
public java.util.List<ObjectInstance> getAllObjects()
getAllObjects
in interface State
public java.util.List<ObjectInstance> getObjectsOfClass(java.lang.String oclass)
getObjectsOfClass
in interface State
oclass
- the name of the object class for which objects should be returnedpublic ObjectInstance getFirstObjectOfClass(java.lang.String oclass)
getFirstObjectOfClass
in interface State
oclass
- the name of the object class for which the first indexed object should be returned.public java.util.Set<java.lang.String> getObjectClassesPresent()
getObjectClassesPresent
in interface State
public java.util.List<java.util.List<ObjectInstance>> getAllObjectsByClass()
getAllObjectsByClass
in interface State
public java.util.Map<java.lang.String,java.util.List<java.lang.String>> getAllUnsetAttributes()
getAllUnsetAttributes
in interface State
public java.lang.String getCompleteStateDescription()
getCompleteStateDescription
in interface State
public java.lang.String getCompleteStateDescriptionWithUnsetAttributesAsNull()
getCompleteStateDescriptionWithUnsetAttributesAsNull
in interface State
public java.util.List<java.util.List<java.lang.String>> getPossibleBindingsGivenParamOrderGroups(java.lang.String[] paramClasses, java.lang.String[] paramOrderGroups)
getPossibleBindingsGivenParamOrderGroups
in interface State
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 OOMDPState