|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsimtools.data.ValueProvider
simtools.data.buffer.Buffer
public abstract class Buffer
A Buffer provides a buffering service for values, based on an index. To do that, it asks a ValueProvider for new unbuffered values when necessary. It should implement a strategy in order to minimize calls to the ValueProvider getUnbuffered method. The Buffer is also a ValueProvider itself, of course. A simple strategy is proposed with the AgeBufferPolicy, where the oldest entry is removed to make space for a new entry when the buffer is full. More intelligent or faster policies may be implemented by subclasses, such as using the values access frequency, or managing ranges of index.
Nested Class Summary | |
---|---|
class |
Buffer.ByteManipulator
This class handles optimization for byte objects. |
class |
Buffer.DoubleManipulator
This class handles optimization for double objects. |
class |
Buffer.FloatManipulator
This class handles optimization for float objects. |
class |
Buffer.IntegerManipulator
This class handles optimization for int objects. |
class |
Buffer.LongManipulator
This class handles optimization for long objects. |
static interface |
Buffer.Manipulator
|
class |
Buffer.ObjectManipulator
This class handles optimization for Object objects. |
class |
Buffer.ShortManipulator
This class handles optimization for short objects. |
Field Summary | |
---|---|
protected Buffer.ByteManipulator |
byteManipulator
|
protected Buffer.DoubleManipulator |
doubleManipulator
|
protected long |
endIndex
|
protected Buffer.FloatManipulator |
floatManipulator
|
protected Buffer.IntegerManipulator |
intManipulator
|
protected Buffer.LongManipulator |
longManipulator
|
protected Buffer.ObjectManipulator |
objectManipulator
|
protected ValueProvider |
provider
|
protected Buffer.ShortManipulator |
shortManipulator
|
protected long |
startIndex
|
Fields inherited from class simtools.data.ValueProvider |
---|
ByteProvider, DoubleProvider, FloatProvider, IntegerProvider, kind, LongProvider, ObjectProvider, ShortProvider |
Constructor Summary | |
---|---|
Buffer()
|
|
Buffer(int type)
|
|
Buffer(int type,
ValueProvider vp)
|
|
Buffer(ValueProvider vp)
|
Method Summary | |
---|---|
void |
clear()
|
java.lang.Object |
clone()
|
protected abstract Buffer.Manipulator |
createManipulator(int kind)
Manipulator factory Subclasses shall implement it to return their specialized versions of Manipulators. |
byte |
getByteValue(long index)
Optimized accessor for byte values. |
double |
getDoubleValue(long index)
Optimized accessor for double values. |
long |
getEndIndex()
|
float |
getFloatValue(long index)
Optimized accessor for float values. |
int |
getIntegerValue(long index)
Optimized accessor for int values. |
int |
getKind()
The kind of this provider may be used fo optimization purpose. |
long |
getLongValue(long index)
Optimized accessor for long values. |
ValueProvider |
getProvider()
|
short |
getShortValue(long index)
Optimized accessor for short values. |
long |
getStartIndex()
|
java.lang.Object |
getValue(long index)
|
boolean |
setByteValue(long index,
byte value)
|
boolean |
setDoubleValue(long index,
double value)
|
boolean |
setFloatValue(long index,
float value)
|
boolean |
setIntegerValue(long index,
int value)
|
boolean |
setLongValue(long index,
long value)
|
void |
setProvider(ValueProvider vp)
|
boolean |
setShortValue(long index,
short value)
|
void |
setSlice(long min,
long max)
Sets a region of interest in the buffer. |
boolean |
setValue(long index,
java.lang.Object value)
Sets a new value in the buffer, if possible. |
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 |
---|
protected transient ValueProvider provider
protected transient Buffer.ObjectManipulator objectManipulator
protected transient Buffer.ByteManipulator byteManipulator
protected transient Buffer.ShortManipulator shortManipulator
protected transient Buffer.IntegerManipulator intManipulator
protected transient Buffer.LongManipulator longManipulator
protected transient Buffer.FloatManipulator floatManipulator
protected transient Buffer.DoubleManipulator doubleManipulator
protected transient long startIndex
protected transient long endIndex
Constructor Detail |
---|
public Buffer()
public Buffer(int type)
public Buffer(ValueProvider vp)
public Buffer(int type, ValueProvider vp)
Method Detail |
---|
public void setProvider(ValueProvider vp)
public ValueProvider getProvider()
public boolean setValue(long index, java.lang.Object value) throws DataException
index
- The index for which a new value is givenvalue
- The new value
DataException
public void setSlice(long min, long max)
public java.lang.Object clone()
clone
in class java.lang.Object
public long getEndIndex()
public long getStartIndex()
public java.lang.Object getValue(long index) throws DataException
getValue
in class ValueProvider
DataException
public byte getByteValue(long index) throws DataException
ValueProvider
getByteValue
in class ValueProvider
DataException
public boolean setByteValue(long index, byte value) throws DataException
DataException
public short getShortValue(long index) throws DataException
ValueProvider
getShortValue
in class ValueProvider
DataException
public boolean setShortValue(long index, short value) throws DataException
DataException
public int getIntegerValue(long index) throws DataException
ValueProvider
getIntegerValue
in class ValueProvider
DataException
public boolean setIntegerValue(long index, int value) throws DataException
DataException
public long getLongValue(long index) throws DataException
ValueProvider
getLongValue
in class ValueProvider
DataException
public boolean setLongValue(long index, long value) throws DataException
DataException
public float getFloatValue(long index) throws DataException
ValueProvider
getFloatValue
in class ValueProvider
DataException
public boolean setFloatValue(long index, float value) throws DataException
DataException
public double getDoubleValue(long index) throws DataException
ValueProvider
getDoubleValue
in class ValueProvider
DataException
public boolean setDoubleValue(long index, double value) throws DataException
DataException
protected abstract Buffer.Manipulator createManipulator(int kind)
kind
-
public int getKind()
ValueProvider
getKind
in class ValueProvider
public void clear()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |