|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractCollection<TimedPosition>
sk.robotics.rlcs.data.PositionQueue
public class PositionQueue
Collection class holding queue of positions. Allows constant-time push and pop, as well as constant-time random access. Positions in the queue are always sorted by time (but this is application's responsibility), so the queue also provides logarithmic-time searching by position age.
This class also allows a shift operation, which shifts all current stored positions by given delta x, y, and h. But this shift operation does not actually change the stored positions, it only remembers that all positions older than the shift are to be treated as shifted. Thus, it is a constant time operation.
This class' implementation is strongly inspired by java.util.ArrayDeque.
Constructor Summary | |
---|---|
PositionQueue()
Constructs an empty queue with an initial capacity for 16 elements. |
|
PositionQueue(int numElements)
Constructs an empty queue with specified initial capacity. |
Method Summary | |
---|---|
boolean |
add(TimedPosition e)
Adds the specified element to (the tail of) this queue. |
TimedPosition |
applyShifts(TimedPosition pos)
Apply all applicable shifts to a position. |
void |
clear()
Removes all of the elements from this queue. |
TimedPosition |
getNewest()
Retrieves the tail element of this queue, without removing it. |
TimedPosition |
getOldest()
Retrieves the head element of this queue, without removing it. |
Position |
getPositionByTime(long timestamp)
Get position estimation for given time. |
java.util.Collection<TimedPosition.XmlMappable> |
getXmlMappable()
|
boolean |
isEmpty()
Checks for queue emptyness. |
java.util.Iterator<TimedPosition> |
iterator()
Returns an iterator over the elements in this queue. |
boolean |
removeOldest()
Removes the head element of this queue. |
void |
shiftBy(double dx,
double dy,
double dh)
|
void |
shiftBy(double dx,
double dy,
double dh,
long timestamp)
Shift all positions in the queue. |
int |
size()
Returns the number of elements in this queue. |
Methods inherited from class java.util.AbstractCollection |
---|
addAll, contains, containsAll, remove, removeAll, retainAll, toArray, toArray, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Collection |
---|
equals, hashCode |
Constructor Detail |
---|
public PositionQueue()
public PositionQueue(int numElements)
Method Detail |
---|
public boolean add(TimedPosition e)
add
in interface java.util.Collection<TimedPosition>
add
in class java.util.AbstractCollection<TimedPosition>
public boolean removeOldest()
public TimedPosition getOldest()
public TimedPosition getNewest()
public int size()
size
in interface java.util.Collection<TimedPosition>
size
in class java.util.AbstractCollection<TimedPosition>
public boolean isEmpty()
isEmpty
in interface java.util.Collection<TimedPosition>
isEmpty
in class java.util.AbstractCollection<TimedPosition>
public java.util.Iterator<TimedPosition> iterator()
iterator
in interface java.lang.Iterable<TimedPosition>
iterator
in interface java.util.Collection<TimedPosition>
iterator
in class java.util.AbstractCollection<TimedPosition>
public void clear()
clear
in interface java.util.Collection<TimedPosition>
clear
in class java.util.AbstractCollection<TimedPosition>
public Position getPositionByTime(long timestamp)
public void shiftBy(double dx, double dy, double dh, long timestamp)
public void shiftBy(double dx, double dy, double dh)
public TimedPosition applyShifts(TimedPosition pos)
public java.util.Collection<TimedPosition.XmlMappable> getXmlMappable()
getXmlMappable
in interface com.microstepmis.xplatform.CustomXmlMappable
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |