|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectFinchSensor
public class FinchSensor
Representation of a single sample of sensor values from the Finch. In particular, a sample contains:
Field Summary | |
---|---|
private double[] |
acceleration
Holds the array of acceleration values |
private int[] |
light
Holds the array of light values |
private boolean[] |
obstacle
Holds the array of obstacle values |
private double |
temperature
Holds the temperature value |
Constructor Summary | |
---|---|
FinchSensor(int[] light,
double[] acceleration,
boolean[] obstacle,
double temperature)
Primary constructor |
Method Summary | |
---|---|
private double |
arrayMagnitude(double[] vec)
Compute the magnitude (or length) of a vector (specifically, the L2 norm) |
private int |
compareTo(double a,
double b)
Method used to compare doubles |
private int |
compareTo(int a,
int b)
Method is used to compare integers a and b |
int |
compareTo2(java.lang.Object obj,
VariableType var)
Compare two objects based on a specific member variable (specified by parameter var) |
java.lang.String |
toString()
Overriding the Object toString method |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private int[] light
private double[] acceleration
private boolean[] obstacle
private double temperature
Constructor Detail |
---|
public FinchSensor(int[] light, double[] acceleration, boolean[] obstacle, double temperature)
light
- 2-element array of light levelsacceleration
- 3-element array of acceleration valuesobstacle
- 2-element array of obstacle valuestemperature
- TemperatureMethod Detail |
---|
private int compareTo(int a, int b)
a
- b
-
a
is greater than b
, -1 if
the reverse is true, and 0 if they are equalprivate int compareTo(double a, double b)
a
- b
-
a
is greater than b
, -1 if
the reverse is true, and 0 if they are equalprivate double arrayMagnitude(double[] vec)
vec
- An array of doubles
public int compareTo2(java.lang.Object obj, VariableType var)
compareTo2
in interface Comparable2
obj
- The passed object to compare againstvar
- The key to compare with
public 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 |