edu.northwestern.at.wordhoard.model.morphology
Class WordClass

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

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

A word class.

A word class is a category of words. E.g., "noun", "proper noun", "verb", "modal verb", "adverb", "adjective", "article", etc. Each word class has three attributes, all of them strings:

Both English and Greek works and corpora share the same collection of word classes. This is unlike parts of speech, where we have different taxonomies for English and Greek.

See Also:
Serialized Form

Constructor Summary
WordClass()
          Creates a new word class.
 
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 description.
 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.
 MajorWordClass getMajorWordClass()
          Gets the major word class.
 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.
 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 description.
 void setMajorWordClass(MajorWordClass majorWordClass)
          Sets the major word class.
 void setTag(java.lang.String tag)
          Sets the tag.
 java.lang.String toString()
          Gets a string representation of the word class.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WordClass

public WordClass()
Creates a new word class.

Method Detail

getId

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

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

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.

getDescription

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

Returns:
The description.

setDescription

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

Parameters:
description - Description.

getMajorWordClass

public MajorWordClass getMajorWordClass()
Gets the major word class.

Returns:
The major word class.

setMajorWordClass

public void setMajorWordClass(MajorWordClass majorWordClass)
Sets the major word class.

Parameters:
majorWordClass - Major word class.

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 "with word class".

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 word class.

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

equals

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

The two word classes are equal if their tags 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.