uka.util
Class DoubleQueue

java.lang.Object
  extended byuka.util.DoubleSequence
      extended byuka.util.DoubleQueue
All Implemented Interfaces:
DoubleIterator, Printable, java.io.Serializable

public final class DoubleQueue
extends DoubleSequence
implements java.io.Serializable, Printable

Queue of values of type double.

Author:
Bernhard Haumacher
See Also:
Serialized Form

Field Summary
private  EnlargingDoubleArray data
          Stores the data of this queue.
static int MIN_FREE
           
(package private)  int readPos
          The next value will be read() from data at index readPos.
(package private)  int writePos
          The next value will be written into data at index writePos.
 
Fields inherited from class uka.util.DoubleSequence
EMPTY
 
Constructor Summary
DoubleQueue()
           
 
Method Summary
 void appendTo(ToString s)
          This method should append the contents of each instance variable of the current object to the given ToString object.
 void clear()
          Removes all values from this queue.
 double get(int index)
           
 boolean hasNext()
          Indicates whether more double values can be returned by this iterator.
 boolean isEmpty()
          Checks, whether this queue is empty.
 double next()
          Read from this queue via the iterator interface.
 double read()
          Read the next value from this queue.
 int size()
          Returns the number of values that are currently in this queue.
 double top()
          Return the next value from this queue without removing it.
 void write(double value)
          Write the given value into this queue.
 
Methods inherited from class uka.util.DoubleSequence
remove
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MIN_FREE

public static final int MIN_FREE
See Also:
Constant Field Values

writePos

int writePos
The next value will be written into data at index writePos.


readPos

int readPos
The next value will be read() from data at index readPos.


data

private final EnlargingDoubleArray data
Stores the data of this queue.

See Also:
readPos, writePos
Constructor Detail

DoubleQueue

public DoubleQueue()
Method Detail

read

public double read()
Read the next value from this queue.


top

public double top()
Return the next value from this queue without removing it.


get

public double get(int index)

write

public void write(double value)
Write the given value into this queue.


isEmpty

public boolean isEmpty()
Checks, whether this queue is empty.


size

public int size()
Returns the number of values that are currently in this queue.


hasNext

public boolean hasNext()
Description copied from interface: DoubleIterator
Indicates whether more double values can be returned by this iterator.

Specified by:
hasNext in interface DoubleIterator
Returns:
true if more double values can be returned by this iterator; returns false otherwise.
See Also:
next()

next

public double next()
Read from this queue via the iterator interface.

Specified by:
next in interface DoubleIterator
Returns:
the next double value of this iterator.
See Also:
DoubleIterator.hasNext()

clear

public void clear()
Removes all values from this queue. For queues of reference values: This method also makes sure that all references to objects inserted into this queue are removed.


appendTo

public void appendTo(ToString s)
Description copied from interface: Printable
This method should append the contents of each instance variable of the current object to the given ToString object. The appended data should be labeled with the name of the corresponding instance variable.

Specified by:
appendTo in interface Printable
See Also:
ToString, ToString.append(String, Object), ToString.append(String, boolean), ToString.append(String, byte), ToString.append(String, int)