Package lejos.robotics
Class RangeReadings
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.ArrayList<RangeReading>
-
- lejos.robotics.RangeReadings
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,java.lang.Iterable<RangeReading>,java.util.Collection<RangeReading>,java.util.List<RangeReading>,java.util.RandomAccess,Transmittable
public class RangeReadings extends java.util.ArrayList<RangeReading> implements Transmittable
Represents a set of range readings.- Author:
- Lawrie Griffiths
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description RangeReadings(int numReadings)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddumpObject(java.io.DataOutputStream dos)Dump the readings to a DataOutputStreamfloatgetAngle(int index)Get the angle of a specific readingintgetNumReadings()Get the number of readings in a setfloatgetRange(float angle)Get a range reading for a specific anglefloatgetRange(int i)Get a specific range readingbooleanincomplete()Return true if the readings are incompletevoidloadObject(java.io.DataInputStream dis)Load the readings from a DataInputStreamvoidprintReadings()Print the range readings on standard outvoidsetRange(int index, float angle, float range)Set the range reading-
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, equals, forEach, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
-
-
-
-
Method Detail
-
getRange
public float getRange(int i)
Get a specific range reading- Parameters:
i- the reading index- Returns:
- the range value
-
getRange
public float getRange(float angle)
Get a range reading for a specific angle- Parameters:
angle- the reading angle- Returns:
- the range value
-
getAngle
public float getAngle(int index)
Get the angle of a specific reading- Parameters:
index- the index of the reading- Returns:
- the angle in degrees
-
incomplete
public boolean incomplete()
Return true if the readings are incomplete- Returns:
- true iff one of the readings is not valid
-
getNumReadings
public int getNumReadings()
Get the number of readings in a set
-
setRange
public void setRange(int index, float angle, float range)Set the range reading- Parameters:
index- the index of the reading in the setangle- the angle of the reading relative to the robot headingrange- the range reading
-
dumpObject
public void dumpObject(java.io.DataOutputStream dos) throws java.io.IOExceptionDump the readings to a DataOutputStream- Specified by:
dumpObjectin interfaceTransmittable- Parameters:
dos- the stream- Throws:
java.io.IOException
-
loadObject
public void loadObject(java.io.DataInputStream dis) throws java.io.IOExceptionLoad the readings from a DataInputStream- Specified by:
loadObjectin interfaceTransmittable- Parameters:
dis- the stream- Throws:
java.io.IOException
-
printReadings
public void printReadings()
Print the range readings on standard out
-
-