Class Word


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

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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void copy​(Word w)
      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.
      java.lang.String getText()
      Supply the text string representing the word
      int length()
      Evaluate the length of the word.
      void setStart​(int s)
      Set the start index of the word.
      void setText​(java.lang.String s)
      Set the text to a new string value.
      java.lang.String toString()
      Supply the text representing the word.
      • Methods inherited from class java.lang.Object

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

      • Word

        public Word​(java.lang.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 Detail

      • 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​(java.lang.String s)
        Set the text to a new string value.
        Parameters:
        s - the new text
      • getText

        public java.lang.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 java.lang.String toString()
        Supply the text representing the word.
        Overrides:
        toString in class java.lang.Object
        Returns:
        the text representing the word.