Package gov.nih.mipav.model.structures
Class BufferUInt
java.lang.Object
gov.nih.mipav.model.structures.BufferBase
gov.nih.mipav.model.structures.BufferUInt
- All Implemented Interfaces:
Serializable
This class extends the abstract BufferBase class. It allocates the space for an integer buffer on construction. This
class also defines the accessors to the data as required by the abstract base class.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected int[]1D Data array of unsigned integers.private static final longUse serialVersionUID for interoperability. -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.BufferUInt(int size) Constructor that allocates memory. -
Method Summary
Modifier and TypeMethodDescriptionvoidfinalize()Clean up memory.protected final Numberget(int position) Gets the data in as a Number object.protected final booleangetBoolean(int position) Gets the data from the object as a boolean.protected final bytegetByte(int position) Gets the data in byte format.protected final doublegetDouble(int position) Gets the data in double format.protected final floatgetFloat(int position) Gets the data in float format.protected final intgetInt(int position) Gets the data in int format.protected final longgetLong(int position) Gets the data in long format.protected final shortgetShort(int position) Gets the data in short format.protected final Class<?> getType()Return int.classprotected final shortgetUByte(int position) Gets the data in short format.protected final longgetUInt(int position) Gets the data in long format.protected final intgetUShort(int position) Gets the data in unsigned short format.intlength()Returns the length of the data array.protected final voidset(int position, int value) Sets the value in unsigned int format.protected final voidSets the value in unsigned int format.protected final voidsetBoolean(int position, boolean value) Sets the data in float format.protected final voidsetByte(int position, byte value) Sets the byte value in unsigned short format.protected final voidsetDouble(int position, double value) Sets the double value in unsigned short format.protected final voidsetFloat(int position, float value) Sets the float value in unsigned short format.protected final voidsetInt(int position, int value) Sets the int value in unsigned short format.protected final voidsetLong(int position, long value) Sets the long value in unsigned short format.protected final voidsetShort(int position, short value) Sets the short value in unsigned short format.protected final voidsetUByte(int position, short value) Sets the unsigned byte value in unsigned short format.protected final voidsetUInt(int position, long value) Sets the int value in unsigned short format.protected final voidsetUShort(int position, int value) Sets the short (unsigned) value in unsigned short format.
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDUse serialVersionUID for interoperability.- See Also:
-
dataArray
protected int[] dataArray1D Data array of unsigned integers.
-
-
Constructor Details
-
BufferUInt
public BufferUInt()Default constructor. -
BufferUInt
public BufferUInt(int size) Constructor that allocates memory.- Parameters:
size- the amount of data to allocate
-
-
Method Details
-
finalize
Clean up memory.- Specified by:
finalizein classBufferBase- Throws:
Throwable- DOCUMENT ME!
-
getType
Return int.class- Specified by:
getTypein classBufferBase- Returns:
- one of the primitive class objects, like float.class (== Float.TYPE)
-
length
public int length()Returns the length of the data array.- Specified by:
lengthin classBufferBase- Returns:
- length of the array
-
get
Gets the data in as a Number object.- Specified by:
getin classBufferBase- Parameters:
position- position in dataArray- Returns:
- Number object of the data
-
getBoolean
protected final boolean getBoolean(int position) Gets the data from the object as a boolean.- Specified by:
getBooleanin classBufferBase- Parameters:
position- position in dataArray to get- Returns:
- true if data at position is not equal to zero else its false
-
getByte
protected final byte getByte(int position) Gets the data in byte format.- Specified by:
getBytein classBufferBase- Parameters:
position- position in dataArray- Returns:
- the int value as a byte
-
getDouble
protected final double getDouble(int position) Gets the data in double format.- Specified by:
getDoublein classBufferBase- Parameters:
position- position in dataArray- Returns:
- int value as a double
-
getFloat
protected final float getFloat(int position) Gets the data in float format.- Specified by:
getFloatin classBufferBase- Parameters:
position- position in dataArray- Returns:
- int value as a float
-
getInt
protected final int getInt(int position) Gets the data in int format.- Specified by:
getIntin classBufferBase- Parameters:
position- position in dataArray- Returns:
- int value as an int
-
getLong
protected final long getLong(int position) Gets the data in long format.- Specified by:
getLongin classBufferBase- Parameters:
position- position in dataArray- Returns:
- int value as a long
-
getShort
protected final short getShort(int position) Gets the data in short format.- Specified by:
getShortin classBufferBase- Parameters:
position- position in dataArray- Returns:
- int value as a short
-
getUByte
protected final short getUByte(int position) Gets the data in short format.- Specified by:
getUBytein classBufferBase- Parameters:
position- position in dataArray- Returns:
- the int value as a short (unsigned byte)
-
getUInt
protected final long getUInt(int position) Gets the data in long format.- Specified by:
getUIntin classBufferBase- Parameters:
position- position in dataArray- Returns:
- int value as a long
-
getUShort
protected final int getUShort(int position) Gets the data in unsigned short format.- Specified by:
getUShortin classBufferBase- Parameters:
position- position in dataArray- Returns:
- int value as an int
-
set
Sets the value in unsigned int format.- Specified by:
setin classBufferBase- Parameters:
position- position in dataArrayvalue- the new data value to be placed in the data array
-
set
protected final void set(int position, int value) Sets the value in unsigned int format.- Parameters:
position- position in dataArrayvalue- the new data value to be placed in the data array
-
setBoolean
protected final void setBoolean(int position, boolean value) Sets the data in float format. One if value is true, zero if value is false- Specified by:
setBooleanin classBufferBase- Parameters:
position- position in dataArrayvalue- the new data value to be placed in the data array
-
setByte
protected final void setByte(int position, byte value) Sets the byte value in unsigned short format.- Specified by:
setBytein classBufferBase- Parameters:
position- position in dataArrayvalue- the new data value to be placed in the data array
-
setDouble
protected final void setDouble(int position, double value) Sets the double value in unsigned short format.- Specified by:
setDoublein classBufferBase- Parameters:
position- position in dataArrayvalue- the new data value to be placed in the data array
-
setFloat
protected final void setFloat(int position, float value) Sets the float value in unsigned short format.- Specified by:
setFloatin classBufferBase- Parameters:
position- position in dataArrayvalue- the new data value to be placed in the data array
-
setInt
protected final void setInt(int position, int value) Sets the int value in unsigned short format.- Specified by:
setIntin classBufferBase- Parameters:
position- position in dataArrayvalue- the new data value to be placed in the data array
-
setLong
protected final void setLong(int position, long value) Sets the long value in unsigned short format.- Specified by:
setLongin classBufferBase- Parameters:
position- position in dataArrayvalue- the new data value to be placed in the data array
-
setShort
protected final void setShort(int position, short value) Sets the short value in unsigned short format.- Specified by:
setShortin classBufferBase- Parameters:
position- position in dataArrayvalue- the new data value to be placed in the data array
-
setUByte
protected final void setUByte(int position, short value) Sets the unsigned byte value in unsigned short format.- Specified by:
setUBytein classBufferBase- Parameters:
position- position in dataArrayvalue- the new data value to be placed in the data array
-
setUInt
protected final void setUInt(int position, long value) Sets the int value in unsigned short format.- Specified by:
setUIntin classBufferBase- Parameters:
position- position in dataArrayvalue- the new data value to be placed in the data array
-
setUShort
protected final void setUShort(int position, int value) Sets the short (unsigned) value in unsigned short format.- Specified by:
setUShortin classBufferBase- Parameters:
position- position in dataArrayvalue- the new data value to be placed in the data array
-