public class StateEnumerator
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected Domain |
domain
The domain whose states will be enumerated
|
protected java.util.Map<StateHashTuple,java.lang.Integer> |
enumeration
The forward state enumeration map
|
protected StateHashFactory |
hashingFactory
The hashing factory used to hash states and perform equality tests
|
protected int |
nextEnumeratedID
The id to use for the next unique state that is added
|
protected java.util.Map<java.lang.Integer,State> |
reverseEnumerate
The reverse enumeration id to state map
|
Constructor and Description |
---|
StateEnumerator(Domain domain,
StateHashFactory hashingFactory)
Constructs
|
Modifier and Type | Method and Description |
---|---|
void |
findReachableStatesAndEnumerate(State from)
Finds all states that are reachable from an input state and enumerates them
|
void |
findReachableStatesAndEnumerate(State from,
TerminalFunction tf)
Finds all states that are reachable from an input state and enumerates them.
|
int |
getEnumeratedID(State s)
Get or create and get the enumeration id for a state
|
protected int |
getEnumeratedID(StateHashTuple sh)
Get or create and get the enumeration id for a hashed state
|
State |
getStateForEnumertionId(int id)
Returns the state associated with the given enumeration id.
|
int |
numStatesEnumerated()
Returns the number of states that have been enumerated
|
protected Domain domain
protected StateHashFactory hashingFactory
protected java.util.Map<StateHashTuple,java.lang.Integer> enumeration
protected java.util.Map<java.lang.Integer,State> reverseEnumerate
protected int nextEnumeratedID
public StateEnumerator(Domain domain, StateHashFactory hashingFactory)
domain
- the domain of the states to be enumeratedhashingFactory
- the hashing factory to usepublic void findReachableStatesAndEnumerate(State from)
from
- the state from which all reachable states should be searchedpublic void findReachableStatesAndEnumerate(State from, TerminalFunction tf)
from
- the state from which all reachable states should be searchedtf
- the terminal function that prevents expanding from terminal statespublic int getEnumeratedID(State s)
s
- the state to get the enumeration idpublic State getStateForEnumertionId(int id)
id
- the enumeration idpublic int numStatesEnumerated()
protected int getEnumeratedID(StateHashTuple sh)
sh
- the hased state to get the enumeration id