|
Algorithm Development Kit 1.0 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectalgs.model.searchtree.states.StateHash
public class StateHash
Maintains the set of open states using a Hash.
INodeSet.insert(INode)
and INodeSet.remove(INode)
can be
essentially linear if the Object.hashCode()
function for INode properly distributes the
potential set of INode objects uniformly.
Note that remove is unsupported in this context because there is no
clear interpretation that makes external sense. The Hashtable constructed
to store the states could return the INode objects in an implementation-specific
way, but that would not be testable under any circumstance.
Field Summary | |
---|---|
static int |
initialCapacity
Initial capacity. |
Constructor Summary | |
---|---|
StateHash()
Construct hash to store INode objects. |
Method Summary | |
---|---|
INode |
contains(INode n)
Locate element stored in set that equals n. |
void |
insert(INode n)
Insert a node into the hash. |
boolean |
isEmpty()
Is collection empty. |
java.util.Iterator<INode> |
iterator()
Return iterator to the existing board states. |
INode |
remove()
Not supported since it makes no sense in this context. |
boolean |
remove(INode n)
Remove actual entry from the set. |
int |
size()
Return the number of states in the set. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static int initialCapacity
Constructor Detail |
---|
public StateHash()
Method Detail |
---|
public void insert(INode n)
insert
in interface INodeSet
n
- public INode remove()
remove
in interface INodeSet
public boolean isEmpty()
INodeSet
isEmpty
in interface INodeSet
public int size()
INodeSet
size
in interface INodeSet
public java.util.Iterator<INode> iterator()
INodeSet
iterator
in interface INodeSet
public INode contains(INode n)
Object.equals(Object)
and Object.hashCode()
.
contains
in interface INodeSet
n
- target node to be searched forpublic boolean remove(INode n)
The INode passed in must be an actual value returned by INodeSet.contains(INode)
.
remove
in interface INodeSet
n
- the node representing the entry to be removed.INodeSet.remove(INode)
|
Algorithm Development Kit 1.0 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |