Java Reference
In-Depth Information
The
ArrayChangeListener
interface has only one method:
onChanged(T observableArray, boolean
sizeChanged, int from, int to)
. Notice that instead of passing a
Change
object to the
onChange()
method,
as is done in
ListChangeListener
,
MapChangeListener
, and
SetChangeListener
,
ArrayChangeListener
passes
characteristics of the change directly as parameters. The first parameter is the
ObservableArray
itself. The
sizeChanged
parameter will be
true
if the size of the observable array has changed. The
from
and
to
parameters mark
the range of the changed elements, inclusive on the
from
end, and exclusive on the
to
end.
The
ObservableIntegerArray
and
ObservableFloatArray
interfaces have methods that manipulate the data in a
type-specific way. We list the methods of
ObservableIntegerArray
(methods of
ObservableFloatArray
are similar):
•
copyTo(int srcIndex, int[] dest, int destIndex, int length)
•
copyTo(int srcIndex, ObservableIntegerArray dest, int destIndex, int length)
•
int get(int index)
•
addAll(int... elements)
•
addAll(ObservableIntegerArray src)
•
addAll(int[] src, int srcIndex, int length)
•
addAll(ObservableIntegerArray src, int srcIndex, int length)
•
setAll(int... elements)
•
setAll(int[] src, int srcIndex, int length)
setAll(ObservableIntegerArray src)
•
setAll(ObservableIntegerArray src, int srcIndex, int length)
•
set(int destIndex, int[] src, int srcIndex, int length)
•
set(int destIndex, ObservableIntegerArray src, int srcIndex, int length)
•
set(int index, int value)
•
int[] toArray(int[] dest)
•
int[] toArray(int srcIndex, int[] dest, int length)
The
addAll()
methods append to the
ObservableIntegerArray
. The
setAll()
methods replace the content
of the
ObservableIntegerArray
. The sources to these two sets of methods can be a vararg array of
int
s, an
ObservableIntegerArray
, an
int
array with a starting index and a length, or an
ObservableIntegerArray
with a starting
index and a length. The
get()
method returns the value at the specified index. The
set()
methods replace a portion
of the
ObservableIntegerArray
with new values starting at the index specified in the first parameter. The replacement
data can be a single
int
value, an
int
array with a starting index and a length, or an
ObservableIntegerArray
with
a starting index and a length. If there is not enough room in the original
ObservableIntegerArray
to accommodate
the replacement data, an
ArrayIndexOutOfBoundsException
is thrown. The
copyTo()
methods copy a portion of the
ObservableIntegerArray
starting at the specified
srcIndex
into a destination
int
array or
ObservableIntegerArray
starting at the specified
destIndex
. The
length
parameter dictates the length of the portion copied. If there are not
enough elements in the source
ObservableIntegerArray
to form a portion of the specified length, or if there is not
enough room in the destination to accommodate the copied portion, an
ArrayIndexOutOfBoundsException
is thrown.
The
toArray()
methods copy the content of the
ObservableIntegerArray
into an
int
array. If the
dest
parameter is not
null and has enough room, it is filled and returned; otherwise a new
int
array is allocated, filled, and returned. In the
form where the
srcIndex
and
length
are specified, if there are not enough elements in the
ObservableIntegerArray
, an
ArrayIndexOutOfBoundsException
is thrown.
•
Search WWH ::
Custom Search