Package com.swabunga.spell.event
Class Word
java.lang.Object
com.swabunga.spell.event.Word
Offers basic methods to manipulate a text string representing a word.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Sets the value of this Word to be a copy of another.int
getEnd()
Evaluate the end of word position.int
getStart()
Evaluate the start of word position.getText()
Supply the text string representing the wordint
length()
Evaluate the length of the word.void
setStart
(int s) Set the start index of the word.void
Set the text to a new string value.toString()
Supply the text representing the word.
-
Constructor Details
-
Word
Creates a new Word object.- Parameters:
text
- the String representing the word.start
- the start index of the word.
-
Word
Creates a new Word object by cloning an existing Word object.- Parameters:
w
- the word object to clone.
-
-
Method Details
-
getEnd
public int getEnd()Evaluate the end of word position.- Returns:
- the end index of the word.
-
setStart
public void setStart(int s) Set the start index of the word.- Parameters:
s
- the start index.
-
getStart
public int getStart()Evaluate the start of word position.- Returns:
- the start index.
-
setText
Set the text to a new string value.- Parameters:
s
- the new text
-
getText
Supply the text string representing the word- Returns:
- the String representing the word.
-
copy
Sets the value of this Word to be a copy of another.- Parameters:
w
- the Word to copy.
-
length
public int length()Evaluate the length of the word.- Returns:
- the length of the word.
-
toString
Supply the text representing the word.
-