ir.vsr
Class TokenPositionInfo
java.lang.Object
|
+--ir.vsr.TokenPositionInfo
- All Implemented Interfaces:
- java.lang.Comparable
- public class TokenPositionInfo
- extends java.lang.Object
- implements java.lang.Comparable
A lightweight object for storing information about positions of a token (a.k.a word, term)
in some document.
Field Summary |
java.util.ArrayList |
positions
A list of positions (Integers) where the token occurs |
java.lang.String |
token
The token itself |
Constructor Summary |
TokenPositionInfo(java.lang.String token,
java.util.ArrayList positions)
Create an initially empty data structure |
Method Summary |
int |
compareTo(java.lang.Object obj)
Compares this TokenPositionInfo to another for sorting from tokens whose
first appearance in the document is earlier to those that first appear later. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
token
public java.lang.String token
- The token itself
positions
public java.util.ArrayList positions
- A list of positions (Integers) where the token occurs
TokenPositionInfo
public TokenPositionInfo(java.lang.String token,
java.util.ArrayList positions)
- Create an initially empty data structure
compareTo
public int compareTo(java.lang.Object obj)
- Compares this TokenPositionInfo to another for sorting from tokens whose
first appearance in the document is earlier to those that first appear later.
- Specified by:
compareTo
in interface java.lang.Comparable
- Parameters:
obj
- The TokenPositionInfo to compare with.- Returns:
- -1 if smaller than obj, 0 if same, 1 if greater than obj
- See Also:
Arrays.sort