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, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
renameObject
public 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 ImmutableStateInterface
public final ImmutableState addObject(ObjectInstance object)
State
public final ImmutableState addAllObjects(java.util.Collection<ObjectInstance> objectsToAdd)
State
addAllObjects
in interface State
public final ImmutableState removeObject(java.lang.String objectName)
State
removeObject
in interface State
objectName
- the name of the object instance to remove.public final ImmutableState removeObject(ObjectInstance object)
State
removeObject
in interface State
object
- the object instance to remove from this state.public final ImmutableState removeAllObjects(java.util.Collection<ObjectInstance> objectsToRemove)
State
removeAllObjects
in interface State
public final ImmutableState replaceObject(ObjectInstance objectToReplace, ObjectInstance newObject)
replaceObject
in interface ImmutableStateInterface
public final ImmutableState replaceAllObjects(java.util.List<ImmutableObjectInstance> objectsToRemove, java.util.List<ImmutableObjectInstance> objectsToAdd)
replaceAllObjects
in interface ImmutableStateInterface
public final ImmutableState replaceAllObjectsUnsafe(java.util.List<ObjectInstance> objectsToAdd)
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 <T> State setObjectsValue(java.lang.String objectName, java.lang.String attName, T value)
OOMDPState
setObjectsValue
in interface State
setObjectsValue
in class OOMDPState
public 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 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 State
public com.google.common.collect.ImmutableList<ImmutableObjectInstance> getImmutableObjects()
getImmutableObjects
in interface ImmutableStateInterface
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.lang.String getCompleteStateDescription()
getCompleteStateDescription
in interface State
public 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)
State
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.util.Map<java.lang.String,java.util.List<java.lang.String>> getAllUnsetAttributes()
State
getAllUnsetAttributes
in interface State
public java.lang.String getCompleteStateDescriptionWithUnsetAttributesAsNull()
State
getCompleteStateDescriptionWithUnsetAttributesAsNull
in interface State
public boolean isHashed()
isHashed
in interface ImmutableStateInterface
public int hashCode()
hashCode
in class java.lang.Object
public java.util.Iterator<ImmutableObjectInstance> iterator()
iterator
in interface java.lang.Iterable<ImmutableObjectInstance>