Package org.htmlunit.cyberneko
Class HTMLNamedEntitiesParser.State
java.lang.Object
org.htmlunit.cyberneko.HTMLNamedEntitiesParser.State
- Direct Known Subclasses:
HTMLNamedEntitiesParser.RootState
- Enclosing class:
HTMLNamedEntitiesParser
Our "level" in the treeish structure that keeps its static state and the next level
underneath.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) int[]
private final int
boolean
final boolean
final String
boolean
final int
(package private) HTMLNamedEntitiesParser.State[]
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Add a new entity to the pseudo-treeprotected HTMLNamedEntitiesParser.State
lookup
(int character) Lookup the state by iterating over the chars at this state, should not be that many and due to the small size of the array, should be cache onlyprotected void
updateNonSemicolonEntity
(String entity, String resolvedValue) We have a special in between state because some entities exist as correct entity with a semicolon at the end and as legacy version without.
-
Field Details
-
depth_
private final int depth_ -
characters_
int[] characters_ -
nextState_
HTMLNamedEntitiesParser.State[] nextState_ -
entityOrFragment_
-
resolvedValue_
-
length_
public final int length_ -
endsWithSemicolon_
public final boolean endsWithSemicolon_ -
isMatch_
public boolean isMatch_ -
endNode_
public boolean endNode_
-
-
Constructor Details
-
State
protected State()Create the empty state -
State
Create us a new state that describes itself nicely
-
-
Method Details
-
updateNonSemicolonEntity
We have a special in between state because some entities exist as correct entity with a semicolon at the end and as legacy version without. We want to look up both correctly, hence when we build the data set, we have to unmark an existing one as final one and insert one more.- Parameters:
entity
- the entity to look upresolvedValue
- the value it will resolve to
-
add
Add a new entity to the pseudo-tree- Parameters:
entity
- the entity to look for laterresolvedValue
- the value it resolves to
-
lookup
Lookup the state by iterating over the chars at this state, should not be that many and due to the small size of the array, should be cache only- Parameters:
character
- the char to look up- Returns:
- the next state or the same in case the character was not found
-