java.awt.image
Class DataBufferFloat

java.lang.Object
  extended by java.awt.image.DataBuffer
      extended by java.awt.image.DataBufferFloat

public final class DataBufferFloat
extends DataBuffer

A DataBuffer that uses an array of float primitives to represent each of its banks.


Field Summary
 
Fields inherited from class java.awt.image.DataBuffer
banks, dataType, offset, offsets, size, TYPE_BYTE, TYPE_DOUBLE, TYPE_FLOAT, TYPE_INT, TYPE_SHORT, TYPE_UNDEFINED, TYPE_USHORT
 
Constructor Summary
DataBufferFloat(float[][] dataArray, int size)
          Creates a new data buffer backed by the specified data banks.
DataBufferFloat(float[][] dataArray, int size, int[] offsets)
          Creates a new data buffer backed by the specified data banks, with the specified offsets to the first element in each bank.
DataBufferFloat(float[] dataArray, int size)
          Creates a new data buffer backed by the specified data bank.
DataBufferFloat(float[] dataArray, int size, int offset)
          Creates a new data buffer backed by the specified data bank, with the specified offset to the first element.
DataBufferFloat(int size)
          Creates a new data buffer with a single data bank containing the specified number of float elements.
DataBufferFloat(int size, int numBanks)
          Creates a new data buffer with the specified number of data banks, each containing the specified number of float elements.
 
Method Summary
 float[][] getBankData()
          Returns the array underlying this DataBuffer.
 float[] getData()
          Returns the first data bank.
 float[] getData(int bank)
          Returns a data bank.
 int getElem(int i)
          Returns an element from the first data bank.
 int getElem(int bank, int i)
          Returns an element from a particular data bank.
 double getElemDouble(int i)
          Returns an element from the first data bank, converted to a double.
 double getElemDouble(int bank, int i)
          Returns an element from a particular data bank, converted to a double.
 float getElemFloat(int i)
          Returns an element from the first data bank, converted to a float.
 float getElemFloat(int bank, int i)
          Returns an element from a particular data bank, converted to a float.
 void setElem(int i, int val)
          Sets an element in the first data bank.
 void setElem(int bank, int i, int val)
          Sets an element in a particular data bank.
 void setElemDouble(int i, double val)
          Sets an element in the first data bank.
 void setElemDouble(int bank, int i, double val)
          Sets an element in a particular data bank.
 void setElemFloat(int i, float val)
          Sets an element in the first data bank.
 void setElemFloat(int bank, int i, float val)
          Sets an element in a particular data bank.
 
Methods inherited from class java.awt.image.DataBuffer
getDataType, getDataTypeSize, getNumBanks, getOffset, getOffsets, getSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataBufferFloat

public DataBufferFloat(int size)
Creates a new data buffer with a single data bank containing the specified number of float elements.

Parameters:
size - the number of elements in the data bank.

DataBufferFloat

public DataBufferFloat(int size,
                       int numBanks)
Creates a new data buffer with the specified number of data banks, each containing the specified number of float elements.

Parameters:
size - the number of elements in the data bank.
numBanks - the number of data banks.

DataBufferFloat

public DataBufferFloat(float[] dataArray,
                       int size)
Creates a new data buffer backed by the specified data bank.

Note: there is no exception when dataArray is null, but in that case an exception will be thrown later if you attempt to access the data buffer.

Parameters:
dataArray - the data bank.
size - the number of elements in the data bank.

DataBufferFloat

public DataBufferFloat(float[] dataArray,
                       int size,
                       int offset)
Creates a new data buffer backed by the specified data bank, with the specified offset to the first element.

Note: there is no exception when dataArray is null, but in that case an exception will be thrown later if you attempt to access the data buffer.

Parameters:
dataArray - the data bank.
size - the number of elements in the data bank.
offset - the offset to the first element in the array.

DataBufferFloat

public DataBufferFloat(float[][] dataArray,
                       int size)
Creates a new data buffer backed by the specified data banks.

Parameters:
dataArray - the data banks.
size - the number of elements in the data bank.
Throws:
NullPointerException - if dataArray is null.

DataBufferFloat

public DataBufferFloat(float[][] dataArray,
                       int size,
                       int[] offsets)
Creates a new data buffer backed by the specified data banks, with the specified offsets to the first element in each bank.

Parameters:
dataArray - the data banks.
size - the number of elements in the data bank.
offsets - the offsets to the first element in each data bank.
Throws:
NullPointerException - if dataArray is null.
Method Detail

getData

public float[] getData()
Returns the first data bank.

Returns:
The first data bank.

getData

public float[] getData(int bank)
Returns a data bank.

Parameters:
bank - the bank index.
Returns:
A data bank.

getBankData

public float[][] getBankData()
Returns the array underlying this DataBuffer.

Returns:
The data banks.

getElem

public int getElem(int i)
Returns an element from the first data bank. The offset (specified in the constructor) is added to i before accessing the underlying data array.

Overrides:
getElem in class DataBuffer
Parameters:
i - the element index.
Returns:
The element.

getElem

public int getElem(int bank,
                   int i)
Returns an element from a particular data bank. The offset (specified in the constructor) is added to i before accessing the underlying data array.

Specified by:
getElem in class DataBuffer
Parameters:
bank - the bank index.
i - the element index.
Returns:
The element.

setElem

public void setElem(int i,
                    int val)
Sets an element in the first data bank. The offset (specified in the constructor) is added to i before updating the underlying data array.

Overrides:
setElem in class DataBuffer
Parameters:
i - the element index.
val - the new element value.

setElem

public void setElem(int bank,
                    int i,
                    int val)
Sets an element in a particular data bank. The offset (specified in the constructor) is added to i before updating the underlying data array.

Specified by:
setElem in class DataBuffer
Parameters:
bank - the data bank index.
i - the element index.
val - the new element value.

getElemFloat

public float getElemFloat(int i)
Description copied from class: DataBuffer
Returns an element from the first data bank, converted to a float. The offset (specified in the constructor) is added to i before accessing the underlying data array.

Overrides:
getElemFloat in class DataBuffer
Parameters:
i - the element index.
Returns:
The element.

getElemFloat

public float getElemFloat(int bank,
                          int i)
Description copied from class: DataBuffer
Returns an element from a particular data bank, converted to a float. The offset (specified in the constructor) is added to i before accessing the underlying data array.

Overrides:
getElemFloat in class DataBuffer
Parameters:
bank - the bank index.
i - the element index.
Returns:
The element.

setElemFloat

public void setElemFloat(int i,
                         float val)
Description copied from class: DataBuffer
Sets an element in the first data bank. The offset (specified in the constructor) is added to i before updating the underlying data array.

Overrides:
setElemFloat in class DataBuffer
Parameters:
i - the element index.
val - the new element value.

setElemFloat

public void setElemFloat(int bank,
                         int i,
                         float val)
Description copied from class: DataBuffer
Sets an element in a particular data bank. The offset (specified in the constructor) is added to i before updating the underlying data array.

Overrides:
setElemFloat in class DataBuffer
Parameters:
bank - the data bank index.
i - the element index.
val - the new element value.

getElemDouble

public double getElemDouble(int i)
Description copied from class: DataBuffer
Returns an element from the first data bank, converted to a double. The offset (specified in the constructor) is added to i before accessing the underlying data array.

Overrides:
getElemDouble in class DataBuffer
Parameters:
i - the element index.
Returns:
The element.

getElemDouble

public double getElemDouble(int bank,
                            int i)
Description copied from class: DataBuffer
Returns an element from a particular data bank, converted to a double. The offset (specified in the constructor) is added to i before accessing the underlying data array.

Overrides:
getElemDouble in class DataBuffer
Parameters:
bank - the bank index.
i - the element index.
Returns:
The element.

setElemDouble

public void setElemDouble(int i,
                          double val)
Description copied from class: DataBuffer
Sets an element in the first data bank. The offset (specified in the constructor) is added to i before updating the underlying data array.

Overrides:
setElemDouble in class DataBuffer
Parameters:
i - the element index.
val - the new element value.

setElemDouble

public void setElemDouble(int bank,
                          int i,
                          double val)
Description copied from class: DataBuffer
Sets an element in a particular data bank. The offset (specified in the constructor) is added to i before updating the underlying data array.

Overrides:
setElemDouble in class DataBuffer
Parameters:
bank - the data bank index.
i - the element index.
val - the new element value.