edu.northwestern.at.wordhoard.model.userdata
Class Phrase

java.lang.Object
  extended by edu.northwestern.at.wordhoard.model.userdata.Phrase
All Implemented Interfaces:
java.io.Serializable

public class Phrase
extends java.lang.Object
implements java.io.Serializable

A phrase.

A phrase contains an ordered list of adjacent words.

See Also:
Serialized Form

Field Summary
protected  java.lang.Long id
          Unique persistence id (primary key).
protected  int tagsHashCode
          A hash code for the word tags.
protected  java.util.List wordTags
          The words in the phrase, in order.
protected  java.lang.String workTag
          The tag of the work in which this phrase occurs.
 
Constructor Summary
Phrase()
          Create an empty phrase.
Phrase(java.lang.String[] wordTags, java.lang.String workTag)
          Create a phrase with specified word tags.
Phrase(Word[] words)
          Create a phrase with specified words.
 
Method Summary
protected  void addWordTags(java.lang.String[] wordTags, java.lang.String workTag)
          Add word tags.
 void clear()
          Clears the phrase.
 boolean equals(java.lang.Object obj)
          Returns true if some other phrase is equal to this one.
 java.lang.Long getId()
          Gets the unique id.
 java.lang.String getTag()
          Gets a tag for the phrase.
protected  int getTagsHashCode()
          Get hash code for word tags.
 java.util.List getWordTags()
          Gets word tags.
 java.lang.String getWorkTag()
          Get work tag.
 int hashCode()
          Returns a hash code for the object.
 java.lang.String toString()
          Gets a string representation of the phrase.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

id

protected java.lang.Long id
Unique persistence id (primary key).


wordTags

protected java.util.List wordTags
The words in the phrase, in order.


workTag

protected java.lang.String workTag
The tag of the work in which this phrase occurs.


tagsHashCode

protected int tagsHashCode
A hash code for the word tags.

Constructor Detail

Phrase

public Phrase()
Create an empty phrase.


Phrase

public Phrase(Word[] words)
Create a phrase with specified words.

Parameters:
words - The words in the phrase.

Phrase

public Phrase(java.lang.String[] wordTags,
              java.lang.String workTag)
Create a phrase with specified word tags.

Parameters:
wordTags - The word tags of the words in the phrase.
Method Detail

addWordTags

protected void addWordTags(java.lang.String[] wordTags,
                           java.lang.String workTag)
Add word tags.

Parameters:
wordTags - The word tags of the words in the phrase.
workTag - The work tag for the words.

getId

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

Returns:
The unique id.

getWordTags

public java.util.List getWordTags()
Gets word tags.

Returns:
The word tags.

getWorkTag

public java.lang.String getWorkTag()
Get work tag.

Returns:
Tag of work in which this phrase occurs.

getTagsHashCode

protected int getTagsHashCode()
Get hash code for word tags.

Returns:
Hash code.

clear

public void clear()
Clears the phrase.


getTag

public java.lang.String getTag()
Gets a tag for the phrase.

Returns:
The word tags in the phrase set, in order.

toString

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

Overrides:
toString in class java.lang.Object
Returns:
The word tags in the phrase set.

equals

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

The two phrases are equal if their word tag lists are equal.

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.

Overrides:
hashCode in class java.lang.Object
Returns:
The hash code.