Class Word


  • public class Word
    extends java.lang.Object
    Stores a word, including various properties about the word.
    Author:
    alex
    • Constructor Summary

      Constructors 
      Constructor Description
      Word​(java.lang.String name, java.lang.String meaning)
      Creates a word
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      void addHomonym​(Word hom)
      Adds a homonym to a word, unless it has already been added
      void addSynonym​(Word syn)
      Adds a synonym to a word, unless it has already been added
      void clearSynonyms()
      Clears all synonyms from a word
      boolean equals​(java.lang.Object obj)  
      java.util.Date getCreationDate()
      Gets the creation date of a word.
      java.util.Date getEditDate()
      Gets the last time a word was edited
      java.lang.String getEtymology()
      Gets where the word comes from.
      java.util.ArrayList<Word> getHomonyms()
      Gets a list of all homonyms
      java.lang.String getMeaning()
      Gets the meaning of a word
      java.lang.String getName()
      Get the textual representation of a word
      java.lang.String getPronounciation()
      Gets the pronounciation of a word
      Language getSourceLanguage()
      Deprecated.
      as of v1.1.2, writing an entire language for each word to the file seems like a disaster waiting to happen
      java.util.ArrayList<Word> getSynonyms()
      Gets a list of all synonyms
      void removeHomonym​(int i)
      Removes a homonym at index i
      void removeSynonym​(int i)
      Removes a synonym at index i
      void setCreationDate​(java.util.Date date)
      Sets the creation date of a word.
      void setEditDate​(java.util.Date editDate)
      Sets the last time a word was edited.
      void setEtymology​(java.lang.String etymology)
      Sets where the word comes from
      void setHomonyms​(java.util.ArrayList<Word> homonyms)
      Replaces the homonym list with a new list
      void setMeaning​(java.lang.String meaning)
      Sets the meaning of a word
      void setName​(java.lang.String name)
      Sets how a word is written
      void setPronounciation​(java.lang.String pronounciation)
      Sets how a word is pronounced
      void setSourceLanguage​(Language sourceLanguage)
      Deprecated.
      as of v1.1.2, writing an entire language for each word to the file seems like a disaster waiting to happen
      void setSynonyms​(java.util.ArrayList<Word> synonyms)
      Replaces the synonym list with a new list
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

      • Word

        public Word​(java.lang.String name,
                    java.lang.String meaning)
        Creates a word
        Parameters:
        name - The word in question
        meaning - What the word means
    • Method Detail

      • getName

        public java.lang.String getName()
        Get the textual representation of a word
        Returns:
        Textual representation of a word
      • setName

        public void setName​(java.lang.String name)
        Sets how a word is written
        Parameters:
        name - The way the word is written
      • getMeaning

        public java.lang.String getMeaning()
        Gets the meaning of a word
        Returns:
        The meaning of the word
      • setMeaning

        public void setMeaning​(java.lang.String meaning)
        Sets the meaning of a word
        Parameters:
        meaning - The meaning of the word
      • setPronounciation

        public void setPronounciation​(java.lang.String pronounciation)
        Sets how a word is pronounced
        Parameters:
        pronounciation - The way the word is pronounced.
      • getPronounciation

        public java.lang.String getPronounciation()
        Gets the pronounciation of a word
        Returns:
        The pronounciation of the word
      • setEtymology

        public void setEtymology​(java.lang.String etymology)
        Sets where the word comes from
        Parameters:
        etymology - Where the word comes from
      • getEtymology

        public java.lang.String getEtymology()
        Gets where the word comes from. Expect " " being returned as null.
        Returns:
        The etymology of the word
      • setSourceLanguage

        @Deprecated
        public void setSourceLanguage​(Language sourceLanguage)
        Deprecated.
        as of v1.1.2, writing an entire language for each word to the file seems like a disaster waiting to happen
        Sets the language the word came from
        Parameters:
        sourceLanguage -
      • getSourceLanguage

        public Language getSourceLanguage()
        Deprecated.
        as of v1.1.2, writing an entire language for each word to the file seems like a disaster waiting to happen
        Gets the language the word came from
        Returns:
        The Language object of where the word came from
      • getCreationDate

        public java.util.Date getCreationDate()
        Gets the creation date of a word.
        Returns:
        The datetime a word was created.
      • setCreationDate

        public void setCreationDate​(java.util.Date date)
        Sets the creation date of a word. Should only be used when reading files, not writing.
        Parameters:
        date - The datetime a word was created.
      • getEditDate

        public java.util.Date getEditDate()
        Gets the last time a word was edited
        Returns:
        The datetime a word was last edited.
      • setEditDate

        public void setEditDate​(java.util.Date editDate)
        Sets the last time a word was edited. Should be used whenever a word is modified.
        Parameters:
        editDate - The datetime a word was last edited.
      • addSynonym

        public void addSynonym​(Word syn)
        Adds a synonym to a word, unless it has already been added
        Parameters:
        syn - The synonym to be added
      • removeSynonym

        public void removeSynonym​(int i)
        Removes a synonym at index i
        Parameters:
        i - The synonym to be removed
      • clearSynonyms

        public void clearSynonyms()
        Clears all synonyms from a word
      • setSynonyms

        public void setSynonyms​(java.util.ArrayList<Word> synonyms)
        Replaces the synonym list with a new list
        Parameters:
        synonyms - The list replacing the old list
      • getSynonyms

        public java.util.ArrayList<Word> getSynonyms()
        Gets a list of all synonyms
        Returns:
        a list of all synonyms
      • addHomonym

        public void addHomonym​(Word hom)
        Adds a homonym to a word, unless it has already been added
        Parameters:
        syn - The homonym to be added
      • removeHomonym

        public void removeHomonym​(int i)
        Removes a homonym at index i
        Parameters:
        i - The homonym to be removed
      • setHomonyms

        public void setHomonyms​(java.util.ArrayList<Word> homonyms)
        Replaces the homonym list with a new list
        Parameters:
        homonym - The list replacing the old list
      • getHomonyms

        public java.util.ArrayList<Word> getHomonyms()
        Gets a list of all homonyms
        Returns:
        a list of all homonyms
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object