|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectStateTable
public class StateTable
Class StateTable gives a representation of the set of reachable states with a given history length.
Nested Class Summary | |
---|---|
class |
StateTable.Element
Class Element represents a node in a linked list
of states; two links are provided, queueLink and
hashLink , so that the node can be used both in
the representation of the BFS queue and in the representation
of a chain in the hash table. |
Field Summary | |
---|---|
static java.lang.String |
DATADIRECTORY
The path to the directory in which the transition table is to be stored. |
(package private) int |
h
The value of the history parameter. |
(package private) StateTable.Element[] |
hashTable
A hash table of states. |
(package private) static int |
hashTableSize
The number of slots in the hash table. |
(package private) int |
numberOfAcceptingStates
The number of distinct reachable accepting states found so far. |
(package private) StateTable.Element |
queueHead
The head of the queue. |
(package private) StateTable.Element |
queueTail
The tail of the queue. |
(package private) State[] |
sortedStates
A call to sortStates will set this to an array
containing state number i in
sortedStates[i] ; position 0 in the array is
unused. |
(package private) static boolean |
verbose
Set this to true for verbose output. |
Constructor Summary | |
---|---|
StateTable()
Create and initialize a new StateTable class. |
Method Summary | |
---|---|
void |
addSuccessors(State s,
int c)
Find all states that can be reached from this state by reading a single minimal match pair of the form T c,pad , for -h<pad<h ,
and write the transitions to the file. |
void |
build(int h)
Build the state table for history h , and write it to
the file. |
StateTable.Element |
dequeue()
Remove and return the next element from the queue. |
void |
enqueue(StateTable.Element e)
Append e to the queue. |
int |
findOrAdd(State s)
Search for state s ; if not found insert into
the hash table and append it to the queue; in any case return
its state number . |
static void |
main(java.lang.String[] args)
Build and write out the table of transitions and states. |
void |
sortStates()
Set sortedStates to an array in which the
element indexed by i is state number
i ; the 0th array position is unused. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
static final int hashTableSize
public static final java.lang.String DATADIRECTORY
static boolean verbose
State[] sortedStates
sortStates
will set this to an array
containing state number i
in
sortedStates[i]
; position 0 in the array is
unused.
int h
int numberOfAcceptingStates
StateTable.Element[] hashTable
StateTable.Element queueHead
StateTable.Element queueTail
Constructor Detail |
---|
public StateTable()
numberOfAcceptingStates
to 0.
Method Detail |
---|
public void enqueue(StateTable.Element e)
e
to the queue.
public StateTable.Element dequeue()
public void build(int h) throws java.io.IOException
h
, and write it to
the file.
java.io.IOException
public void addSuccessors(State s, int c) throws java.io.IOException
c,pad
, for -h<pad<h
,
and write the transitions to the file.
java.io.IOException
public int findOrAdd(State s)
s
; if not found insert into
the hash table and append it to the queue; in any case return
its state number
.
public void sortStates()
sortedStates
to an array in which the
element indexed by i
is state number
i
; the 0th array position is unused.
public static void main(java.lang.String[] args) throws java.io.IOException
java StateTable <history>
java.io.IOException
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |