edu.northwestern.at.wordhoard.model
Class Work

java.lang.Object
  extended by edu.northwestern.at.wordhoard.model.WorkPart
      extended by edu.northwestern.at.wordhoard.model.Work
All Implemented Interfaces:
CanCountWords, CanGetRelFreq, GroupingObject, HasTag, PersistentObject, SearchCriterion, SearchDefaults, java.io.Serializable

public class Work
extends WorkPart
implements GroupingObject, SearchDefaults, SearchCriterion, CanGetRelFreq, java.io.Serializable, HasTag

A work.

Each work has the following attributes in addition to those defined for work parts.

See Also:
Serialized Form

Constructor Summary
Work()
          Creates a new work.
 
Method Summary
 void addAuthor(Author author)
          Adds an author.
 void addAuthors(Author[] authors)
          Adds an array of authors.
 void addAuthors(java.util.Collection authors)
          Adds a collection of authors.
 void addSpeaker(Speaker speaker)
          Adds a speaker.
 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.util.Set getAuthors()
          Gets the authors.
 Corpus getCorpus()
          Gets the corpus.
 java.lang.String getFullTitleWithDate()
          Gets the full title with date.
 GroupingObject getGroupingObject(int groupingOption)
          Gets a grouping object.
 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.Class getJoinClass()
          Gets the join class.
 java.lang.Class getLemmaJoinClass()
           
 java.lang.String getLemmaWhereClause()
           
 java.util.List getParts()
          Gets all the parts of the work.
 java.util.List getPartsWithText()
          Gets all the parts of the work with text.
 PubYearRange getPubDate()
          Gets the publication date(s).
 SearchCriterion getSearchDefault(java.lang.Class cls)
          Gets a search criterion default value.
 java.lang.String getShortTitleWithDate()
          Gets the short title with date.
 java.util.Set getSpeakers()
          Gets the speakers.
 java.lang.String getWhereClause()
          Gets the Hibernate where clause.
 int hashCode()
          Returns a hash code for the object.
 void removeAuthor(Author author)
          Removes an author.
 void setArg(org.hibernate.Query q, org.hibernate.Session session)
          Sets the Hibernate query argument.
 void setCorpus(Corpus corpus)
          Sets the corpus.
 void setPubDate(PubYearRange pubDate)
          Sets the publication date(s).
 java.lang.String toString()
          Gets a string representation of the work.
 
Methods inherited from class edu.northwestern.at.wordhoard.model.WorkPart
addChild, addTranslation, appendDescendants, appendDescendantsWithText, getAvailableTranslations, getChildByShortTitle, getChildren, getFirstDescendantWithText, getFullTitle, getHasChildren, getHasStanzaNumbers, getId, getNumChildren, getNumLines, getNumWords, getNumWorkPartsTree, getParent, getPath, getPathTag, getPrimaryText, getRelFreq, getReportPhrase, getShortTitle, getTag, getTaggingData, getTranslations, getWork, getWorkOrdinal, isActive, removeChild, setActive, setFullTitle, setHasStanzaNumbers, setId, setNumLines, setNumWords, setPathTag, setPrimaryText, setShortTitle, setTag, setTaggingData, setWork, setWorkOrdinal
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface edu.northwestern.at.wordhoard.model.grouping.GroupingObject
getReportPhrase
 
Methods inherited from interface edu.northwestern.at.wordhoard.model.CanGetRelFreq
getRelFreq
 
Methods inherited from interface edu.northwestern.at.wordhoard.model.HasTag
getTag
 

Constructor Detail

Work

public Work()
Creates a new work.

Method Detail

getCorpus

public Corpus getCorpus()
Gets the corpus.

Returns:
The corpus.

setCorpus

public void setCorpus(Corpus corpus)
Sets the corpus.

Parameters:
corpus - The corpus.

getPubDate

public PubYearRange getPubDate()
Gets the publication date(s).

Returns:
The publication date(s), or null if not known.

setPubDate

public void setPubDate(PubYearRange pubDate)
Sets the publication date(s).

Parameters:
pubDate - The publication date(s), or null if not known.

getAuthors

public java.util.Set getAuthors()
Gets the authors.

Returns:
The authors, as an unmodifiable set.

addAuthor

public void addAuthor(Author author)
Adds an author.

Parameters:
author - Author.

removeAuthor

public void removeAuthor(Author author)
Removes an author.

Parameters:
author - Author.

addAuthors

public void addAuthors(java.util.Collection authors)
Adds a collection of authors.

Parameters:
authors - Authors.

addAuthors

public void addAuthors(Author[] authors)
Adds an array of authors.

Parameters:
authors - Authors.

getSpeakers

public java.util.Set getSpeakers()
Gets the speakers.

Returns:
The speakers, as an unmodifiable set.

addSpeaker

public void addSpeaker(Speaker speaker)
Adds a speaker.

Parameters:
speaker - Speaker.

getPartsWithText

public java.util.List getPartsWithText()
Gets all the parts of the work with text.

Returns:
A list of all the parts of the work which have text.

getParts

public java.util.List getParts()
Gets all the parts of the work.

Returns:
A list of all the parts of the work.

getSearchDefault

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

Specified by:
getSearchDefault in interface SearchDefaults
Overrides:
getSearchDefault in class WorkPart
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
Overrides:
getJoinClass in class WorkPart
Returns:
The join class, or null if none.

getLemmaJoinClass

public java.lang.Class getLemmaJoinClass()

getWhereClause

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

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

getLemmaWhereClause

public java.lang.String getLemmaWhereClause()

setArg

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

Specified by:
setArg in interface SearchCriterion
Overrides:
setArg in class WorkPart
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
Overrides:
appendDescription in class WorkPart
Parameters:
line - Text line.
romanFontInfo - Roman font info.
fontInfo - Array of font info indexed by character set.

getGroupingSpelling

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

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

getFullTitleWithDate

public java.lang.String getFullTitleWithDate()
Gets the full title with date.

Returns:
Full title with date.

getShortTitleWithDate

public java.lang.String getShortTitleWithDate()
Gets the short title with date.

Returns:
Short title with date.

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.

getGroupingObject

public GroupingObject getGroupingObject(int groupingOption)
Gets a grouping object.

Returns the work, lemma, part of speech, or spelling, given a grouping option.

Parameters:
groupingOption - Grouping option.
Returns:
Grouping object.

equals

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

The two works are equal if their tags are equal.

Specified by:
equals in interface GroupingObject
Overrides:
equals in class WorkPart
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 WorkPart
Returns:
The hash code.

toString

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

Overrides:
toString in class WorkPart
Returns:
The short title.