public class State extends Object
A state has various important tasks it must attend to:
The root state is special in the sense that it has no failure state; it cannot fail. If it 'fails' it will still parse the next character and start from the root node. This ensures that the algorithm always runs. All other states always have a fail state.
| Modifier and Type | Method and Description |
|---|---|
void |
addEmit(Collection<String> emits) |
void |
addEmit(String keyword) |
State |
addState(Character character) |
Collection<String> |
emit() |
State |
failure() |
int |
getDepth() |
Collection<State> |
getStates() |
Collection<Character> |
getTransitions() |
State |
nextState(Character character) |
State |
nextStateIgnoreRootState(Character character) |
void |
setFailure(State failState) |
public int getDepth()
public void addEmit(String keyword)
public void addEmit(Collection<String> emits)
public Collection<String> emit()
public State failure()
public void setFailure(State failState)
public Collection<State> getStates()
public Collection<Character> getTransitions()
Copyright © 2014-2015 42 BV. All Rights Reserved.