com.ibm.websphere.fabric.da.types
Class Score

java.lang.Object
  extended by com.ibm.websphere.fabric.da.types.Score
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable

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

Represents a score, usually that of a fuzzy match. All concrete subclasses of score must implement asDouble() so that multiple instances of the same type may be managed by DA algorithms. These types may provide other methods that give further details of the score and perhaps even details of the derivation of the score.

The units of score values are left entirely to the implementation, but the scale is between 0 and 1.

Instances of this type are immutable, and therefore thread-safe.

Scores, while comparable, do not implement meaningful Object.equals(Object) and Object.hashCode(). Thus, they are not intended to be used as keys of hash-based maps.

Since:
WBSF 6.0.2
Version:
$Id: $
Author:
dranatunga
See Also:
Serialized Form

Field Summary
static float EPSILON
          Deprecated. use the double precision version, EPSILON_AS_DOUBLE. Using this version in mathematical operations with double precision values may result in undesired loss of precision. The precision below which differences in scores are considered negligible.
static double EPSILON_AS_DOUBLE
           
 
Constructor Summary
Score()
           
 
Method Summary
 double asDouble()
           
 int compareTo(java.lang.Object obj)
           
abstract  float getScore()
          Deprecated. use of float frequently incurs loss of precision for standard numerical comparisons that DAs are interested in. Use asDouble() instead.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EPSILON

public static final float EPSILON
Deprecated. use the double precision version, EPSILON_AS_DOUBLE. Using this version in mathematical operations with double precision values may result in undesired loss of precision. The precision below which differences in scores are considered negligible.
See Also:
Constant Field Values

EPSILON_AS_DOUBLE

public static final double EPSILON_AS_DOUBLE
See Also:
Constant Field Values
Constructor Detail

Score

public Score()
Method Detail

getScore

public abstract float getScore()
Deprecated. use of float frequently incurs loss of precision for standard numerical comparisons that DAs are interested in. Use asDouble() instead.

Returns:
a score between 0.0f and 1.0f inclusive.

asDouble

public double asDouble()
Returns:
the result of getScore() coerced to a double. Subsclasses that desire alternate behavior with a higher level of precision are expected to override this method.
Since:
WBSF 6.1.0

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

compareTo

public int compareTo(java.lang.Object obj)
Specified by:
compareTo in interface java.lang.Comparable


Copyright © 2002-2009 IBM. All Rights Reserved.