Package textprocessing
Class Word
java.lang.Object
textprocessing.Word
- All Implemented Interfaces:
Comparable<Word>
- Direct Known Subclasses:
BasicWord
,Bigram
,VocabularyEntry
Abstract class that defines the basis of word objects
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract void
addLocation
(long location) Adds a new location to an existing Word.abstract boolean
Returns true if the passed in Object is equal to this Object The method is made abstract so all inheriting classes must implement their own equals() method and are not allowed to inherit the Object class equals()abstract String
toString()
Returns a String representation of the Word.Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Comparable
compareTo
-
Field Details
-
word
-
-
Constructor Details
-
Word
Constructor for the Word class that stores the inherited word- Parameters:
word
- the String to store
-
-
Method Details
-
addLocation
public abstract void addLocation(long location) Adds a new location to an existing Word. If the location is invalid an appropriate exception should be thrown- Parameters:
location
- a location of the word
-
toString
Returns a String representation of the Word. The method is made abstract so all inheriting classes must implement their own toString() method and are not allowed to inherit the Object class toString() -
equals
Returns true if the passed in Object is equal to this Object The method is made abstract so all inheriting classes must implement their own equals() method and are not allowed to inherit the Object class equals()
-