Class Word

java.lang.Object
com.swabunga.spell.event.Word

public class Word extends Object
Offers basic methods to manipulate a text string representing a word.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new Word object by cloning an existing Word object.
    Word(String text, int start)
    Creates a new Word object.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Sets the value of this Word to be a copy of another.
    int
    Evaluate the end of word position.
    int
    Evaluate the start of word position.
    Supply the text string representing the word
    int
    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.
    Supply the text representing the word.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Word

      public Word(String text, int start)
      Creates a new Word object.
      Parameters:
      text - the String representing the word.
      start - the start index of the word.
    • Word

      public Word(Word w)
      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

      public void setText(String s)
      Set the text to a new string value.
      Parameters:
      s - the new text
    • getText

      public String getText()
      Supply the text string representing the word
      Returns:
      the String representing the word.
    • copy

      public void copy(Word w)
      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

      public String toString()
      Supply the text representing the word.
      Overrides:
      toString in class Object
      Returns:
      the text representing the word.