edu.northwestern.at.wordhoard.model.speakers
Class Speaker

java.lang.Object
  extended by edu.northwestern.at.wordhoard.model.speakers.Speaker
All Implemented Interfaces:
GroupingObject, PersistentObject, SearchCriterion, SearchDefaults, java.io.Serializable

public class Speaker
extends java.lang.Object
implements PersistentObject, SearchDefaults, SearchCriterion, GroupingObject, java.io.Serializable

A speaker.

Each speaker has the following attributes:

Note that speakers belong to works. For example, the speaker "Zeus" in The Iliad is different from the speaker "Zeus" in The Odyssey. Thus, there is no way to form an identification of speakers across multiple works. Another example is the speaker "HenryIV" in King Henry the Fourth parts 1 and 2 in Shakespeare.

This is arguably a bad model for speakers, but for now we have decided that it's the best way to go given the current state of the data, time constraints, and the inability of our puny brains to untangle these kinds of complexities.

See Also:
Serialized Form

Constructor Summary
Speaker()
          Creates a new speaker.
 
Method Summary
 void appendDescription(TextLine line, FontInfo romanFontInfo, FontInfo[] fontInfo)
          Appends a description to a text line.
 boolean equals(java.lang.Object obj)
          Returns true if some other object is equal to this one.
 java.lang.String getDescription()
          Gets the role description.
 Gender getGender()
          Gets the gender.
 void getGroupingObjects(java.lang.Class groupBy, java.util.List list)
          Gets grouping objects.
 Spelling getGroupingSpelling(int numHits)
          Gets the spelling of the grouping object.
 java.lang.Long getId()
          Gets the unique id.
 java.lang.Class getJoinClass()
          Gets the join class.
 Mortality getMortality()
          Gets the mortality.
 java.lang.String getName()
          Gets the English name.
 Spelling getOriginalName()
          Gets the name in the original language.
 java.lang.String getReportPhrase()
          Gets the report phrase.
 SearchCriterion getSearchDefault(java.lang.Class cls)
          Gets a search criterion default value.
 java.lang.String getTag()
          Gets the tag.
 java.lang.String getWhereClause()
          Gets the Hibernate where clause.
 Work getWork()
          Gets the work.
 int hashCode()
          Returns a hash code for the object.
 void setArg(org.hibernate.Query q, org.hibernate.Session session)
          Sets the Hibernate query argument.
 void setDescription(java.lang.String description)
          Sets the role description.
 void setGender(byte gender)
          Sets the gender.
 void setGender(Gender gender)
          Sets the gender.
 void setMortality(byte mortality)
          Sets the mortality.
 void setMortality(Mortality mortality)
          Sets the mortality.
 void setName(java.lang.String name)
          Sets the English name.
 void setOriginalName(Spelling originalName)
          Sets the name in the original language.
 void setTag(java.lang.String tag)
          Sets the tag.
 void setWork(Work work)
          Sets the work.
 java.lang.String toString()
          Gets a string representation of the speaker.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Speaker

public Speaker()
Creates a new speaker.

Method Detail

getId

public java.lang.Long getId()
Gets the unique id.

Specified by:
getId in interface PersistentObject
Returns:
The unique id.

getWork

public Work getWork()
Gets the work.

Returns:
The work.

setWork

public void setWork(Work work)
Sets the work.

Parameters:
work - The work.

getTag

public java.lang.String getTag()
Gets the tag.

Returns:
The tag.

setTag

public void setTag(java.lang.String tag)
Sets the tag.

Parameters:
tag - The tag.

getName

public java.lang.String getName()
Gets the English name.

Returns:
The English name.

setName

public void setName(java.lang.String name)
Sets the English name.

Parameters:
name - The English name.

getOriginalName

public Spelling getOriginalName()
Gets the name in the original language.

Returns:
The name in the original language.

setOriginalName

public void setOriginalName(Spelling originalName)
Sets the name in the original language.

Parameters:
originalName - The name in the original language.

getDescription

public java.lang.String getDescription()
Gets the role description.

Returns:
The role description.

setDescription

public void setDescription(java.lang.String description)
Sets the role description.

Parameters:
description - The role description.

getGender

public Gender getGender()
Gets the gender.

Returns:
The gender.

setGender

public void setGender(Gender gender)
Sets the gender.

Parameters:
gender - The gender.

setGender

public void setGender(byte gender)
Sets the gender.

Parameters:
gender - The gender.

getMortality

public Mortality getMortality()
Gets the mortality.

Returns:
The mortality.

setMortality

public void setMortality(Mortality mortality)
Sets the mortality.

Parameters:
mortality - The mortality.

setMortality

public void setMortality(byte mortality)
Sets the mortality.

Parameters:
mortality - The mortality.

getSearchDefault

public SearchCriterion getSearchDefault(java.lang.Class cls)
Gets a search criterion default value.

Specified by:
getSearchDefault in interface SearchDefaults
Parameters:
cls - Model class of search criterion.
Returns:
Default value for search criterion.

getJoinClass

public java.lang.Class getJoinClass()
Gets the join class.

Specified by:
getJoinClass in interface SearchCriterion
Returns:
The join class, or null if none.

getWhereClause

public java.lang.String getWhereClause()
Gets the Hibernate where clause.

Specified by:
getWhereClause in interface SearchCriterion
Returns:
The Hibernate where clause.

setArg

public void setArg(org.hibernate.Query q,
                   org.hibernate.Session session)
Sets the Hibernate query argument.

Specified by:
setArg in interface SearchCriterion
Parameters:
q - Hibernate query.
session - Hibernate session.

appendDescription

public void appendDescription(TextLine line,
                              FontInfo romanFontInfo,
                              FontInfo[] fontInfo)
Appends a description to a text line.

Specified by:
appendDescription in interface SearchCriterion
Parameters:
line - Text line.
romanFontInfo - Roman font info.
fontInfo - Array of font info indexed by character set.

getReportPhrase

public java.lang.String getReportPhrase()
Gets the report phrase.

Specified by:
getReportPhrase in interface GroupingObject
Returns:
The report phrase "spoken by".

getGroupingSpelling

public Spelling getGroupingSpelling(int numHits)
Gets the spelling of the grouping object.

Specified by:
getGroupingSpelling in interface GroupingObject
Parameters:
numHits - Number of hits.
Returns:
The spelling of the grouping object.

getGroupingObjects

public void getGroupingObjects(java.lang.Class groupBy,
                               java.util.List list)
Gets grouping objects.

Parameters:
groupBy - Grouping class.
list - A list. The grouping objects are appended to this list.

toString

public java.lang.String toString()
Gets a string representation of the speaker.

Overrides:
toString in class java.lang.Object
Returns:
The name.

equals

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

The two speakers are equal if their works and names are equal.

Specified by:
equals in interface GroupingObject
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.

Specified by:
hashCode in interface GroupingObject
Overrides:
hashCode in class java.lang.Object
Returns:
The hash code.