|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectsensorDriver
public class sensorDriver
The main driver for Lab 4
Field Summary | |
---|---|
static int |
numSamples
Total number of samples to take |
static int |
sampleInterval
Interval between samples (note that there is also other overhead that extends this delay) |
Constructor Summary | |
---|---|
sensorDriver()
|
Method Summary | |
---|---|
static void |
displaySensors(java.util.List<FinchSensor> sensors)
Display the sequence of sensor samples in the given List Algorithm: - Loop over each sensor in the List and display it |
static void |
displayStats(java.util.List<FinchSensor> log,
SensorComparator comp)
For the given sensor channel (as indicated by comp), display: The mean value of this sensor channel the entire sensor sample for the minimum, median and maximum channel values Algorithm: 1. |
static void |
main(java.lang.String[] args)
The main method Algorithm: 1. |
static double |
mean(java.util.List<FinchSensor> log,
SensorComparator comp)
Compute the mean value of a some sensor value across a set of FinchSensors. |
static FinchSensor |
median(java.util.List<FinchSensor> log)
Return the sensor sample that is the median value of the key used to sort a set. |
static java.util.List<FinchSensor> |
ReadSensors(finch.Finch myFinch)
Read a sequence of samples from the Finch sensors |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int numSamples
public static final int sampleInterval
Constructor Detail |
---|
public sensorDriver()
Method Detail |
---|
public static FinchSensor median(java.util.List<FinchSensor> log)
Algorithm:
The median sample is the middle one given that the set has already been ordered.
log
- A set of FinchSensors, already sorted by some key
public static double mean(java.util.List<FinchSensor> log, SensorComparator comp)
Algorithm: Return the sum of the channel values divided by the number of samples.
log
- A set of FinchSensorscomp
- A SensorComparator that specifies the key
public static void displayStats(java.util.List<FinchSensor> log, SensorComparator comp)
Algorithm:
1. Sort the elements of log according to comp
2. Report the mean of the sensor value
3. Given the ordering of the sorted list, we can pull out the
min, median and max sensor samples by extracting the first, middle and
last elements in the list.
log
- A valid list of Finch sensor samplescomp
- The sensor channel on which to organize the list
public static void displaySensors(java.util.List<FinchSensor> sensors)
Algorithm:
- Loop over each sensor in the List and display it
sensors
- A List of sensor samplespublic static java.util.List<FinchSensor> ReadSensors(finch.Finch myFinch)
myFinch
- Reference to the finch object
public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |