sbrt.kernel.math
Class DoubleEquiv

java.lang.Object
  extended by sbrt.kernel.math.DoubleEquiv
All Implemented Interfaces:
EquivTester<java.lang.Double>

public class DoubleEquiv
extends java.lang.Object
implements EquivTester<java.lang.Double>

This class is used to compare double precision numbers for equivalence.

Author:
This class was written and documented by Jeremiah Wright while in the Wagner lab.

Constructor Summary
DoubleEquiv(double tolerance)
          Creates a new double precision number equivalence tester with the provided tolerance.
 
Method Summary
 boolean areEquiv(double value1, double value2)
          Indicates if the provided values are equivalent.
 boolean areEquiv(java.lang.Double value1, java.lang.Double value2)
          Indicates if the provided values are equivalent.
 double getTolerance()
          Returns the tolerance used by this equivalence tester.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DoubleEquiv

public DoubleEquiv(double tolerance)
Creates a new double precision number equivalence tester with the provided tolerance.

Parameters:
tolerance - the maximum amount by which two doubles can differ, but still be considered equivalent.
Method Detail

getTolerance

public double getTolerance()
Returns the tolerance used by this equivalence tester.

Returns:
the maximum amount by which two doubles can differ, but still be considered equivalent.

areEquiv

public boolean areEquiv(java.lang.Double value1,
                        java.lang.Double value2)
Indicates if the provided values are equivalent.

Specified by:
areEquiv in interface EquivTester<java.lang.Double>
Parameters:
value1 - a value.
value2 - a value.
Returns:
true if the provided values are equivalent, false otherwise.

areEquiv

public boolean areEquiv(double value1,
                        double value2)
Indicates if the provided values are equivalent.

Parameters:
value1 - a value.
value2 - a value.
Returns:
true if the provided values are equivalent, false otherwise.