com.grandcentral.appstats.calculators
Class RingBuffer

java.lang.Object
  |
  +--com.grandcentral.appstats.StatCalculator
        |
        +--com.grandcentral.appstats.calculators.RingBuffer
All Implemented Interfaces:
java.io.Serializable

public class RingBuffer
extends StatCalculator

this class maintains a single, fixed size wrapped buffer space for subclasses and child StatCalculators to use for analysis. Once the buffer space fills, writes will replace the oldest values. Parents and Children may maintain different sized buffers, but there exists only 1 buffer per datatype, owned by topmost RingBuffer.

Any subclass, when performing analysis will retrieve a BufferIterator, with the option to lock write access to the buffer while analysis is being done. It is a requirement that no writes happen while a BufferIterator is being used.

At present, does not allow for dynamic buffer resizing after initial invocation.

Author:
Adrian Dorsman
See Also:
Serialized Form

Fields inherited from class com.grandcentral.appstats.StatCalculator
m_parent
 
Constructor Summary
RingBuffer()
           
 
Method Summary
 void addType(int type)
           
 void calculate(Task destination, Stat newSample, java.lang.String prependName)
           
 void clear()
          Causes to clear any state accumulated from processing stats.
 boolean containsType(int type)
           
 int getBufferSize()
           
 java.util.List getSuffices()
           
 int getType()
           
 RingBufferIterator iterator()
           
 void removeType(int type)
           
 void setBufferSize(int bufferSize)
           
 void setType(int type)
           
 
Methods inherited from class com.grandcentral.appstats.StatCalculator
getParent, getTopMostParent, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RingBuffer

public RingBuffer()
Method Detail

getType

public int getType()

setType

public void setType(int type)

addType

public void addType(int type)

removeType

public void removeType(int type)

containsType

public boolean containsType(int type)

getBufferSize

public int getBufferSize()
Returns:
the size of the buffer maintained by this class

setBufferSize

public void setBufferSize(int bufferSize)

iterator

public RingBufferIterator iterator()
Returns:
an iterator over the buffer maintained by this class

getSuffices

public java.util.List getSuffices()
Overrides:
getSuffices in class StatCalculator

clear

public void clear()
Description copied from class: StatCalculator
Causes to clear any state accumulated from processing stats. All/Any configuration data remains intact.
Overrides:
clear in class StatCalculator

calculate

public void calculate(Task destination,
                      Stat newSample,
                      java.lang.String prependName)
               throws DatatypeMismatchException
Overrides:
calculate in class StatCalculator