DataBufferFloatpublic final class DataBufferFloat extends DataBuffer This class extends DataBuffer and stores data internally
in float form. |
Fields Summary |
---|
float[] | bankdataThe array of data banks. | float[] | dataA reference to the default data bank. |
Constructors Summary |
---|
public DataBufferFloat(int size)Constructs a float -based DataBuffer
with a specified size.
super(TYPE_FLOAT, size);
data = new float[size];
bankdata = new float[1][];
bankdata[0] = data;
| public DataBufferFloat(int size, int numBanks)Constructs a float -based DataBuffer
with a specified number of banks, all of which are of a
specified size.
super(TYPE_FLOAT, size, numBanks);
bankdata = new float[numBanks][];
for (int i= 0; i < numBanks; i++) {
bankdata[i] = new float[size];
}
data = bankdata[0];
| public DataBufferFloat(float[] dataArray, int size)Constructs a float -based DataBuffer
with the specified data array. Only the first
size elements are available for use by this
DataBuffer . The array must be large enough to
hold size elements.
super(TYPE_FLOAT, size);
data = dataArray;
bankdata = new float[1][];
bankdata[0] = data;
| public DataBufferFloat(float[] dataArray, int size, int offset)Constructs a float -based DataBuffer
with the specified data array. Only the elements between
offset and offset + size - 1 are
available for use by this DataBuffer . The array
must be large enough to hold offset + size
elements.
super(TYPE_FLOAT, size, 1, offset);
data = dataArray;
bankdata = new float[1][];
bankdata[0] = data;
| public DataBufferFloat(float[] dataArray, int size)Constructs a float -based DataBuffer
with the specified data arrays. Only the first
size elements of each array are available for use
by this DataBuffer . The number of banks will be
equal to dataArray.length .
super(TYPE_FLOAT, size, dataArray.length);
bankdata = (float[][]) dataArray.clone();
data = bankdata[0];
| public DataBufferFloat(float[] dataArray, int size, int[] offsets)Constructs a float -based DataBuffer
with the specified data arrays, size, and per-bank offsets.
The number of banks is equal to dataArray.length .
Each array must be at least as large as size plus the
corresponding offset. There must be an entry in the offsets
array for each data array.
super(TYPE_FLOAT, size,dataArray.length, offsets);
bankdata = (float[][]) dataArray.clone();
data = bankdata[0];
|
Methods Summary |
---|
public float[][] | getBankData()Returns the data array for all banks.
return (float[][]) bankdata.clone();
| public float[] | getData()Returns the default (first) float data array.
return data;
| public float[] | getData(int bank)Returns the data array for the specified bank.
return bankdata[bank];
| public int | getElem(int i)Returns the requested data array element from the first
(default) bank as an int .
return (int)(data[i+offset]);
| public int | getElem(int bank, int i)Returns the requested data array element from the specified
bank as an int .
return (int)(bankdata[bank][i+offsets[bank]]);
| public double | getElemDouble(int i)Returns the requested data array element from the first
(default) bank as a double .
return (double)data[i+offset];
| public double | getElemDouble(int bank, int i)Returns the requested data array element from the specified
bank as a double .
return (double)bankdata[bank][i+offsets[bank]];
| public float | getElemFloat(int i)Returns the requested data array element from the first
(default) bank as a float .
return data[i+offset];
| public float | getElemFloat(int bank, int i)Returns the requested data array element from the specified
bank as a float .
return bankdata[bank][i+offsets[bank]];
| public void | setElem(int i, int val)Sets the requested data array element in the first (default)
bank to the given int .
data[i+offset] = (float)val;
| public void | setElem(int bank, int i, int val)Sets the requested data array element in the specified bank to
the given int .
bankdata[bank][i+offsets[bank]] = (float)val;
| public void | setElemDouble(int i, double val)Sets the requested data array element in the first (default)
bank to the given double .
data[i+offset] = (float)val;
| public void | setElemDouble(int bank, int i, double val)Sets the requested data array element in the specified bank to
the given double .
bankdata[bank][i+offsets[bank]] = (float)val;
| public void | setElemFloat(int i, float val)Sets the requested data array element in the first (default)
bank to the given float .
data[i+offset] = val;
| public void | setElemFloat(int bank, int i, float val)Sets the requested data array element in the specified bank to
the given float .
bankdata[bank][i+offsets[bank]] = val;
|
|