APIdia Launch Partner
Top Description Fields Constructors Methods
java.awt.image

public final Class DataBufferDouble

extends DataBuffer
Class Inheritance
Imports
java.util.Objects

This class extends DataBuffer and stores data internally in double form.

Note that some implementations may function more efficiently if they can maintain control over how the data for an image is stored. For example, optimizations such as caching an image in video memory require that the implementation track all modifications to that data. Other implementations may operate better if they can store the data in locations other than a Java array. To maintain optimum compatibility with various optimizations it is best to avoid constructors and methods which expose the underlying storage as a Java array as noted below in the documentation for those methods.

Since
1.4

Field Summary

Modifier and TypeField and Description
pack-priv double[][]
bankdata

The array of data banks.

pack-priv double[]
data

A reference to the default data bank.

Inherited from java.awt.image.DataBuffer:
banksdataTypeoffsetoffsetssizetheTrackableTYPE_BYTETYPE_DOUBLETYPE_FLOATTYPE_INTTYPE_SHORTTYPE_UNDEFINEDTYPE_USHORT

Constructor Summary

AccessConstructor and Description
public
DataBufferDouble(int
The number of elements in the DataBuffer.
size
)

Constructs a double-based DataBuffer with a specified size.

public
DataBufferDouble(int
The number of elements in each bank of the DataBuffer.
size
,
int
The number of banks in the DataBuffer.
numBanks
)

Constructs a double-based DataBuffer with a specified number of banks, all of which are of a specified size.

public
DataBufferDouble(double[]
An array of doubles to be used as the first and only bank of this DataBuffer.
dataArray
,
int
The number of elements of the array to be used.
size
)

Constructs a double-based DataBuffer with the specified data array.

public
DataBufferDouble(double[]
An array of doubles to be used as the first and only bank of this DataBuffer.
dataArray
,
int
The number of elements of the array to be used.
size
,
int
The offset of the first element of the array that will be used.
offset
)

Constructs a double-based DataBuffer with the specified data array.

public
DataBufferDouble(double[][]
An array of arrays of doubles to be used as the banks of this DataBuffer.
dataArray
,
int
The number of elements of each array to be used.
size
)

Constructs a double-based DataBuffer with the specified data arrays.

public
DataBufferDouble(double[][]
An array of arrays of doubles to be used as the banks of this DataBuffer.
dataArray
,
int
The number of elements of each array to be used.
size
,
int[]
An array of integer offsets, one for each bank.
offsets
)

Constructs a double-based DataBuffer with the specified data arrays, size, and per-bank offsets.

Method Summary

Modifier and TypeMethod and Description
public double[][]

Returns:

all data arrays from this data buffer.
getBankData
()

Returns the data array for all banks.

public double[]

Returns:

the first double data array.
getData
()

Returns the default (first) double data array.

public double[]

Returns:

the data array specified by bank.
getData
(int
the data array
bank
)

Returns the data array for the specified bank.

public int

Returns:

The data entry as an int.
getElem
(int
The desired data array element.
i
)

Overrides java.awt.image.DataBuffer.getElem.

Returns the requested data array element from the first (default) bank as an int.

public int

Returns:

The data entry as an int.
getElem
(int
The bank number.
bank
,
int
The desired data array element.
i
)

Implements abstract java.awt.image.DataBuffer.getElem.

Returns the requested data array element from the specified bank as an int.

public double

Returns:

The data entry as a double.
getElemDouble
(int
The desired data array element.
i
)

Overrides java.awt.image.DataBuffer.getElemDouble.

Returns the requested data array element from the first (default) bank as a double.

public double

Returns:

The data entry as a double.
getElemDouble
(int
The bank number.
bank
,
int
The desired data array element.
i
)

Overrides java.awt.image.DataBuffer.getElemDouble.

Returns the requested data array element from the specified bank as a double.

public float

Returns:

The data entry as a float.
getElemFloat
(int
The desired data array element.
i
)

Overrides java.awt.image.DataBuffer.getElemFloat.

Returns the requested data array element from the first (default) bank as a float.

public float

Returns:

The data entry as a float.
getElemFloat
(int
The bank number.
bank
,
int
The desired data array element.
i
)

Overrides java.awt.image.DataBuffer.getElemFloat.

Returns the requested data array element from the specified bank as a float.

public void
setElem(int
The desired data array element.
i
,
int
The value to be set.
val
)

Overrides java.awt.image.DataBuffer.setElem.

Sets the requested data array element in the first (default) bank to the given int.

public void
setElem(int
The bank number.
bank
,
int
The desired data array element.
i
,
int
The value to be set.
val
)

Implements abstract java.awt.image.DataBuffer.setElem.

Sets the requested data array element in the specified bank to the given int.

public void
setElemDouble(int
The desired data array element.
i
,
double
The value to be set.
val
)

Overrides java.awt.image.DataBuffer.setElemDouble.

Sets the requested data array element in the first (default) bank to the given double.

public void
setElemDouble(int
The bank number.
bank
,
int
The desired data array element.
i
,
double
The value to be set.
val
)

Overrides java.awt.image.DataBuffer.setElemDouble.

Sets the requested data array element in the specified bank to the given double.

public void
setElemFloat(int
The desired data array element.
i
,
float
The value to be set.
val
)

Overrides java.awt.image.DataBuffer.setElemFloat.

Sets the requested data array element in the first (default) bank to the given float.

public void
setElemFloat(int
The bank number.
bank
,
int
The desired data array element.
i
,
float
The value to be set.
val
)

Overrides java.awt.image.DataBuffer.setElemFloat.

Sets the requested data array element in the specified bank to the given float.

Inherited from java.awt.image.DataBuffer:
checkArraySizecheckArraySizecheckBankcheckBankSizecheckIndexcheckIndexcheckNumBankscheckOffsetcheckSizegetDataTypegetDataTypeSizegetNumBanksgetOffsetgetOffsetsgetSizetoIntArray

Field Detail

bankdataback to summary
pack-priv double[][] bankdata

The array of data banks.

databack to summary
pack-priv double[] data

A reference to the default data bank.

Constructor Detail

DataBufferDoubleback to summary
public DataBufferDouble(int size)

Constructs a double-based DataBuffer with a specified size.

Parameters
size:int

The number of elements in the DataBuffer.

Exceptions
IllegalArgumentException:
if size is less than or equal to zero.
DataBufferDoubleback to summary
public DataBufferDouble(int size, int numBanks)

Constructs a double-based DataBuffer with a specified number of banks, all of which are of a specified size.

Parameters
size:int

The number of elements in each bank of the DataBuffer.

numBanks:int

The number of banks in the DataBuffer.

Exceptions
IllegalArgumentException:
if size or numBanks is less than or equal to zero.
DataBufferDoubleback to summary
public DataBufferDouble(double[] dataArray, int size)

Constructs a double-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.

Note that DataBuffer objects created by this constructor may be incompatible with performance optimizations used by some implementations (such as caching an associated image in video memory).

Parameters
dataArray:double[]

An array of doubles to be used as the first and only bank of this DataBuffer.

size:int

The number of elements of the array to be used.

Exceptions
NullPointerException:
if dataArray is null.
IllegalArgumentException:
if size is less than or equal to zero, or is greater than the length of dataArray.
DataBufferDoubleback to summary
public DataBufferDouble(double[] dataArray, int size, int offset)

Constructs a double-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.

Note that DataBuffer objects created by this constructor may be incompatible with performance optimizations used by some implementations (such as caching an associated image in video memory).

Parameters
dataArray:double[]

An array of doubles to be used as the first and only bank of this DataBuffer.

size:int

The number of elements of the array to be used.

offset:int

The offset of the first element of the array that will be used.

Exceptions
NullPointerException:
if dataArray is null.
IllegalArgumentException:
if size is less than or equal to zero, or offset is less than zero, or (offset + size) is greater than the length of dataArray.
DataBufferDoubleback to summary
public DataBufferDouble(double[][] dataArray, int size)

Constructs a double-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.

Note that DataBuffer objects created by this constructor may be incompatible with performance optimizations used by some implementations (such as caching an associated image in video memory).

Parameters
dataArray:double[][]

An array of arrays of doubles to be used as the banks of this DataBuffer.

size:int

The number of elements of each array to be used.

Exceptions
NullPointerException:
  • if dataArray is null.
  • if any bank of dataArray is null.
IllegalArgumentException:
  • if size is less than or equal to zero.
  • if dataArray does not have at least one bank.
  • if the length of any bank of dataArray is less than size.
DataBufferDoubleback to summary
public DataBufferDouble(double[][] dataArray, int size, int[] offsets)

Constructs a double-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.

Note that DataBuffer objects created by this constructor may be incompatible with performance optimizations used by some implementations (such as caching an associated image in video memory).

Parameters
dataArray:double[][]

An array of arrays of doubles to be used as the banks of this DataBuffer.

size:int

The number of elements of each array to be used.

offsets:int[]

An array of integer offsets, one for each bank.

Exceptions
IllegalArgumentException:
  • if size is less than or equal to zero.
  • if dataArray does not have at least one bank.
  • if any element of offsets is less than zero.
  • if the length of any bank of dataArray is less than (size + offsets[bankIndex]).
NullPointerException:
  • if dataArray is null.
  • if any bank of dataArray is null.
  • if offsets is null.
ArrayIndexOutOfBoundsException:
if the lengths of dataArray and offsets differ.

Method Detail

getBankDataback to summary
public double[][] getBankData()

Returns the data array for all banks.

Note that calling this method may cause this DataBuffer object to be incompatible with performance optimizations used by some implementations (such as caching an associated image in video memory).

Returns:double[][]

all data arrays from this data buffer.

getDataback to summary
public double[] getData()

Returns the default (first) double data array.

Note that calling this method may cause this DataBuffer object to be incompatible with performance optimizations used by some implementations (such as caching an associated image in video memory).

Returns:double[]

the first double data array.

getDataback to summary
public double[] getData(int bank)

Returns the data array for the specified bank.

Note that calling this method may cause this DataBuffer object to be incompatible with performance optimizations used by some implementations (such as caching an associated image in video memory).

Parameters
bank:int

the data array

Returns:double[]

the data array specified by bank.

Exceptions
ArrayIndexOutOfBoundsException:
if bank is not a valid bank index.
getElemback to summary
public int getElem(int i)

Overrides java.awt.image.DataBuffer.getElem.

Returns the requested data array element from the first (default) bank as an int.

Parameters
i:int

The desired data array element.

Returns:int

The data entry as an int.

Exceptions
ArrayIndexOutOfBoundsException:
if (i + getOffset()) is not a valid index.
See Also
setElem(int, int), setElem(int, int, int)
getElemback to summary
public int getElem(int bank, int i)

Implements abstract java.awt.image.DataBuffer.getElem.

Returns the requested data array element from the specified bank as an int.

Parameters
bank:int

The bank number.

i:int

The desired data array element.

Returns:int

The data entry as an int.

Exceptions
ArrayIndexOutOfBoundsException:
if bank is not a valid bank index, or (i + getOffsets()[bank]) is not a valid index into the bank.
See Also
setElem(int, int), setElem(int, int, int)
getElemDoubleback to summary
public double getElemDouble(int i)

Overrides java.awt.image.DataBuffer.getElemDouble.

Returns the requested data array element from the first (default) bank as a double.

Parameters
i:int

The desired data array element.

Returns:double

The data entry as a double.

Exceptions
ArrayIndexOutOfBoundsException:
if (i + getOffset()) is not a valid index.
See Also
setElemDouble(int, double), setElemDouble(int, int, double)
getElemDoubleback to summary
public double getElemDouble(int bank, int i)

Overrides java.awt.image.DataBuffer.getElemDouble.

Returns the requested data array element from the specified bank as a double.

Parameters
bank:int

The bank number.

i:int

The desired data array element.

Returns:double

The data entry as a double.

Exceptions
ArrayIndexOutOfBoundsException:
if bank is not a valid bank index, or (i + getOffsets()[bank]) is not a valid index into the bank.
See Also
setElemDouble(int, double), setElemDouble(int, int, double)
getElemFloatback to summary
public float getElemFloat(int i)

Overrides java.awt.image.DataBuffer.getElemFloat.

Returns the requested data array element from the first (default) bank as a float.

Parameters
i:int

The desired data array element.

Returns:float

The data entry as a float.

Exceptions
ArrayIndexOutOfBoundsException:
if (i + getOffset()) is not a valid index.
See Also
setElemFloat(int, float), setElemFloat(int, int, float)
getElemFloatback to summary
public float getElemFloat(int bank, int i)

Overrides java.awt.image.DataBuffer.getElemFloat.

Returns the requested data array element from the specified bank as a float.

Parameters
bank:int

The bank number.

i:int

The desired data array element.

Returns:float

The data entry as a float.

Exceptions
ArrayIndexOutOfBoundsException:
if bank is not a valid bank index, or (i + getOffsets()[bank]) is not a valid index into the bank.
See Also
setElemFloat(int, float), setElemFloat(int, int, float)
setElemback to summary
public void setElem(int i, int val)

Overrides java.awt.image.DataBuffer.setElem.

Sets the requested data array element in the first (default) bank to the given int.

Parameters
i:int

The desired data array element.

val:int

The value to be set.

Exceptions
ArrayIndexOutOfBoundsException:
if (i + getOffset()) is not a valid index.
See Also
getElem(int), getElem(int, int)
setElemback to summary
public void setElem(int bank, int i, int val)

Implements abstract java.awt.image.DataBuffer.setElem.

Sets the requested data array element in the specified bank to the given int.

Parameters
bank:int

The bank number.

i:int

The desired data array element.

val:int

The value to be set.

Exceptions
ArrayIndexOutOfBoundsException:
if bank is not a valid bank index, or (i + getOffsets()[bank]) is not a valid index into the bank.
See Also
getElem(int), getElem(int, int)
setElemDoubleback to summary
public void setElemDouble(int i, double val)

Overrides java.awt.image.DataBuffer.setElemDouble.

Sets the requested data array element in the first (default) bank to the given double.

Parameters
i:int

The desired data array element.

val:double

The value to be set.

Exceptions
ArrayIndexOutOfBoundsException:
if (i + getOffset()) is not a valid index.
See Also
getElemDouble(int), getElemDouble(int, int)
setElemDoubleback to summary
public void setElemDouble(int bank, int i, double val)

Overrides java.awt.image.DataBuffer.setElemDouble.

Sets the requested data array element in the specified bank to the given double.

Parameters
bank:int

The bank number.

i:int

The desired data array element.

val:double

The value to be set.

Exceptions
ArrayIndexOutOfBoundsException:
if bank is not a valid bank index, or (i + getOffsets()[bank]) is not a valid index into the bank.
See Also
getElemDouble(int), getElemDouble(int, int)
setElemFloatback to summary
public void setElemFloat(int i, float val)

Overrides java.awt.image.DataBuffer.setElemFloat.

Sets the requested data array element in the first (default) bank to the given float.

Parameters
i:int

The desired data array element.

val:float

The value to be set.

Exceptions
ArrayIndexOutOfBoundsException:
if (i + getOffset()) is not a valid index.
See Also
getElemFloat(int), getElemFloat(int, int)
setElemFloatback to summary
public void setElemFloat(int bank, int i, float val)

Overrides java.awt.image.DataBuffer.setElemFloat.

Sets the requested data array element in the specified bank to the given float.

Parameters
bank:int

The bank number.

i:int

The desired data array element.

val:float

The value to be set.

Exceptions
ArrayIndexOutOfBoundsException:
if bank is not a valid bank index, or (i + getOffsets()[bank]) is not a valid index into the bank.
See Also
getElemFloat(int), getElemFloat(int, int)