de.dfki.mycbr.core.similarity
Class Similarity

java.lang.Object
  extended by de.dfki.mycbr.core.similarity.Similarity

public class Similarity
extends java.lang.Object

Represents similarity values. Similarity values should be within the range [0.00, 1.00] and are rounded to 2 digits after the decimal point. If the value is not within the given range, the similarity value is represented by the string NaN. The double value of this similarity is usually set to -1.00 and referred to as an invalid similarity.

Author:
myCBR Team

Field Summary
static Similarity INVALID_SIM
           
 
Method Summary
 boolean equals(Similarity sim)
          Compares this to another similarity.
static Similarity get(java.lang.Double d)
          Initializes this with d
 double getRoundedValue()
          Rounds the value of this similarity to two decimal digits
 double getValue()
          Get the value of this similarity
 java.lang.String toString()
          Returns string representation of this similarity.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

INVALID_SIM

public static final Similarity INVALID_SIM
Method Detail

get

public static Similarity get(java.lang.Double d)
Initializes this with d

Parameters:
d - value of this similarity

getRoundedValue

public double getRoundedValue()
Rounds the value of this similarity to two decimal digits


getValue

public double getValue()
Get the value of this similarity

Returns:
the value of this similarity

toString

public java.lang.String toString()
Returns string representation of this similarity. If the given value lies within the range [0.00;1.00] returns Double.toString() else NaN.

Overrides:
toString in class java.lang.Object
Returns:
String representing the value of this similarity

equals

public boolean equals(Similarity sim)
Compares this to another similarity.

Returns:
true, if double value is equal, false otherwise