Package net.oijon.utils.parser.data
Class Word
- java.lang.Object
-
- net.oijon.utils.parser.data.Word
-
public class Word extends java.lang.Object
Stores a word, including various properties about the word.- Author:
- alex
-
-
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 addedvoid
addSynonym(Word syn)
Adds a synonym to a word, unless it has already been addedvoid
clearSynonyms()
Clears all synonyms from a wordboolean
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 editedjava.lang.String
getEtymology()
Gets where the word comes from.java.util.ArrayList<Word>
getHomonyms()
Gets a list of all homonymsjava.lang.String
getMeaning()
Gets the meaning of a wordjava.lang.String
getName()
Get the textual representation of a wordjava.lang.String
getPronounciation()
Gets the pronounciation of a wordLanguage
getSourceLanguage()
Deprecated.as of v1.1.2, writing an entire language for each word to the file seems like a disaster waiting to happenjava.util.ArrayList<Word>
getSynonyms()
Gets a list of all synonymsvoid
removeHomonym(int i)
Removes a homonym at index ivoid
removeSynonym(int i)
Removes a synonym at index ivoid
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 fromvoid
setHomonyms(java.util.ArrayList<Word> homonyms)
Replaces the homonym list with a new listvoid
setMeaning(java.lang.String meaning)
Sets the meaning of a wordvoid
setName(java.lang.String name)
Sets how a word is writtenvoid
setPronounciation(java.lang.String pronounciation)
Sets how a word is pronouncedvoid
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 happenvoid
setSynonyms(java.util.ArrayList<Word> synonyms)
Replaces the synonym list with a new listjava.lang.String
toString()
-
-
-
Constructor Detail
-
Word
public Word(java.lang.String name, java.lang.String meaning)
Creates a word- Parameters:
name
- The word in questionmeaning
- What the word means
-
Word
public Word(Word w)
Copy constructor- Parameters:
w
- The word to be copied
-
-
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 happenSets 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 happenGets 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 classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-