simtools.data.buffer
Class DelayedBuffer

java.lang.Object
  extended by simtools.data.ValueProvider
      extended by simtools.data.buffer.Buffer
          extended by simtools.data.buffer.SimpleBuffer
              extended by simtools.data.buffer.ResizeableBuffer
                  extended by simtools.data.buffer.DelayedBuffer
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class DelayedBuffer
extends ResizeableBuffer

Unlike parent's, this buffer deletes old elements and give priority to the newly set elements. The Simple and Resizeable buffre only sets new values if possible, this buffer always takes in account new values, even if old ones are dropped in the process. Also, setSlice will bound the buffer size.

See Also:
Serialized Form

Nested Class Summary
 class DelayedBuffer.DelayedByteManipulator
          This class handles optimization for byte objects.
 class DelayedBuffer.DelayedDoubleManipulator
          This class handles optimization for double objects.
 class DelayedBuffer.DelayedFloatManipulator
          This class handles optimization for float objects.
 class DelayedBuffer.DelayedIntegerManipulator
          This class handles optimization for int objects.
 class DelayedBuffer.DelayedLongManipulator
          This class handles optimization for long objects.
 class DelayedBuffer.DelayedObjectManipulator
          This class handles optimization for Object objects.
 class DelayedBuffer.DelayedShortManipulator
          This class handles optimization for short objects.
 
Nested classes/interfaces inherited from class simtools.data.buffer.ResizeableBuffer
ResizeableBuffer.ResizeableByteManipulator, ResizeableBuffer.ResizeableDoubleManipulator, ResizeableBuffer.ResizeableFloatManipulator, ResizeableBuffer.ResizeableIntegerManipulator, ResizeableBuffer.ResizeableLongManipulator, ResizeableBuffer.ResizeableObjectManipulator, ResizeableBuffer.ResizeableShortManipulator
 
Nested classes/interfaces inherited from class simtools.data.buffer.SimpleBuffer
SimpleBuffer.SimpleByteManipulator, SimpleBuffer.SimpleDoubleManipulator, SimpleBuffer.SimpleFloatManipulator, SimpleBuffer.SimpleIntegerManipulator, SimpleBuffer.SimpleLongManipulator, SimpleBuffer.SimpleObjectManipulator, SimpleBuffer.SimpleShortManipulator
 
Nested classes/interfaces inherited from class simtools.data.buffer.Buffer
Buffer.ByteManipulator, Buffer.DoubleManipulator, Buffer.FloatManipulator, Buffer.IntegerManipulator, Buffer.LongManipulator, Buffer.Manipulator, Buffer.ObjectManipulator, Buffer.ShortManipulator
 
Field Summary
protected  int delay
          Apparent number of index in the buffer.
 
Fields inherited from class simtools.data.buffer.ResizeableBuffer
maxSize, minSize
 
Fields inherited from class simtools.data.buffer.SimpleBuffer
valid
 
Fields inherited from class simtools.data.buffer.Buffer
byteManipulator, doubleManipulator, endIndex, floatManipulator, intManipulator, longManipulator, objectManipulator, provider, shortManipulator, startIndex
 
Fields inherited from class simtools.data.ValueProvider
ByteProvider, DoubleProvider, FloatProvider, IntegerProvider, kind, LongProvider, ObjectProvider, ShortProvider
 
Constructor Summary
DelayedBuffer()
           
DelayedBuffer(int delay)
           
DelayedBuffer(int type, int delay)
           
DelayedBuffer(int type, ValueProvider prov)
           
DelayedBuffer(int type, ValueProvider prov, int delay)
           
DelayedBuffer(ValueProvider prov)
           
 
Method Summary
protected  Buffer.Manipulator createManipulator(int kind)
          Manipulator factory Subclasses shall implement it to return their specialized versions of Manipulators.
 int getDelay()
           
 long getStartIndex()
           
 
Methods inherited from class simtools.data.buffer.SimpleBuffer
clone, initialize
 
Methods inherited from class simtools.data.buffer.Buffer
clear, getByteValue, getDoubleValue, getEndIndex, getFloatValue, getIntegerValue, getKind, getLongValue, getProvider, getShortValue, getValue, setByteValue, setDoubleValue, setFloatValue, setIntegerValue, setLongValue, setProvider, setShortValue, setSlice, setValue
 
Methods inherited from class simtools.data.ValueProvider
getObjectValue, valueClass
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

delay

protected int delay
Apparent number of index in the buffer. The buffer may actually contain more elements for optimization purposes, but will indicate this number when asked for start and end index.

Constructor Detail

DelayedBuffer

public DelayedBuffer()

DelayedBuffer

public DelayedBuffer(int delay)

DelayedBuffer

public DelayedBuffer(int type,
                     int delay)

DelayedBuffer

public DelayedBuffer(ValueProvider prov)

DelayedBuffer

public DelayedBuffer(int type,
                     ValueProvider prov)

DelayedBuffer

public DelayedBuffer(int type,
                     ValueProvider prov,
                     int delay)
Method Detail

getDelay

public int getDelay()
Returns:
Returns the delay.

getStartIndex

public long getStartIndex()
Overrides:
getStartIndex in class Buffer
Returns:
long

createManipulator

protected Buffer.Manipulator createManipulator(int kind)
Description copied from class: Buffer
Manipulator factory Subclasses shall implement it to return their specialized versions of Manipulators.

Overrides:
createManipulator in class ResizeableBuffer
Returns:
Manipulator a Manipulator which must be a subclass of the corresponding TypeManipulator.