public abstract class HashableState extends java.lang.Object implements State
State objects. This is useful for tabular
planning and learning algorithms that make use of hash-backed sets or maps for fast retrieval. You can
access the state it hashes from the public data member s. If the State
delegate s is a HashableState itself, and you wish
to get the underlying State, then you should use the
getSourceState() method, which will recursively descend and return the base source State.
hashCode() and equals(Object) method.
State interface; however,
because the purpose of this class is to used with hashed data structures, it is not recommended that
you modify the state.| Modifier and Type | Class and Description |
|---|---|
static class |
HashableState.CachedHashableState
A hash code cached abstract implementation of
HashableState. |
| Constructor and Description |
|---|
HashableState(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.
|
abstract boolean |
equals(java.lang.Object obj) |
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.
|
State |
getSourceState()
Returns the underlying source state is hashed.
|
abstract int |
hashCode() |
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.
|
State |
renameObject(java.lang.String originalName,
java.lang.String newName)
Renames the identifier for the object instance currently named originalName with the name newName.
|
<T> State |
setObjectsValue(java.lang.String objectName,
java.lang.String attName,
T value) |
public State s
public HashableState(State s)
public State getSourceState()
State
of this HashableState is also a HashableState,
then it recursively returns its getSourceState().State that this object hashes and evaluates.public abstract int hashCode()
hashCode in class java.lang.Objectpublic abstract boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic State addObject(ObjectInstance o)
Statepublic State addAllObjects(java.util.Collection<ObjectInstance> objects)
StateaddAllObjects in interface Statepublic State removeObject(java.lang.String oname)
StateremoveObject in interface Stateoname - the name of the object instance to remove.public State removeObject(ObjectInstance o)
StateremoveObject in interface Stateo - the object instance to remove from this state.public State removeAllObjects(java.util.Collection<ObjectInstance> objects)
StateremoveAllObjects in interface Statepublic State renameObject(java.lang.String originalName, java.lang.String newName)
StaterenameObject in interface StateoriginalName - the original name of the object instance to be renamed in this statenewName - the new name of the object instancepublic State renameObject(ObjectInstance o, java.lang.String newName)
StaterenameObject in interface Stateo - 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)
StategetObjectMatchingTo 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 int numTotalObjects()
StatenumTotalObjects in interface Statepublic ObjectInstance getObject(java.lang.String oname)
Statepublic java.util.List<ObjectInstance> getAllObjects()
StategetAllObjects in interface Statepublic java.util.List<ObjectInstance> getObjectsOfClass(java.lang.String oclass)
StategetObjectsOfClass in interface Stateoclass - the name of the object class for which objects should be returnedpublic ObjectInstance getFirstObjectOfClass(java.lang.String oclass)
StategetFirstObjectOfClass 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()
StategetObjectClassesPresent in interface Statepublic java.util.List<java.util.List<ObjectInstance>> getAllObjectsByClass()
StategetAllObjectsByClass in interface Statepublic java.lang.String getCompleteStateDescription()
StategetCompleteStateDescription in interface Statepublic 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 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 <T> State setObjectsValue(java.lang.String objectName, java.lang.String attName, T value)
setObjectsValue in interface State