com.aliasi.util
Class ScoredObject<E>

java.lang.Object
  extended by com.aliasi.util.ScoredObject<E>
All Implemented Interfaces:
Scored

public class ScoredObject<E>
extends Object
implements Scored

A ScoredObject provides an implementation of the Scored interface with an attached object. Scored objects are immutable and identity is reference. The object returned by the getter getObject() is the actual object stored, so changes to it will affect the scored object of which it is a part.

Since:
LingPipe2.0
Version:
3.0
Author:
Bob Carpenter

Field Summary
 
Fields inherited from interface com.aliasi.util.Scored
REVERSE_SCORE_COMPARATOR, SCORE_COMPARATOR
 
Constructor Summary
ScoredObject(E obj, double score)
          Construct a scored object from the specified object and score.
 
Method Summary
 E getObject()
          Returns the object attached to this scored object.
 double score()
          Returns the score for this scored object.
 String toString()
          Returns a string-based representation of this object consisting of the score followed by a colon (':'), followed by the object converted to a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ScoredObject

public ScoredObject(E obj,
                    double score)
Construct a scored object from the specified object and score.

Parameters:
obj - Object for the constructed scored object.
score - Score for the constructed scored object.
Method Detail

getObject

public E getObject()
Returns the object attached to this scored object.

Returns:
The object attached to this scored object.

score

public double score()
Returns the score for this scored object.

Specified by:
score in interface Scored
Returns:
The score for this scored object.

toString

public String toString()
Returns a string-based representation of this object consisting of the score followed by a colon (':'), followed by the object converted to a string.

Overrides:
toString in class Object
Returns:
The string-based representation of this object.