edu.northwestern.at.utils
Class ScoredString

java.lang.Object
  extended by edu.northwestern.at.utils.ScoredString
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable
Direct Known Subclasses:
StyledScoredString

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

Associates a string with a score.

See Also:
Serialized Form

Field Summary
protected  double score
          The string score.
protected  java.lang.String string
          The string.
 
Constructor Summary
ScoredString()
          Create scored string.
ScoredString(java.lang.String string, double score)
          Create scored string.
 
Method Summary
 int compareTo(java.lang.Object other)
          Compare this scored string with another.
 boolean equals(java.lang.Object other)
          Check if another object is equal to this one.
 double getScore()
          Get score.
 java.lang.String getString()
          Get string.
 void putString(java.lang.String string)
          Set string.
 void setScore(double score)
          Set score.
 java.lang.String toString()
          Generate displayable string.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

string

protected java.lang.String string
The string.


score

protected double score
The string score.

Constructor Detail

ScoredString

public ScoredString()
Create scored string.


ScoredString

public ScoredString(java.lang.String string,
                    double score)
Create scored string.

Parameters:
string - String.
score - Score.
Method Detail

getString

public java.lang.String getString()
Get string.

Returns:
The string.

putString

public void putString(java.lang.String string)
Set string.

Parameters:
string - The string.

getScore

public double getScore()
Get score.

Returns:
The score.

setScore

public void setScore(double score)
Set score.

Parameters:
score - The score.

toString

public java.lang.String toString()
Generate displayable string.

Overrides:
toString in class java.lang.Object
Returns:
String followed by score in parentheses.

equals

public boolean equals(java.lang.Object other)
Check if another object is equal to this one.

Overrides:
equals in class java.lang.Object
Parameters:
other - Other object to test for equality.
Returns:
true if other object is equal to this one.

compareTo

public int compareTo(java.lang.Object other)
Compare this scored string with another.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
other - The other scored string
Returns:
< 0 if this scored string is less than the other, = 0 if the two scored strings are equal, > 0 if this scored string is greater than the other.