edu.northwestern.at.wordhoard.swing.calculator.modelutils
Class CountableWordData

java.lang.Object
  extended by edu.northwestern.at.wordhoard.swing.calculator.modelutils.CountableWordData
All Implemented Interfaces:
java.lang.Comparable

public class CountableWordData
extends java.lang.Object
implements java.lang.Comparable

Countable word data.

A countable word data object holds the data values retrieved using a WordHoard CQL word query. These values are used to construct tables of counts for further analysis. Most of the values come from the Word entry except as noted below.

The fields are:


Field Summary
protected  Gender gender
          The gender of the speaker(s).
protected  Spelling lemmaTagInsensitive
          The case insensitive lemma tag for the specified word part.
protected  MetricalShape metricalShape
          The metrical shape of the word.
protected  Mortality mortality
          The mortality of the speaker(s).
protected  Prosodic prosodic
          Is this word in prose or poetry.
protected  Spelling spellingInsensitive
          The case insensitive spelling.
protected  java.lang.String wordClassTag
          The word class tag for the specified word part.
protected  java.lang.Long wordId
          Unique persistence id of the word to which this data pertains.
protected  int wordPartIndex
          The word part index for the lemma and word class.
protected  java.lang.Long wordPartOrdinal
          The word part ordinal.
protected  java.lang.String wordTag
          The unique tag of the word.
protected  java.lang.Long workId
          The ID of the work in which this word appears.
protected  java.lang.Long workPartId
          The work part in which this word appears.
 
Constructor Summary
CountableWordData()
          Create empty countable word object.
CountableWordData(java.lang.Long wordId, java.lang.String wordTag, java.lang.Long workId, java.lang.Long workPartId, Spelling spellingInsensitive, MetricalShape metricalShape, Gender gender, Mortality mortality, Prosodic prosodic, java.lang.Integer wordPartIndex, Spelling lemmaTagInsensitive)
          Create countable word data object.
CountableWordData(java.lang.Object[] countableDataValues)
          Create countable word data object.
 
Method Summary
 int compareTo(java.lang.Object obj)
          Implement Comparable interface.
 boolean equals(java.lang.Object obj)
          Returns true if this object is equal to some other object.
static java.lang.Long generateWordPartOrdinal(java.lang.Long wordId, int wordPartIndex)
          Generates a word part ordinal given a word ID and word part index.
 java.lang.String getGender()
          Gets the speaker gender.
 Spelling getLemmaTag()
          Gets the case and accent insensitive lemma tag.
 java.lang.String getMetricalShape()
          Gets the metrical shape.
 java.lang.String getMortality()
          Gets the speaker mortality.
 java.lang.String getProsodic()
          Gets the prosody flag.
 Spelling getSpelling()
          Gets the spelling for this word.
 java.lang.String getWordClassTag()
          Gets the word class tag.
 java.lang.Long getWordId()
          Gets the Word ID to which this data pertains.
 int getWordPartIndex()
          Gets the word part index.
 java.lang.Long getWordPartOrdinal()
          Gets the word part ordinal.
 java.lang.String getWordTag()
          Gets the permanent tag of the word to which this data pertains.
 java.lang.Long getWorkId()
          Gets the Work ID to which this data pertains.
 java.lang.Long getWorkPartId()
          Gets the Work part ID to which this data pertains.
 int hashCode()
          Returns a hash code for the object.
 java.lang.String toString()
          Return insensitive spelling for display purposes.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

wordId

protected java.lang.Long wordId
Unique persistence id of the word to which this data pertains.


wordTag

protected java.lang.String wordTag
The unique tag of the word.


spellingInsensitive

protected Spelling spellingInsensitive
The case insensitive spelling.


metricalShape

protected MetricalShape metricalShape
The metrical shape of the word.


gender

protected Gender gender
The gender of the speaker(s).


mortality

protected Mortality mortality
The mortality of the speaker(s).


prosodic

protected Prosodic prosodic
Is this word in prose or poetry.


workId

protected java.lang.Long workId
The ID of the work in which this word appears.


workPartId

protected java.lang.Long workPartId
The work part in which this word appears.


wordPartIndex

protected int wordPartIndex
The word part index for the lemma and word class.


lemmaTagInsensitive

protected Spelling lemmaTagInsensitive
The case insensitive lemma tag for the specified word part.


wordClassTag

protected java.lang.String wordClassTag
The word class tag for the specified word part.


wordPartOrdinal

protected java.lang.Long wordPartOrdinal
The word part ordinal. Combines the word ID and word part index fields.

Constructor Detail

CountableWordData

public CountableWordData()
Create empty countable word object.


CountableWordData

public CountableWordData(java.lang.Long wordId,
                         java.lang.String wordTag,
                         java.lang.Long workId,
                         java.lang.Long workPartId,
                         Spelling spellingInsensitive,
                         MetricalShape metricalShape,
                         Gender gender,
                         Mortality mortality,
                         Prosodic prosodic,
                         java.lang.Integer wordPartIndex,
                         Spelling lemmaTagInsensitive)
Create countable word data object.

Parameters:
wordId - The persistence ID for the word whose data this is.
wordTag - The tag of word.
workId - The persistence ID of the work in which this word appears.
workPartId - The persistence ID of the work part in which this word appears.
spellingInsensitive - The case and accent insensitive word spelling.
metricalShape - The metrical shape of the word.
gender - The combined speaker gender.
mortality - The combined speaker mortality.
prosodic - Indivates if this word appears in poetry or prose.
wordPartIndex - Indicates the part of the word to which this data pertains.
lemmaTagInsensitive - The lemma tag for the part of the word part specified by wordPartIndex.

CountableWordData

public CountableWordData(java.lang.Object[] countableDataValues)
Create countable word data object.

Parameters:
countableDataValues - Array of objects whose values match in type and order the countable word data objects as listed in the primary constructor above.

This version of the constructor is convenient for converting query results to countable data objects.

Method Detail

getWordId

public java.lang.Long getWordId()
Gets the Word ID to which this data pertains.

Returns:
The word ID.

getWordTag

public java.lang.String getWordTag()
Gets the permanent tag of the word to which this data pertains.

Returns:
The word tag.

getWorkId

public java.lang.Long getWorkId()
Gets the Work ID to which this data pertains.

Returns:
The work ID.

getWorkPartId

public java.lang.Long getWorkPartId()
Gets the Work part ID to which this data pertains.

Returns:
The work part ID.

getSpelling

public Spelling getSpelling()
Gets the spelling for this word.

Returns:
The case and accent insensitive spelling.

getMetricalShape

public java.lang.String getMetricalShape()
Gets the metrical shape.

Returns:
Metrical shape, or "not specified" if null.

getGender

public java.lang.String getGender()
Gets the speaker gender.

Returns:
The speaker gender (M=male, F=female, U=mixed/unknown).

getMortality

public java.lang.String getMortality()
Gets the speaker mortality.

Returns:
The speaker mortality (M=mortal, I=immortal, U=mixed/unknown).

getProsodic

public java.lang.String getProsodic()
Gets the prosody flag.

Returns:
'y' if word is verse, 'n' if prose, ' ' if not specified.

getLemmaTag

public Spelling getLemmaTag()
Gets the case and accent insensitive lemma tag.

Returns:
Lemma tag.

getWordClassTag

public java.lang.String getWordClassTag()
Gets the word class tag.

Returns:
Word class tag.

getWordPartIndex

public int getWordPartIndex()
Gets the word part index.

Returns:
Word part index.

getWordPartOrdinal

public java.lang.Long getWordPartOrdinal()
Gets the word part ordinal.

Returns:
Word part ordinal.

generateWordPartOrdinal

public static java.lang.Long generateWordPartOrdinal(java.lang.Long wordId,
                                                     int wordPartIndex)
Generates a word part ordinal given a word ID and word part index.

Parameters:
wordId - The word ID.
wordPartIndex - The word part index.

toString

public java.lang.String toString()
Return insensitive spelling for display purposes.

Overrides:
toString in class java.lang.Object
Returns:
Case and accent insensitive spelling.

equals

public boolean equals(java.lang.Object obj)
Returns true if this object is equal to some other object.

The objects are equal if their word part ordinals are equal.

Overrides:
equals in class java.lang.Object
Parameters:
obj - The other object.
Returns:
True if this object equals the other object.

hashCode

public int hashCode()
Returns a hash code for the object.

Overrides:
hashCode in class java.lang.Object
Returns:
The hash code.

compareTo

public int compareTo(java.lang.Object obj)
Implement Comparable interface.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
obj - Other spelling object to which to compare this object.