edu.northwestern.at.wordhoard.model.search
Interface SearchCriterion

All Known Implementing Classes:
Author, CollectionFrequency, Corpus, DocFrequency, Gender, Lemma, MajorWordClass, MetricalShape, Mortality, Narrative, PhraseSet, Pos, Prosodic, PubYearRange, SearchCriteriaTypedSet, Speaker, SpeakerName, SpellingWithCollationStrength, WordClass, WordSet, Work, WorkPart, WorkSet

public interface SearchCriterion

A word search criterion.


Method Summary
 void appendDescription(TextLine line, FontInfo romanFontInfo, FontInfo[] fontInfo)
          Appends a description to a text line.
 java.lang.Class getJoinClass()
          Gets the join class.
 java.lang.String getWhereClause()
          Gets the Hibernate where clause.
 void setArg(org.hibernate.Query q, org.hibernate.Session session)
          Sets the Hibernate query argument.
 

Method Detail

getJoinClass

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

Search criteria that involve word parts, speakers, or authors require a join in the HIbernate query. A criterion that requires such a join must return the class of the join (WordPart.class, Speaker.class, or Author.class).

For example, the Lemma class returns WordPart.class, the Gender class returns Speaker.class, and the Work class returns null.

Returns:
The join class, or null if none.

getWhereClause

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

All criteria may use the variable name "word".

The argument should be specified as a colon followed by the lower case argument name. For example, a prosodic criterion returns "word.prosodic = :prosodic". A corpus criterion returns "word.work.corpus = :corpus".

Criteria that require a join may use the variable names "wordPart", "speaker", and "author" in the where clause.

For example, a speaker gender criterion returns "speaker.gender = :gender", a part of speech criterion returns "wordPart.lemma.pos = :pos", and a work criterion returns "word.work = :work".

Returns:
The Hibernate where clause.

setArg

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

For example, a corpus criterion calls q.setEntity("corpus", this), a speaker name criterion calls q.setString("name", name), and a gender criterion calls q.setByte("gender", gender).

Parameters:
q - Hibernate query.
session - Hibernate session.

appendDescription

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

The description should be in the form "name = value". For example, a corpus criterion appends "corpus = xxx" where "xxx" is the corpus title.

Parameters:
line - Text line.
romanFontInfo - Roman font info.
fontInfo - Array of font info indexed by character set.