|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.northwestern.at.wordhoard.model.WorkPart
public class WorkPart
A work part.
Works are divided into parts which form a tree.
Here's some examples of how works might be divided into parts:
Each work part has the following attributes:
work
of which this is a part.
Note that each work and work part has both a short title and a full title. The different titles are used in different contexts. For example, for Shakespeare's Hamlet, the full title is "Hamlet, Prince of Denmark", while the short title is just "Hamlet". The full title of act 1, scene 2 is "Act 1, Scene 2", while the short title is just "Scene 2".
The tag is required. It permanently and uniquely identifies the work part across all corpora. It may be used to refer to the work part from outside the object model. It is guaranteed not to change across versions of the object model. For example, the tag for Hamlet (the root of the work part tree for Hamlet) is "sha-ham", and the tag for Hamlet Act 3, Scene 2 is "sha-ham-3-2".
The path tag is optional but usually present. Path tags are used to build short "path" strings that identify parts - e.g., "ham.3.2" for Hamlet Act 3, Scene 2, or "can.mil.p" for the prologue to The Miller's Tale.
Constructor Summary | |
---|---|
WorkPart()
Creates a new work part. |
Method Summary | |
---|---|
void |
addChild(WorkPart child)
Adds a child. |
void |
addTranslation(java.lang.String name,
TextWrapper translation)
Adds a translation. |
void |
appendDescendants(java.util.List list)
Appends all of the descendants to a list. |
void |
appendDescendantsWithText(java.util.List list)
Appends all of the descendants which have text to a list. |
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.List |
getAvailableTranslations()
Gets the available translations. |
WorkPart |
getChildByShortTitle(java.lang.String title)
Gets a child by short title. |
java.util.List |
getChildren()
Gets the children. |
WorkPart |
getFirstDescendantWithText()
Gets the first descendant part with text. |
java.lang.String |
getFullTitle()
Gets the full title. |
Spelling |
getGroupingSpelling(int numHits)
Gets the spelling of the grouping object. |
boolean |
getHasChildren()
Returns true if this part has any children. |
boolean |
getHasStanzaNumbers()
Returns true if the text has stanza numbers. |
java.lang.Long |
getId()
Gets the unique id. |
java.lang.Class |
getJoinClass()
Gets the join class. |
int |
getNumChildren()
Gets the number of children. |
int |
getNumLines()
Gets the number of lines. |
int |
getNumWords()
Gets the number of words. |
int |
getNumWorkPartsTree()
Gets the number of work parts in the subtree rooted at this part. |
WorkPart |
getParent()
Gets the parent. |
java.lang.String |
getPath()
Gets the path string for the part. |
java.lang.String |
getPathTag()
Gets the path tag. |
TextWrapper |
getPrimaryText()
Gets the primary text. |
float |
getRelFreq(int count)
Gets the relative frequency of a word count. |
java.lang.String |
getReportPhrase()
Gets the report phrase. |
SearchCriterion |
getSearchDefault(java.lang.Class cls)
Gets a search criterion default value. |
java.lang.String |
getShortTitle()
Gets the short title. |
java.lang.String |
getTag()
Gets the tag. |
TaggingData |
getTaggingData()
Gets the tagging data flags. |
java.util.Map |
getTranslations()
Gets the translation map. |
java.lang.String |
getWhereClause()
Gets the Hibernate where clause. |
Work |
getWork()
Gets the work. |
int |
getWorkOrdinal()
Gets the work ordinal. |
int |
hashCode()
Returns a hash code for the object. |
boolean |
isActive()
Returns active state of item. |
void |
removeChild(WorkPart child)
Removes a child. |
void |
setActive(boolean isActive)
Sets active state of item. |
void |
setArg(org.hibernate.Query q,
org.hibernate.Session session)
Sets the Hibernate query argument. |
void |
setFullTitle(java.lang.String fullTitle)
Sets the full title. |
void |
setHasStanzaNumbers(boolean hasStanzaNumbers)
Sets the has stanza numbers flag. |
void |
setId(java.lang.Long id)
Sets the unique id. |
void |
setNumLines(int numLines)
Sets the number of lines. |
void |
setNumWords(int numWords)
Sets the number of words. |
void |
setPathTag(java.lang.String pathTag)
Sets the path tag. |
void |
setPrimaryText(TextWrapper primaryText)
Sets the primary text. |
void |
setShortTitle(java.lang.String shortTitle)
Sets the short title. |
void |
setTag(java.lang.String tag)
Sets the tag. |
void |
setTaggingData(TaggingData taggingData)
Sets the tagging data flags. |
void |
setWork(Work work)
Sets the work. |
void |
setWorkOrdinal(int workOrdinal)
Sets the work ordinal. |
java.lang.String |
toString()
Gets a string representation of the part. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public WorkPart()
Method Detail |
---|
public java.lang.Long getId()
getId
in interface PersistentObject
public void setId(java.lang.Long id)
id
- The unique id. public java.lang.String getTag()
getTag
in interface HasTag
public void setTag(java.lang.String tag)
tag
- The tag, or null if none. public java.lang.String getPathTag()
public void setPathTag(java.lang.String pathTag)
pathTag
- The path tag. public java.lang.String getShortTitle()
public void setShortTitle(java.lang.String shortTitle)
shortTitle
- The short title. public java.lang.String getFullTitle()
public void setFullTitle(java.lang.String fullTitle)
fullTitle
- The full title. public TaggingData getTaggingData()
public void setTaggingData(TaggingData taggingData)
taggingData
- Tagging data flags. public WorkPart getParent()
public Work getWork()
public void setWork(Work work)
work
- The work. public java.util.List getChildren()
public WorkPart getChildByShortTitle(java.lang.String title)
title
- Title.
public boolean getHasChildren()
public void addChild(WorkPart child)
The new child is added at the end of the ordered list of children.
child
- The new child. public void removeChild(WorkPart child)
child
- The child to remove. public int getNumChildren()
public TextWrapper getPrimaryText()
public void setPrimaryText(TextWrapper primaryText)
primaryText
- The primary text for the work part. public java.util.Map getTranslations()
public void addTranslation(java.lang.String name, TextWrapper translation)
name
- The name of the translation
(e.g., "English").translation
- The text of the translation. public java.util.List getAvailableTranslations()
public int getNumWorkPartsTree()
public int getWorkOrdinal()
public void setWorkOrdinal(int workOrdinal)
workOrdinal
- The ordinal of the part within its work. public int getNumLines()
public void setNumLines(int numLines)
numLines
- Number of lines in subtree rooted at this part. public int getNumWords()
public void setNumWords(int numWords)
numWords
- Number of words in subtree rooted at this part. public boolean getHasStanzaNumbers()
public void setHasStanzaNumbers(boolean hasStanzaNumbers)
hasStanzaNumbers
- True if the text has stanza numbers. public float getRelFreq(int count)
getRelFreq
in interface CanGetRelFreq
count
- Word count.
public WorkPart getFirstDescendantWithText()
public void appendDescendantsWithText(java.util.List list)
list
- The list. public void appendDescendants(java.util.List list)
list
- The list. public java.lang.String getPath()
public SearchCriterion getSearchDefault(java.lang.Class cls)
getSearchDefault
in interface SearchDefaults
cls
- Model class of search criterion.
public java.lang.Class getJoinClass()
getJoinClass
in interface SearchCriterion
public java.lang.String getWhereClause()
getWhereClause
in interface SearchCriterion
public void setArg(org.hibernate.Query q, org.hibernate.Session session)
setArg
in interface SearchCriterion
q
- Hibernate query.session
- Hibernate session. public void appendDescription(TextLine line, FontInfo romanFontInfo, FontInfo[] fontInfo)
appendDescription
in interface SearchCriterion
line
- Text line.romanFontInfo
- Roman font info.fontInfo
- Array of font info indexed by character
set. public java.lang.String getReportPhrase()
getReportPhrase
in interface GroupingObject
public Spelling getGroupingSpelling(int numHits)
getGroupingSpelling
in interface GroupingObject
numHits
- Number of hits.
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object obj)
The two work parts are equal if their works and their work ordinals are equal.
equals
in interface GroupingObject
equals
in class java.lang.Object
obj
- The other object.
public int hashCode()
hashCode
in interface GroupingObject
hashCode
in class java.lang.Object
public boolean isActive()
public void setActive(boolean isActive)
isActive
- Active state.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |