com.bluemarsh.jswat.view
Class BasicTokenInfo
java.lang.Object
|
+--com.bluemarsh.jswat.view.BasicTokenInfo
- All Implemented Interfaces:
- TokenInfo
- Direct Known Subclasses:
- JavaTokenInfo
- public class BasicTokenInfo
- extends java.lang.Object
- implements TokenInfo
This class provides a basic implementation of the TokenInfo
interface.
- Author:
- Nathan Fiedler
Field Summary |
protected int |
length
Length of the token in characters. |
protected int |
offset
Offset into the character buffer to the start of the token. |
Constructor Summary |
BasicTokenInfo(int offset,
int length)
Constructs a BasicTokenInfo object using the given length and offset. |
Method Summary |
int |
getEndOffset()
Get the character offset within the document of the last
character in this token. |
int |
getLength()
Get the length of this token in characters. |
int |
getStartOffset()
Get the character offset within the document of the first
character in this token. |
java.lang.String |
toString()
Returns a string representation of this. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
offset
protected int offset
- Offset into the character buffer to the start of the token.
length
protected int length
- Length of the token in characters.
BasicTokenInfo
public BasicTokenInfo(int offset,
int length)
- Constructs a BasicTokenInfo object using the given length and offset.
- Parameters:
offset
- offset to the start of the token.length
- length of the token string.
getLength
public int getLength()
- Get the length of this token in characters.
- Specified by:
getLength
in interface TokenInfo
- Returns:
- length of the token.
getEndOffset
public int getEndOffset()
- Get the character offset within the document of the last
character in this token.
- Returns:
- last character offset.
getStartOffset
public int getStartOffset()
- Get the character offset within the document of the first
character in this token.
- Specified by:
getStartOffset
in interface TokenInfo
- Returns:
- first character offset.
toString
public java.lang.String toString()
- Returns a string representation of this.
- Specified by:
toString
in interface TokenInfo
- Overrides:
toString
in class java.lang.Object
- Returns:
- a String.