Package org.htmlunit.cyberneko
Class HTMLNamedEntitiesParser.State
- java.lang.Object
-
- org.htmlunit.cyberneko.HTMLNamedEntitiesParser.State
-
- Direct Known Subclasses:
HTMLNamedEntitiesParser.RootState
- Enclosing class:
- HTMLNamedEntitiesParser
public static class HTMLNamedEntitiesParser.State extends java.lang.Object
Our "level" in the treeish structure that keeps its static state and the next level underneath.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) int[]
characters_
private int
depth_
boolean
endNode_
boolean
endsWithSemicolon_
java.lang.String
entityOrFragment_
boolean
isMatch_
int
length_
(package private) HTMLNamedEntitiesParser.State[]
nextState_
java.lang.String
resolvedValue_
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
add(java.lang.String entity, java.lang.String resolvedValue)
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(java.lang.String entity, java.lang.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 Detail
-
depth_
private final int depth_
-
characters_
int[] characters_
-
nextState_
HTMLNamedEntitiesParser.State[] nextState_
-
entityOrFragment_
public final java.lang.String entityOrFragment_
-
resolvedValue_
public java.lang.String resolvedValue_
-
length_
public final int length_
-
endsWithSemicolon_
public final boolean endsWithSemicolon_
-
isMatch_
public boolean isMatch_
-
endNode_
public boolean endNode_
-
-
Method Detail
-
updateNonSemicolonEntity
protected void updateNonSemicolonEntity(java.lang.String entity, java.lang.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. 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
protected void add(java.lang.String entity, java.lang.String resolvedValue)
Add a new entity to the pseudo-tree- Parameters:
entity
- the entity to look for laterresolvedValue
- the value it resolves to
-
lookup
protected 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 only- Parameters:
character
- the char to look up- Returns:
- the next state or the same in case the character was not found
-
-