|
dLife Home Page | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.Observable
dlife.robot.Device
dlife.robot.ArraySensor<VTYPE>
public abstract class ArraySensor<VTYPE>
Abstract base class for a sensor with values that can be represented as an array of values.
| Field Summary | |
|---|---|
protected int |
length
|
protected ArrayList<VTYPE> |
values
|
| Fields inherited from class dlife.robot.Device |
|---|
DEFAULT_GUI_UPDATE_DELAY, DEFAULT_READ_DELAY, myRobot, readCount |
| Constructor Summary | |
|---|---|
ArraySensor(int readDelay,
int guiUpdateDelay,
int length,
VTYPE initValue)
Create a new ArraySensor that provides length values of the specified type. |
|
ArraySensor(int length,
VTYPE initValue)
Create a new ArraySensor that provides length values of the specified type. |
|
| Method Summary | |
|---|---|
double |
getAverage()
Compute the average value reported by the sensors. |
double |
getAverage(int... sensorList)
Compute the average value reported by the listed sensors. |
VTYPE |
getMaximum()
Find the maximum value reported by all of the sensors. |
VTYPE |
getMaximum(int... sensorList)
Find the maximum value reported by the listed sensors. |
int |
getMaximumIndex()
Find the index of the sensor that reported the maximum value The ordering of the values is imposed by their compareTo method. |
int |
getMaximumIndex(int... sensorList)
Find the index of the sensor that reported the maximum value of the listed sensors. |
VTYPE |
getMinimum()
Find the minimum value reported by all of the sensors. |
VTYPE |
getMinimum(int... sensorList)
Find the minimum value reported by the listed sensors. |
int |
getMinimumIndex()
Find the index of the sensor that reported the minimum value The ordering of the values is imposed by their compareTo method. |
int |
getMinimumIndex(int... sensorList)
Find the index of the sensor that reported the minimum value of the listed sensors. |
int |
getNumValues()
Get the number of sensor values that are contained in this ArraySensor. |
ArrayList<VTYPE> |
getSubset(int... sensorList)
Get a subset of the sensor reading for this sensor. |
VTYPE |
getValue(int index)
Get the sensor reading for the sensor with the specified index. |
ArrayList<VTYPE> |
getValues()
Get the ArrayList that is holding the latest sensor readings. |
| Methods inherited from class dlife.robot.Device |
|---|
createGUIObjects, freeze, getAutoRead, getGUI, getGUIUpdateDelay, getReadDelay, getRobot, getSensorReadCount, getSensorReadRate, readStateFromRobot, setAutoRead, setGUIUpdateDelay, setReadDelay, setRobot, shutDown, startAutoReadTimer, startUp, stopAutoReadTimer |
| Methods inherited from class java.util.Observable |
|---|
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected ArrayList<VTYPE> values
protected int length
| Constructor Detail |
|---|
public ArraySensor(int readDelay,
int guiUpdateDelay,
int length,
VTYPE initValue)
readDelay - the delay (in ms) between attempts to read the device's
state from the robot.guiUpdateDelay - the minimum time (in ms) that will elapse between
consecutive notifications of the GUI.length - the number of sensor values.initValue - the value for each sensor before the first time they
are read.
public ArraySensor(int length,
VTYPE initValue)
length - the number of sensor values.initValue - the value for each sensor before the first time they
are read.| Method Detail |
|---|
public int getNumValues()
public ArrayList<VTYPE> getValues()
public VTYPE getValue(int index)
index - the index of the sensor value to get.
IllegalArgumentException - if the index is not valid for this
IntegerArraySensor.public ArrayList<VTYPE> getSubset(int... sensorList)
sensorList - the indices of the sensor values to include.
IllegalArgumentException - if any index in sensorList is not valid for this
IntegerArraySensor.public VTYPE getMaximum()
ClassCastException - if any of the elements in this sensor cannot be
compared to each other.public VTYPE getMaximum(int... sensorList)
sensorList - a comma separated list of integers indicating
the sensors.
ClassCastException - if any of the elements in this sensor cannot be
compared to each other.
IllegalArgumentException - if sensorList contains an illegal sensor number.public int getMaximumIndex()
ClassCastException - if any of the elements in this sensor cannot be
compared to each other.public int getMaximumIndex(int... sensorList)
sensorList - a comma separated list of integers indicating the sensors.
ClassCastException - if any of the elements in this sensor cannot be
compared to each other.
IllegalArgumentException - if sensorList contains an illegal sensor number.public VTYPE getMinimum()
ClassCastException - if any of the elements in this sensor cannot be
compared to each other.public VTYPE getMinimum(int... sensorList)
sensorList - a comma separated list of integers indicating
the sensors.
ClassCastException - if any of the elements in this sensor cannot be
compared to each other.
IllegalArgumentException - if sensorList contains an illegal sensor number.public int getMinimumIndex()
ClassCastException - if any of the elements in this sensor cannot be
compared to each other.public int getMinimumIndex(int... sensorList)
sensorList - a comma separated list of integers indicating the sensors.
ClassCastException - if any of the elements in this sensor cannot be
compared to each other.
IllegalArgumentException - if sensorList contains an illegal sensor number.public double getAverage()
ClassCastException - if any of the elements in this sensor cannot be
cast to a Number.public double getAverage(int... sensorList)
sensorList - a comma separated list of integers indicating
the sensors.
ClassCastException - if any of the elements in this sensor cannot be
cast to a Number.
IllegalArgumentException - if sensorList contains an illegal sensor number.
|
dLife Home Page | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||