bunwarpj
Class CumulativeQueue

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.Vector<java.lang.Double>
              extended by bunwarpj.CumulativeQueue
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<java.lang.Double>, java.util.Collection<java.lang.Double>, java.util.List<java.lang.Double>, java.util.RandomAccess

public class CumulativeQueue
extends java.util.Vector<java.lang.Double>

Class to create a cumulative queue in bUnwarpJ.

See Also:
Serialized Form

Field Summary
private  int currentLength
          current lenght of the queue
private  int ridx
          front index of the queue
private  double sum
          queue sum
private  int widx
          rear index of the queue
 
Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
CumulativeQueue(int length)
          Create a new instance of CumulativeQueue.
 
Method Summary
 int currentSize()
          Get the current size of the queue.
 double getSum()
          Get the sum of the queue.
 double pop_front()
          Pop the value from the front of the queue.
 void push_back(double x)
          Push a value at the end of the queue.
 
Methods inherited from class java.util.Vector
add, add, addAll, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeRange, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, toString, trimToSize
 
Methods inherited from class java.util.AbstractList
iterator, listIterator, listIterator
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
iterator, listIterator, listIterator
 

Field Detail

ridx

private int ridx
front index of the queue


widx

private int widx
rear index of the queue


currentLength

private int currentLength
current lenght of the queue


sum

private double sum
queue sum

Constructor Detail

CumulativeQueue

public CumulativeQueue(int length)
Create a new instance of CumulativeQueue.

Parameters:
length - length of the queue to be created
Method Detail

currentSize

public int currentSize()
Get the current size of the queue.

Returns:
current size

getSum

public double getSum()
Get the sum of the queue.

Returns:
sum

pop_front

public double pop_front()
Pop the value from the front of the queue.

Returns:
front value

push_back

public void push_back(double x)
Push a value at the end of the queue.