public class NfaStateOrAcyclic extends NfaState
Constructor and Description |
---|
NfaStateOrAcyclic() |
NfaStateOrAcyclic(List<NfaState> clauses,
boolean clausesAllSameLength) |
Modifier and Type | Method and Description |
---|---|
protected String |
dumpInternal(Map<NfaState,Integer> stateNrs) |
boolean |
findMatchesInternal(ForwardIndexDocument fiDoc,
int pos,
int direction,
Set<Integer> matchEnds)
Find all matches for this NFA in the token source.
|
protected void |
finishInternal(Set<NfaState> visited)
Visit each node and replace dangling arrows (nulls) with the match state.
|
boolean |
hitsAllSameLength(Set<NfaState> statesVisited)
Are all hits from this NFA the same length?
|
int |
hitsLengthMax(Set<NfaState> statesVisited)
What's the maximum hit length?
|
int |
hitsLengthMin(Set<NfaState> statesVisited)
What's the minimum hit length?
|
boolean |
matchesEmptySequence(Set<NfaState> statesVisited)
Does this NFA match the empty sequence?
|
void |
setNextState(int input,
NfaState state)
Set the next state for a given input.
|
public boolean findMatchesInternal(ForwardIndexDocument fiDoc, int pos, int direction, Set<Integer> matchEnds)
NfaState
fiDoc
- where to read tokens frompos
- current matching positiondirection
- matching directionmatchEnds
- where to collect the matches found, or null if we don't want
to collect thempublic void setNextState(int input, NfaState state)
NfaState
setNextState
in class NfaState
input
- inputstate
- next statepublic boolean matchesEmptySequence(Set<NfaState> statesVisited)
NfaState
matchesEmptySequence
in class NfaState
statesVisited
- states we've already visited, so we can deal with cyclespublic boolean hitsAllSameLength(Set<NfaState> statesVisited)
NfaState
hitsAllSameLength
in class NfaState
statesVisited
- states we've already visited, so we can deal with cyclespublic int hitsLengthMin(Set<NfaState> statesVisited)
NfaState
hitsLengthMin
in class NfaState
statesVisited
- states we've already visited, so we can deal with cyclespublic int hitsLengthMax(Set<NfaState> statesVisited)
NfaState
hitsLengthMax
in class NfaState
statesVisited
- states we've already visited, so we can deal with cyclesprotected String dumpInternal(Map<NfaState,Integer> stateNrs)
dumpInternal
in class NfaState
protected void finishInternal(Set<NfaState> visited)
NfaState
finishInternal
in class NfaState
visited
- nodes visited so far, this one included. finish() uses this to
make sure we don't visit the same node twice, so always call
finish() in your implementations, not finishInternal().Copyright © 2020 Instituut voor Nederlandse Taal (INT). All rights reserved.