com.grandcentral.appstats.calculators
Class RingBufferIterator

java.lang.Object
  |
  +--com.grandcentral.appstats.calculators.RingBufferIterator
All Implemented Interfaces:
BufferIterator

public class RingBufferIterator
extends java.lang.Object
implements BufferIterator

Iterates either forwards or backwards over the wrapped buffer in a RingBuffer, starting at the oldest value and working forwards. Like other list iterators, you MUST make sure nothing writes to the buffer while using this Iterator. Will throw a ConcurrentModificationException if it detects that the underlying RingBuffer has been modified.

Author:
Adrian Dorsman

Method Summary
 boolean containsType(int type)
           
 double currentDouble()
          apologize for implementation; it's late...
 double currentLong()
          apologize for implementation; it's late...
 java.lang.Object currentObject()
          apologize for implementation; it's late...
 int getType()
           
 boolean hasNext()
           
 boolean hasPrevious()
           
 void moveToEnd()
          moves to the end (most recent value) of the buffer
 void moveToStart()
          moves to the start (oldest value) of the buffer
 double nextDouble()
           
 long nextLong()
           
 java.lang.Object nextObject()
           
 double previousDouble()
           
 long previousLong()
           
 java.lang.Object previousObject()
           
 int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getType

public int getType()
Specified by:
getType in interface BufferIterator

containsType

public boolean containsType(int type)
Specified by:
containsType in interface BufferIterator

moveToEnd

public void moveToEnd()
moves to the end (most recent value) of the buffer
Specified by:
moveToEnd in interface BufferIterator

moveToStart

public void moveToStart()
moves to the start (oldest value) of the buffer
Specified by:
moveToStart in interface BufferIterator

hasNext

public boolean hasNext()
Specified by:
hasNext in interface BufferIterator

hasPrevious

public boolean hasPrevious()
Specified by:
hasPrevious in interface BufferIterator

size

public int size()
Specified by:
size in interface BufferIterator
Returns:
the number of values in the buffer

nextLong

public long nextLong()
Specified by:
nextLong in interface BufferIterator
Returns:
next val or last val if we're at end of buffer

previousLong

public long previousLong()
Specified by:
previousLong in interface BufferIterator
Returns:
previous val or first val if we're at start of buffer

currentLong

public double currentLong()
apologize for implementation; it's late...
Specified by:
currentLong in interface BufferIterator
Following copied from interface: com.grandcentral.appstats.util.BufferIterator
Returns:
current val and don't move index in underlying buffer space

nextDouble

public double nextDouble()
Specified by:
nextDouble in interface BufferIterator
Returns:
next val or last val if we're at end of buffer

previousDouble

public double previousDouble()
Specified by:
previousDouble in interface BufferIterator
Returns:
previous val or first val if we're at start of buffer

currentDouble

public double currentDouble()
apologize for implementation; it's late...
Specified by:
currentDouble in interface BufferIterator
Following copied from interface: com.grandcentral.appstats.util.BufferIterator
Returns:
current val and don't move index in underlying buffer space

nextObject

public java.lang.Object nextObject()
Specified by:
nextObject in interface BufferIterator
Returns:
next val or last val if we're at end of buffer

previousObject

public java.lang.Object previousObject()
Specified by:
previousObject in interface BufferIterator
Returns:
previous val or first val if we're at start of buffer

currentObject

public java.lang.Object currentObject()
apologize for implementation; it's late...
Specified by:
currentObject in interface BufferIterator
Following copied from interface: com.grandcentral.appstats.util.BufferIterator
Returns:
current val and don't move index in underlying buffer space