morfologik.fsa
Class ConstantArcSizeFSA

java.lang.Object
  extended by morfologik.fsa.FSA
      extended by morfologik.fsa.ConstantArcSizeFSA
All Implemented Interfaces:
java.lang.Iterable<java.nio.ByteBuffer>

public final class ConstantArcSizeFSA
extends FSA

An FSA with constant-size arc representation produced directly by FSABuilder.

See Also:
FSABuilder

Field Summary
static int ADDRESS_OFFSET
          Offset of the address field inside an arc.
static int ARC_SIZE
          Size of a single arc structure.
static int BIT_ARC_FINAL
          An arc flag indicating the target node of an arc corresponds to a final state.
static int BIT_ARC_LAST
          An arc flag indicating the arc is last within its state.
static int FLAGS_OFFSET
          Offset of the flags field inside an arc.
static int FLAGS_SIZE
          Size of the flags field (constant for the builder).
static int LABEL_OFFSET
          Offset of the label field inside an arc.
static int LABEL_SIZE
          Size of the label field (constant for the builder).
static int TARGET_ADDRESS_SIZE
          Size of the target address field (constant for the builder).
 
Method Summary
 int getArc(int node, byte label)
           
 byte getArcLabel(int arc)
          Return the label associated with a given arc.
 int getEndNode(int arc)
          Return the end node pointed to by a given arc.
 int getFirstArc(int node)
           
 java.util.Set<FSAFlags> getFlags()
          Returns a set of flags for this FSA instance.
 int getNextArc(int arc)
           
 int getRootNode()
           
 boolean isArcFinal(int arc)
          Returns true if the destination node at the end of this arc corresponds to an input sequence created when building this automaton.
 boolean isArcTerminal(int arc)
          Returns true if this arc does not have a terminating node (@link FSA.getEndNode(int) will throw an exception).
 
Methods inherited from class morfologik.fsa.FSA
getArcCount, getRightLanguageCount, getSequences, getSequences, iterator, read, visitAllStates, visitInPostOrder, visitInPostOrder, visitInPreOrder, visitInPreOrder
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TARGET_ADDRESS_SIZE

public static final int TARGET_ADDRESS_SIZE
Size of the target address field (constant for the builder).

See Also:
Constant Field Values

FLAGS_SIZE

public static final int FLAGS_SIZE
Size of the flags field (constant for the builder).

See Also:
Constant Field Values

LABEL_SIZE

public static final int LABEL_SIZE
Size of the label field (constant for the builder).

See Also:
Constant Field Values

ARC_SIZE

public static final int ARC_SIZE
Size of a single arc structure.

See Also:
Constant Field Values

FLAGS_OFFSET

public static final int FLAGS_OFFSET
Offset of the flags field inside an arc.

See Also:
Constant Field Values

LABEL_OFFSET

public static final int LABEL_OFFSET
Offset of the label field inside an arc.

See Also:
Constant Field Values

ADDRESS_OFFSET

public static final int ADDRESS_OFFSET
Offset of the address field inside an arc.

See Also:
Constant Field Values

BIT_ARC_FINAL

public static final int BIT_ARC_FINAL
An arc flag indicating the target node of an arc corresponds to a final state.

See Also:
Constant Field Values

BIT_ARC_LAST

public static final int BIT_ARC_LAST
An arc flag indicating the arc is last within its state.

See Also:
Constant Field Values
Method Detail

getRootNode

public int getRootNode()
Specified by:
getRootNode in class FSA
Returns:
Returns the identifier of the root node of this automaton. Returns 0 if the start node is also the end node (the automaton is empty).

getFirstArc

public int getFirstArc(int node)
Specified by:
getFirstArc in class FSA
Returns:
Returns the identifier of the first arc leaving node or 0 if the node has no outgoing arcs.

getArc

public int getArc(int node,
                  byte label)
Specified by:
getArc in class FSA
Returns:
Returns the identifier of an arc leaving node and labeled with label. An identifier equal to 0 means the node has no outgoing arc labeled label.

getNextArc

public int getNextArc(int arc)
Specified by:
getNextArc in class FSA
Returns:
Returns the identifier of the next arc after arc and leaving node. Zero is returned if no more arcs are available for the node.

getArcLabel

public byte getArcLabel(int arc)
Description copied from class: FSA
Return the label associated with a given arc.

Specified by:
getArcLabel in class FSA

isArcFinal

public boolean isArcFinal(int arc)
Description copied from class: FSA
Returns true if the destination node at the end of this arc corresponds to an input sequence created when building this automaton.

Specified by:
isArcFinal in class FSA

isArcTerminal

public boolean isArcTerminal(int arc)
Description copied from class: FSA
Returns true if this arc does not have a terminating node (@link FSA.getEndNode(int) will throw an exception). Implies FSA.isArcFinal(int).

Specified by:
isArcTerminal in class FSA

getEndNode

public int getEndNode(int arc)
Description copied from class: FSA
Return the end node pointed to by a given arc. Terminal arcs (those that point to a terminal state) have no end node representation and throw a runtime exception.

Specified by:
getEndNode in class FSA

getFlags

public java.util.Set<FSAFlags> getFlags()
Description copied from class: FSA
Returns a set of flags for this FSA instance.

Specified by:
getFlags in class FSA