Class ConstantArcSizeFST
- java.lang.Object
-
- org.apache.pinot.segment.local.utils.nativefst.FST
-
- org.apache.pinot.segment.local.utils.nativefst.ConstantArcSizeFST
-
- All Implemented Interfaces:
Iterable<ByteBuffer>
public final class ConstantArcSizeFST extends FST
A FST with constant-size arc representation produced directly byFSTBuilder.- See Also:
FSTBuilder
-
-
Field Summary
Fields Modifier and Type Field Description static intADDRESS_OFFSETOffset of the address field inside an arc.static intARC_SIZESize of a single arc structure.static intBIT_ARC_FINALAn arc flag indicating the target node of an arc corresponds to a final state.static intBIT_ARC_LASTAn arc flag indicating the arc is last within its state.static intFLAGS_OFFSETOffset of the flags field inside an arc.static intFLAGS_SIZESize of the flags field (constant for the builder).static intLABEL_OFFSETOffset of the label field inside an arc.static intLABEL_SIZESize of the label field (constant for the builder).static intTARGET_ADDRESS_SIZESize of the target address field (constant for the builder).static intTERMINAL_STATEA dummy address of the terminal state.
-
Constructor Summary
Constructors Constructor Description ConstantArcSizeFST(byte[] data, int epsilon, Map<Integer,Integer> outputSymbols)
-
Method Summary
Modifier and Type Method Description intgetArc(int node, byte label)bytegetArcLabel(int arc)intgetEndNode(int arc)intgetFirstArc(int node)Set<FSTFlags>getFlags()intgetNextArc(int arc)intgetOutputSymbol(int arc)Get output symbol for the given arcintgetRootNode()booleanisArcFinal(int arc)booleanisArcLast(int arc)booleanisArcTerminal(int arc)-
Methods inherited from class org.apache.pinot.segment.local.utils.nativefst.FST
buildMap, getRightLanguageCount, getSequences, getSequences, iterator, printToString, read, read, read, readRemaining, save, toString, visitInPostOrder, visitInPostOrder, visitInPreOrder, visitInPreOrder
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
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
-
TERMINAL_STATE
public static final int TERMINAL_STATE
A dummy address of the terminal state.- See Also:
- Constant Field Values
-
-
Method Detail
-
getRootNode
public int getRootNode()
- Specified by:
getRootNodein classFST- 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:
getFirstArcin classFST- Parameters:
node- Identifier of the node.- Returns:
- Returns the identifier of the first arc leaving
nodeor 0 if the node has no outgoing arcs.
-
getArc
public int getArc(int node, byte label)
-
getNextArc
public int getNextArc(int arc)
- Specified by:
getNextArcin classFST- Parameters:
arc- The arc's identifier.- Returns:
- Returns the identifier of the next arc after
arcand leavingnode. Zero is returned if no more arcs are available for the node.
-
getArcLabel
public byte getArcLabel(int arc)
- Specified by:
getArcLabelin classFST- Parameters:
arc- The arc's identifier.- Returns:
- Return the label associated with a given
arc.
-
getOutputSymbol
public int getOutputSymbol(int arc)
Description copied from class:FSTGet output symbol for the given arc- Specified by:
getOutputSymbolin classFST- Parameters:
arc- Arc for which the output symbol is requested- Returns:
- Output symbol, null if not present
-
isArcFinal
public boolean isArcFinal(int arc)
- Specified by:
isArcFinalin classFST- Parameters:
arc- The arc's identifier.- Returns:
- Returns
trueif the destination node at the end of thisarccorresponds to an input sequence created when building this automaton.
-
isArcTerminal
public boolean isArcTerminal(int arc)
- Specified by:
isArcTerminalin classFST- Parameters:
arc- The arc's identifier.- Returns:
- Returns
trueif thisarcdoes not have a terminating node (@linkFST.getEndNode(int)will throw an exception). ImpliesFST.isArcFinal(int).
-
getEndNode
public int getEndNode(int arc)
- Specified by:
getEndNodein classFST- Parameters:
arc- The arc's identifier.- Returns:
- 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.
-
-