edu.northwestern.at.wordhoard.model.wrappers
Class Spelling

java.lang.Object
  extended by edu.northwestern.at.wordhoard.model.wrappers.Spelling
All Implemented Interfaces:
GroupingObject, java.io.Serializable, java.lang.Comparable

public class Spelling
extends java.lang.Object
implements GroupingObject, java.io.Serializable, java.lang.Comparable

A spelling.

A spelling is a unicode string of text plus the character set used by the string.

See Also:
Serialized Form

Constructor Summary
Spelling()
          Creates a new spelling object.
Spelling(java.lang.String string, byte charset)
          Creates a new spelling object.
Spelling(java.lang.String string, int charset)
          Creates a new spelling object.
 
Method Summary
 int compareTo(java.lang.Object obj)
          Implement Comparable interface.
 boolean equals(java.lang.Object obj)
          Returns true if this object is equal to some other object.
 boolean equalsIgnoreCase(java.lang.Object obj)
          Returns true if this object is equal to some other object in a case insensitive fashion.
 boolean equalsInsensitive(java.lang.Object obj)
          Returns true if this object is equal to some other object in a case and diacritical insensitive fashion.
 byte getCharset()
          Gets the character set.
 Spelling getGroupingSpelling(int numHits)
          Gets the spelling of the grouping object.
 java.lang.String getReportPhrase()
          Gets the report phrase.
 java.lang.String getString()
          Gets the string.
 int hashCode()
          Returns a hash code for the object.
 Spelling toInsensitive()
          Gets case and diacritical insensitive version of this spelling.
 java.lang.String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Spelling

public Spelling()
Creates a new spelling object.


Spelling

public Spelling(java.lang.String string,
                byte charset)
Creates a new spelling object.

Parameters:
string - String.
charset - Character set.

Spelling

public Spelling(java.lang.String string,
                int charset)
Creates a new spelling object.

Parameters:
string - String.
charset - Character set.
Method Detail

getString

public java.lang.String getString()
Gets the string.

Returns:
The string.

getCharset

public byte getCharset()
Gets the character set.

Returns:
The character set.

getReportPhrase

public java.lang.String getReportPhrase()
Gets the report phrase.

Specified by:
getReportPhrase in interface GroupingObject
Returns:
The report phrase "with spelling".

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.

toInsensitive

public Spelling toInsensitive()
Gets case and diacritical insensitive version of this spelling.

Returns:
The case and diacritical insensitive spelling.

toString

public java.lang.String toString()
Returns a string representation of the object.

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

equals

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

The spellings are equal if their strings are identical and they have the same character set.

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.

equalsIgnoreCase

public boolean equalsIgnoreCase(java.lang.Object obj)
Returns true if this object is equal to some other object in a case insensitive fashion.

The spellings are equal if their strings are identical except ignoring case and they have the same character set.

Parameters:
obj - The other object.
Returns:
True if this object equals the other object, except for case.

equalsInsensitive

public boolean equalsInsensitive(java.lang.Object obj)
Returns true if this object is equal to some other object in a case and diacritical insensitive fashion.

The spellings are equal if their strings are identical except ignoring case and diacritics and if they have the same character set.

Parameters:
obj - The other object.
Returns:
True if this object equals the other object, except for case and diacritics.

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.

compareTo

public int compareTo(java.lang.Object obj)
Implement Comparable interface.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
obj - Other spelling object to which to compare this object.