public class IndexEntry
extends java.lang.Object
| Modifier and Type | Field | Description |
|---|---|---|
private java.util.TreeSet<java.lang.Integer> |
lineNumbers |
a TreeSet of Integers that holds the line numbers that word appears on
|
private java.lang.String |
word |
a String that holds the word that appears on the line numbers in the TreeSet
|
| Constructor | Description |
|---|---|
IndexEntry(java.lang.String w) |
Initializes an IndexEntry using a single String parameter.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
add(int num) |
Adds a number to the list of line numbers (if it is not already in the list).
|
java.lang.String |
getWord() |
Returns the word field of the IndexEntry.
|
java.lang.String |
toString() |
Returns the corresponding String value for the IndexEntry.
|
private java.lang.String word
private java.util.TreeSet<java.lang.Integer> lineNumbers
public IndexEntry(java.lang.String w)
w - sets the word field of the IndexEntryjava.lang.IllegalArgumentException - if w is nullpublic void add(int num)
num - the line number to be added to the list of numberspublic java.lang.String getWord()
public java.lang.String toString()
toString in class java.lang.Object