Class FinchSensor

java.lang.Object
  extended by FinchSensor
All Implemented Interfaces:
java.lang.Comparable<FinchSensor>

public class FinchSensor
extends java.lang.Object
implements java.lang.Comparable<FinchSensor>

Representation of a single sample of sensor values from the Finch. In particular, a sample contains:

Author:
Andrew H. Fagg and Steven Ness

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  long sample_time
          The time (in milliseconds) that the sample was taken.
private  double temperature
          Holds the temperature value
 
Constructor Summary
FinchSensor(int[] light, double[] acceleration, boolean[] obstacle, double temperature)
          Primary constructor
 
Method Summary
 int compareTo(FinchSensor obj)
          Compare this FinchSensor to obj using the "natural ordering" (by time that the sample was taken)
 double[] getAcceleration()
          Accessor to acceleration
 int[] getLight()
          Light level accessor
 boolean[] getObstacle()
          Accessor to obstacle sensor
 long getSampleTime()
          Accessor to the sample time
 double getTemperature()
          Accessor to temperature.
 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

light

private int[] light
Holds the array of light values


acceleration

private double[] acceleration
Holds the array of acceleration values


obstacle

private boolean[] obstacle
Holds the array of obstacle values


temperature

private double temperature
Holds the temperature value


sample_time

private long sample_time
The time (in milliseconds) that the sample was taken.

Constructor Detail

FinchSensor

public FinchSensor(int[] light,
                   double[] acceleration,
                   boolean[] obstacle,
                   double temperature)
Primary constructor

Parameters:
light - 2-element array of light levels
acceleration - 3-element array of acceleration values
obstacle - 2-element array of obstacle values
temperature - Temperature
Method Detail

getAcceleration

public double[] getAcceleration()
Accessor to acceleration

Returns:
Array of acceleration values

getTemperature

public double getTemperature()
Accessor to temperature.

Returns:
The temperature

getLight

public int[] getLight()
Light level accessor

Returns:
The array of light levels

getObstacle

public boolean[] getObstacle()
Accessor to obstacle sensor

Returns:
The obstacle sensor array

getSampleTime

public long getSampleTime()
Accessor to the sample time

Returns:
The sample time

toString

public java.lang.String toString()
Overriding the Object toString method

Overrides:
toString in class java.lang.Object
Returns:
A representation of this object as a String

compareTo

public int compareTo(FinchSensor obj)
Compare this FinchSensor to obj using the "natural ordering" (by time that the sample was taken)

Specified by:
compareTo in interface java.lang.Comparable<FinchSensor>
Parameters:
obj - FinchSensor object
Returns:
1 if this was sampled after obj, 0 if sampled at the same time, and -1 otherwise