edu.stanford.math.plex4.utility
public class ComparisonUtility extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static double |
HIGH_PRECISION |
static double |
LOW_PRECISION |
static double |
MED_PRECISION |
Constructor and Description |
---|
ComparisonUtility() |
Modifier and Type | Method and Description |
---|---|
static boolean |
compareDoublesAbsolute(double a,
double b,
double tolerance)
This function compares two doubles to see if they are within the specified
tolerance of each other.
|
static boolean |
compareDoublesGuardedRelative(double a,
double b,
double tolerance)
This function compares two doubles to see if their (relative/absolute) distance
is within the specified tolerance.
|
static boolean |
compareDoublesRelative(double a,
double b,
double tolerance)
This function compares two doubles to see if their relative distance is within the
specified tolerance.
|
static gnu.trove.TIntHashSet |
intersect(gnu.trove.TIntHashSet a,
gnu.trove.TIntHashSet b)
This function computes the intersection of two sets.
|
static boolean |
setEquals(java.util.Collection<?> a,
java.util.Collection<?> b)
This function returns true if two Collections define the same set;
that is they contain the same elements.
|
static boolean |
setEquals(gnu.trove.TIntHashSet a,
gnu.trove.TIntHashSet b)
This function returns true if the two sets of integers contain the
same elements.
|
public static final double LOW_PRECISION
public static final double MED_PRECISION
public static final double HIGH_PRECISION
public static boolean setEquals(java.util.Collection<?> a, java.util.Collection<?> b)
a
- the first Collectionb
- the second Collectionpublic static boolean setEquals(gnu.trove.TIntHashSet a, gnu.trove.TIntHashSet b)
a
- b
- public static gnu.trove.TIntHashSet intersect(gnu.trove.TIntHashSet a, gnu.trove.TIntHashSet b)
a
- b
- public static boolean compareDoublesAbsolute(double a, double b, double tolerance)
a
- the first valueb
- the second valuetolerance
- the tolerancepublic static boolean compareDoublesRelative(double a, double b, double tolerance)
a
- the first valueb
- the second valuetolerance
- the tolerancepublic static boolean compareDoublesGuardedRelative(double a, double b, double tolerance)
a
- the first valueb
- the second valuetolerance
- the tolerance