public class TokenPosition extends java.lang.Object implements Position
It tests if the token is present in the line and returns the start position. Tokens are case insensitive
It is kind of expensive to create a lot of these Objects
so it is usually used through the PositionFactory
PositionFactory| Constructor and Description |
|---|
TokenPosition(java.lang.String token)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object obj) |
int |
getLength()
get the length of the position returned by
Position.getPosition(String, int) |
int |
getPosition(java.lang.String line,
int begin)
get a position in a line, not before begin or return -1
|
int |
hashCode() |
public TokenPosition(java.lang.String token)
token - String, the token that should be
foundjava.lang.IllegalArgumentException - if token is null or an empty Stringpublic final int getPosition(java.lang.String line,
int begin)
getPosition in interface Positionline - String, the line to find the position inbegin - int, the location to start frompublic final int getLength()
Position.getPosition(String, int)public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object