|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectSensorComparator
public abstract class SensorComparator
Superclass of our various Comparator objects. The instantiation
of a child of this class will specify:
1. compare() (per the Comparator interface requirements)
2. doubleValue() Returns the corresponding value of the from the FinchSensor
3. toString() Returns a string that describes the child
Constructor Summary | |
---|---|
SensorComparator()
|
Method Summary | |
---|---|
protected static double |
arrayMagnitude(double[] vec)
Compute the magnitude (or length) of a vector (specifically, the L2 norm) |
protected static int |
compare(double a,
double b)
Quick method used to compare doubles |
protected static int |
compare(int a,
int b)
Quick method used to compare integers a and b |
abstract double |
doubleValue(FinchSensor obj)
Return the value of obj that is specified by the instantiation of the child class. |
protected static int |
sum(int[] vals)
Return the sum over an array of ints |
abstract java.lang.String |
toString()
Force the child class to return a string that describes itself. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Comparator |
---|
compare, equals |
Constructor Detail |
---|
public SensorComparator()
Method Detail |
---|
protected static int compare(int a, int b)
a
- b
-
a
is greater than b
, -1 if
the reverse is true, and 0 if they are equalprotected static int compare(double a, double b)
a
- b
-
a
is greater than b
, -1 if
the reverse is true, and 0 if they are equalprotected static int sum(int[] vals)
vals
- Array of integers
protected static double arrayMagnitude(double[] vec)
vec
- An array of doubles
public abstract double doubleValue(FinchSensor obj)
obj
- A FinchSensor sample
public abstract java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |