public class KeyWord extends java.lang.Object implements java.lang.Comparable<KeyWord>, Prioritizable
Constructor and Description |
---|
KeyWord(java.lang.String word)
Constructs a KeyWord with the given word (converted to lower-case)
and zero occurences.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(KeyWord other)
Compares the KeyWord with the one given.
|
boolean |
equals(java.lang.Object other)
Compares this KeyWord to the specified object.
|
int |
getOccurrences()
Returns the number of occurrences for this KeyWord.
|
int |
getPriority()
Returns the priority for this KeyWord.
|
java.lang.String |
getWord()
Returns the word for this KeyWord.
|
void |
increment()
Adds one to the number of occurrences for this KeyWord.
|
public KeyWord(java.lang.String word)
word
- the word for this KeyWordjava.lang.IllegalArgumentException
- if word is null or emptypublic java.lang.String getWord()
public int getOccurrences()
public void increment()
public int getPriority()
getPriority
in interface Prioritizable
public int compareTo(KeyWord other)
compareTo
in interface java.lang.Comparable<KeyWord>
other
- the KeyWord with which to compare this KeyWordpublic boolean equals(java.lang.Object other)
equals
in class java.lang.Object
other
- the object with which to compare this KeyWord