|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectptolemy.actor.util.FuzzyDoubleComparator
public class FuzzyDoubleComparator
Compare two Double objects with respect to a fuzzy threshold. The threshold is set by setThreshold(). If the difference of the two double number is less than the threshold, then they are considered equal. The default value of the fuzzy threshold is 1e-10.
After Ptolemy II 4.1, this class is not used any more. Use
GeneralComparator
instead.
Yellow (hyzheng) |
Yellow (liuj) |
Field Summary | |
---|---|
private double |
_threshold
Deprecated. The threshold that controls the fuzziness. |
Constructor Summary | |
---|---|
FuzzyDoubleComparator()
Deprecated. Construct a FuzzyDoubleComparator. |
|
FuzzyDoubleComparator(double threshold)
Deprecated. Construct a FuzzyDoubleComparator with the given threshold. |
Method Summary | |
---|---|
int |
compare(java.lang.Object first,
java.lang.Object second)
Deprecated. Return -1 if first < second - threshold/2; return 1 if first > second + threshold/2; return 0 otherwise. |
double |
getThreshold()
Deprecated. Return the fuzziness threshold. |
void |
setThreshold(double threshold)
Deprecated. Set the fuzziness threshold. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Comparator |
---|
equals |
Field Detail |
---|
private double _threshold
Constructor Detail |
---|
public FuzzyDoubleComparator()
public FuzzyDoubleComparator(double threshold)
threshold
- The thresholdMethod Detail |
---|
public int compare(java.lang.Object first, java.lang.Object second)
If any of the argument is not a Double object, a ClassCastException will be thrown.
compare
in interface java.util.Comparator
first
- The first Double object.second
- The second Double object.
public double getThreshold()
setThreshold(double)
public void setThreshold(double threshold)
threshold
- The threshold.getThreshold()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |