public abstract class StateHashTuple
extends java.lang.Object
State
objects. This is useful for tabular
planning and learning algorithms that make use of hash-backed sets or maps for fast retrieval.
In general, hash codes should only be computed once, and only once the hashCode method is called.
If something about the StateHashTuple changes, then needsToRecomputeHashCode boolean flag should be
set to true so that the next time the hashCode is called it is recomputed. Likewise, once the computeHashCode()
method has been called, it should set the needToRecomputeHashCode flag to false.
By default, equality checks use the standard State
object equality check. If you need
to handle this specially, (such as providing state abstraction), then the equals method should be overridden.Modifier and Type | Field and Description |
---|---|
protected int |
hashCode |
protected boolean |
needToRecomputeHashCode |
State |
s |
Constructor and Description |
---|
StateHashTuple(State s)
Initializes the StateHashTuple with the given
State object. |
Modifier and Type | Method and Description |
---|---|
abstract void |
computeHashCode()
This method computes the hashCode for this object and saves it to the
hashCode field beloning to the abstract class. |
boolean |
equals(java.lang.Object other) |
int |
hashCode() |
public State s
protected int hashCode
protected boolean needToRecomputeHashCode
public abstract void computeHashCode()
hashCode
field beloning to the abstract class.public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object