Class sensorDriver

java.lang.Object
  extended by sensorDriver

public class sensorDriver
extends java.lang.Object

The main driver for Lab 3

The responsibilities are:
Read a sequence of sensor samples from the Finch
Find the min, median and max samples for some sensor and report the sample
Repeat for different sensor streams

Author:
Andrew H. Fagg and Steven Ness

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(FinchSensor[] sensors)
          Display the sequence of sensor samples in the given array
static void displayStats(FinchSensor[] log, SensorType var)
          For the given sensor channel (as indicated by var), display the entire sensor sample for the minimum, median and maximum channel values
static void main(java.lang.String[] args)
          The main method
static FinchSensor[] ReadSensors(finch.Finch myFinch)
          Read a sequence of samples from the Finch sensors
static void sort(Comparable2[] list, VariableType var)
          Sort an array of Comparable2 objects Adopted from Listing 11.10 from "Introduction to Java Programming".
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

numSamples

public static final int numSamples
Total number of samples to take

See Also:
Constant Field Values

sampleInterval

public static final int sampleInterval
Interval between samples (note that there is also other overhead that extends this delay)

See Also:
Constant Field Values
Constructor Detail

sensorDriver

public sensorDriver()
Method Detail

sort

public static void sort(Comparable2[] list,
                        VariableType var)
Sort an array of Comparable2 objects Adopted from Listing 11.10 from "Introduction to Java Programming". The key difference is that we are now calling the compareTo2(), which accepts as a parameter both an object to be compared and a variable that acts as a key.

Parameters:
list - A valid list of objects to be sorted
var - The key that indicates which variable to sort on
Conditions:
PRE - The list must already be instantiated
POST - The list is reorded such that the smallest value is at index 0 and the largest value is at index list.length-1

displayStats

public static void displayStats(FinchSensor[] log,
                                SensorType var)
For the given sensor channel (as indicated by var), display the entire sensor sample for the minimum, median and maximum channel values

Parameters:
log - An valid array of Finch sensor samples
var - The sensor channel on which to organize the list

displaySensors

public static void displaySensors(FinchSensor[] sensors)
Display the sequence of sensor samples in the given array

Parameters:
sensors - An array of sensor samples

ReadSensors

public static FinchSensor[] ReadSensors(finch.Finch myFinch)
Read a sequence of samples from the Finch sensors

Parameters:
myFinch - Reference to the finch object
Returns:
An array of samples

main

public static void main(java.lang.String[] args)
The main method

Parameters:
args - Program arguments