lejos.robotics
Class RangeReadings

java.lang.Object
  extended by java.util.ArrayList<RangeReading>
      extended by lejos.robotics.RangeReadings
All Implemented Interfaces:
Iterable<RangeReading>, Collection<RangeReading>, List<RangeReading>, RandomAccess

public class RangeReadings
extends ArrayList<RangeReading>

Represents a set of range readings.

Author:
Lawrie Griffiths

Field Summary
 
Fields inherited from class java.util.ArrayList
modCount
 
Constructor Summary
RangeReadings(int numReadings)
           
 
Method Summary
 boolean contains(Object o)
           
 boolean containsAll(Collection<?> c)
           
 void dumpReadings(DataOutputStream dos)
          Dump the readings to a DataOutputStream
 boolean equals(Object o)
           
 float getAngle(int index)
          Get the angle of a specific reading
 int getNumReadings()
          Get the number of readings in a set
 float getRange(float angle)
          Get a range reading for a specific angle
 float getRange(int i)
          Get a specific range reading
 boolean incomplete()
          Return true if the readings are incomplete
 boolean isEmpty()
           
 Iterator<E> iterator()
           
 ListIterator<E> listIterator()
           
 void loadReadings(DataInputStream dis)
          Load the readings from a DataInputStream
 void printReadings()
          Print the range readings on standard out
 boolean removeAll(Collection<?> c)
           
 boolean retainAll(Collection<?> c)
           
 void setRange(int index, float angle, float range)
          Set the range reading
 Object[] toArray()
           
<T> T[]
toArray(T[] dest)
           
 
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, addAll, addAll, clear, ensureCapacity, get, indexOf, lastIndexOf, listIterator, remove, remove, removeRange, set, size, subList, trimToSize
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Collection
containsAll, hashCode, isEmpty, removeAll, retainAll, toArray, toArray
 

Constructor Detail

RangeReadings

public RangeReadings(int numReadings)
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 set
angle - the angle of the reading relative to the robot heading
range - the range reading

dumpReadings

public void dumpReadings(DataOutputStream dos)
                  throws IOException
Dump the readings to a DataOutputStream

Parameters:
dos - the stream
Throws:
IOException

loadReadings

public void loadReadings(DataInputStream dis)
                  throws IOException
Load the readings from a DataInputStream

Parameters:
dis - the stream
Throws:
IOException

printReadings

public void printReadings()
Print the range readings on standard out


contains

public boolean contains(Object o)
Specified by:
contains in interface Collection<E>

equals

public boolean equals(Object o)
Specified by:
equals in interface Collection<E>
Overrides:
equals in class Object

iterator

public Iterator<E> iterator()
Specified by:
iterator in interface Iterable<E>
Specified by:
iterator in interface Collection<E>

listIterator

public ListIterator<E> listIterator()
Specified by:
listIterator in interface List<E>

containsAll

public boolean containsAll(Collection<?> c)
Specified by:
containsAll in interface Collection<E>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Collection<E>

removeAll

public boolean removeAll(Collection<?> c)
Specified by:
removeAll in interface Collection<E>

retainAll

public boolean retainAll(Collection<?> c)
Specified by:
retainAll in interface Collection<E>

toArray

public Object[] toArray()
Specified by:
toArray in interface Collection<E>

toArray

public <T> T[] toArray(T[] dest)
Specified by:
toArray in interface Collection<E>