public final class ImmutableState extends OOMDPState implements ImmutableStateInterface
| Constructor and Description |
|---|
ImmutableState() |
ImmutableState(com.google.common.collect.ImmutableList<ImmutableObjectInstance> objects,
gnu.trove.map.hash.TObjectIntHashMap<java.lang.String> objectClassMap,
com.google.common.collect.ImmutableList<gnu.trove.list.array.TIntArrayList> objectIndexByTrueClass,
gnu.trove.map.hash.TObjectIntHashMap<java.lang.String> objectMap,
int hashCode) |
ImmutableState(java.util.List<ImmutableObjectInstance> objects,
gnu.trove.map.hash.TObjectIntHashMap<java.lang.String> objectClassMap) |
ImmutableState(State s)
Constructs an immutable copy from any state object.
|
| Modifier and Type | Method and Description |
|---|---|
ImmutableState |
addAllObjects(java.util.Collection<ObjectInstance> objectsToAdd)
Adds the collection of objects to the state
|
ImmutableState |
addObject(ObjectInstance object)
Adds object instance o to this state.
|
ImmutableState |
copy()
This method doesn't actually copy.
|
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
|
com.google.common.collect.ImmutableList<ImmutableObjectInstance> |
getImmutableObjects() |
ObjectInstance |
getObject(int i) |
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> |
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.util.List<java.util.List<ObjectInstance>> |
getPossibleObjectBindingsGivenParamOrderGroups(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.
|
int |
hashCode() |
boolean |
isHashed() |
java.util.Iterator<ImmutableObjectInstance> |
iterator() |
int |
numObservableObjects()
Returns the number of observable object instances in this state.
|
int |
numTotalObjects()
Returns the number of observable and hidden object instances in this state.
|
ImmutableState |
removeAllObjects(java.util.Collection<ObjectInstance> objectsToRemove)
Removes the collection of objects from the state
|
ImmutableState |
removeObject(ObjectInstance object)
Removes the object instance o from this state.
|
ImmutableState |
removeObject(java.lang.String objectName)
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.
|
ImmutableState |
replaceAllObjects(java.util.List<ImmutableObjectInstance> objectsToRemove,
java.util.List<ImmutableObjectInstance> objectsToAdd) |
ImmutableState |
replaceAllObjectsUnsafe(java.util.List<ObjectInstance> objectsToAdd) |
ImmutableState |
replaceAndHash(com.google.common.collect.ImmutableList<ImmutableObjectInstance> objects,
int code) |
ImmutableState |
replaceObject(ObjectInstance objectToReplace,
ObjectInstance newObject) |
<T> State |
setObjectsValue(java.lang.String objectName,
java.lang.String attName,
T value)
Sets an object's value.
|
renameObject, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitrenameObjectpublic ImmutableState()
public ImmutableState(State s)
s - the source state from which this state will be initialized.public ImmutableState(java.util.List<ImmutableObjectInstance> objects, gnu.trove.map.hash.TObjectIntHashMap<java.lang.String> objectClassMap)
public ImmutableState(com.google.common.collect.ImmutableList<ImmutableObjectInstance> objects, gnu.trove.map.hash.TObjectIntHashMap<java.lang.String> objectClassMap, com.google.common.collect.ImmutableList<gnu.trove.list.array.TIntArrayList> objectIndexByTrueClass, gnu.trove.map.hash.TObjectIntHashMap<java.lang.String> objectMap, int hashCode)
public ImmutableState copy()
public final ImmutableState replaceAndHash(com.google.common.collect.ImmutableList<ImmutableObjectInstance> objects, int code)
replaceAndHash in interface ImmutableStateInterfacepublic final ImmutableState addObject(ObjectInstance object)
Statepublic final ImmutableState addAllObjects(java.util.Collection<ObjectInstance> objectsToAdd)
StateaddAllObjects in interface Statepublic final ImmutableState removeObject(java.lang.String objectName)
StateremoveObject in interface StateobjectName - the name of the object instance to remove.public final ImmutableState removeObject(ObjectInstance object)
StateremoveObject in interface Stateobject - the object instance to remove from this state.public final ImmutableState removeAllObjects(java.util.Collection<ObjectInstance> objectsToRemove)
StateremoveAllObjects in interface Statepublic final ImmutableState replaceObject(ObjectInstance objectToReplace, ObjectInstance newObject)
replaceObject in interface ImmutableStateInterfacepublic final ImmutableState replaceAllObjects(java.util.List<ImmutableObjectInstance> objectsToRemove, java.util.List<ImmutableObjectInstance> objectsToAdd)
replaceAllObjects in interface ImmutableStateInterfacepublic final ImmutableState replaceAllObjectsUnsafe(java.util.List<ObjectInstance> objectsToAdd)
public State renameObject(ObjectInstance o, java.lang.String newName)
renameObject in interface Stateo - the object instance to rename in this statenewName - the new name of the object instancepublic <T> State setObjectsValue(java.lang.String objectName, java.lang.String attName, T value)
OOMDPStatesetObjectsValue in interface StatesetObjectsValue in class OOMDPStatepublic java.util.Map<java.lang.String,java.lang.String> getObjectMatchingTo(State so, boolean enforceStateExactness)
getObjectMatchingTo in interface Stateso - 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.Objectpublic int numTotalObjects()
numTotalObjects in interface Statepublic int numObservableObjects()
public ObjectInstance getObject(int i)
public ObjectInstance getObject(java.lang.String oname)
public java.util.List<ObjectInstance> getObservableObjects()
public java.util.List<ObjectInstance> getAllObjects()
getAllObjects in interface Statepublic com.google.common.collect.ImmutableList<ImmutableObjectInstance> getImmutableObjects()
getImmutableObjects in interface ImmutableStateInterfacepublic java.util.List<ObjectInstance> getObjectsOfClass(java.lang.String oclass)
getObjectsOfClass in interface Stateoclass - the name of the object class for which objects should be returnedpublic ObjectInstance getFirstObjectOfClass(java.lang.String oclass)
getFirstObjectOfClass in interface Stateoclass - 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 Statepublic java.util.List<java.util.List<ObjectInstance>> getAllObjectsByClass()
getAllObjectsByClass in interface Statepublic java.lang.String getCompleteStateDescription()
getCompleteStateDescription in interface Statepublic java.util.List<java.util.List<ObjectInstance>> getPossibleObjectBindingsGivenParamOrderGroups(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.util.List<java.util.List<java.lang.String>> getPossibleBindingsGivenParamOrderGroups(java.lang.String[] paramClasses,
java.lang.String[] paramOrderGroups)
StategetPossibleBindingsGivenParamOrderGroups in interface StateparamClasses - the name of object classes to which the bound object instances must belongparamOrderGroups - the parameter order group names.public java.util.Map<java.lang.String,java.util.List<java.lang.String>> getAllUnsetAttributes()
StategetAllUnsetAttributes in interface Statepublic java.lang.String getCompleteStateDescriptionWithUnsetAttributesAsNull()
StategetCompleteStateDescriptionWithUnsetAttributesAsNull in interface Statepublic boolean isHashed()
isHashed in interface ImmutableStateInterfacepublic int hashCode()
hashCode in class java.lang.Objectpublic java.util.Iterator<ImmutableObjectInstance> iterator()
iterator in interface java.lang.Iterable<ImmutableObjectInstance>