Package org.omegat.util
Class Token
java.lang.Object
org.omegat.util.Token
Offset marks the display offset of character - this might be different than
the characters position in the char array due existence of multi-char
characters.
Since 1.6 strips '&' in given token text.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleandeepEquals(Token other) Check that all fields are equal (unlikeequals(Object)).booleanTwo tokens are thought equal if their hash code is equal.final intReturns the length of a token.final intReturns token's offset in a source string.getTextFromString(String input) Return the section of the string denoted by the tokenstatic String[]getTextsFromString(Token[] tokens, String string) Get the strings represented by the provided tokens, from the original string they were produced from.inthashCode()final StringtoString()
-
Constructor Details
-
Token
Creates a new token.- Parameters:
text- the text of the tokenoffset- the starting position of this token in parent string
-
Token
Creates a new token.- Parameters:
text- the text of the tokenoffset- the starting position of this token in parent stringlength- length of token
-
-
Method Details
-
equals
Two tokens are thought equal if their hash code is equal. -
deepEquals
Check that all fields are equal (unlikeequals(Object)). -
hashCode
public int hashCode() -
getLength
public final int getLength()Returns the length of a token. -
getOffset
public final int getOffset()Returns token's offset in a source string. -
toString
-
getTextFromString
Return the section of the string denoted by the token -
getTextsFromString
Get the strings represented by the provided tokens, from the original string they were produced from. For debugging purposes.
-