public class ObservableIntegerArrayImpl extends ObservableArrayBase<ObservableIntegerArray> implements ObservableIntegerArray
| Modifier and Type | Field and Description |
|---|---|
private int[] |
array |
private static int[] |
INITIAL |
private static int |
MAX_ARRAY_SIZE
The maximum size of array to allocate.
|
private int |
size |
| Constructor and Description |
|---|
ObservableIntegerArrayImpl()
Creates empty observable integer array
|
ObservableIntegerArrayImpl(int... elements)
Creates observable integer array with copy of given initial values
|
ObservableIntegerArrayImpl(ObservableIntegerArray src)
Creates observable integer array with copy of given observable integer array
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAll(int... elements)
Appends given
elements to the end of this array. |
void |
addAll(int[] src,
int srcIndex,
int length)
Appends a portion of given array to the end of this array.
|
void |
addAll(ObservableIntegerArray src)
Appends content of a given observable array to the end of this array.
|
void |
addAll(ObservableIntegerArray src,
int srcIndex,
int length)
Appends a portion of given observable array to the end of this array.
|
private void |
addAllInternal(int[] src,
int srcIndex,
int length) |
private void |
addAllInternal(ObservableIntegerArray src,
int srcIndex,
int length) |
void |
clear()
Empties the array by resizing it to 0.
|
void |
copyTo(int srcIndex,
int[] dest,
int destIndex,
int length)
Copies specified portion of array into
dest array. |
void |
copyTo(int srcIndex,
ObservableIntegerArray dest,
int destIndex,
int length)
Copies specified portion of array into
dest observable array. |
void |
ensureCapacity(int capacity)
Grows the capacity of this array if the current capacity is less than
given
capacity, does nothing if it already exceeds
the capacity. |
int |
get(int index)
Gets a single value of array.
|
private void |
growCapacity(int length) |
private static int |
hugeCapacity(int minCapacity) |
private void |
rangeCheck(int size) |
private void |
rangeCheck(int[] src,
int srcIndex,
int length) |
private void |
rangeCheck(ObservableIntegerArray src,
int srcIndex,
int length) |
void |
resize(int newSize)
Sets new length of data in this array.
|
void |
set(int index,
int value)
Sets a single value in the array.
|
void |
set(int destIndex,
int[] src,
int srcIndex,
int length)
Copies a portion of specified array into this observable array.
|
void |
set(int destIndex,
ObservableIntegerArray src,
int srcIndex,
int length)
Copies a portion of specified observable array into this observable array.
|
void |
setAll(int[] src)
Replaces this observable array content with given elements.
|
void |
setAll(int[] src,
int srcIndex,
int length)
Replaces this observable array content with a copy of portion of
a given array.
|
void |
setAll(ObservableIntegerArray src)
Replaces this observable array content with a copy of given observable array.
|
void |
setAll(ObservableIntegerArray src,
int srcIndex,
int length)
Replaces this observable array content with a portion of a given
observable array.
|
private void |
setAllInternal(int[] src,
int srcIndex,
int length) |
private void |
setAllInternal(ObservableIntegerArray src,
int srcIndex,
int length) |
int |
size()
Retrieves length of data in this array.
|
int[] |
toArray(int[] dest)
Returns an array containing copy of the observable array.
|
int[] |
toArray(int index,
int[] dest,
int length)
Returns an array containing copy of specified portion of the observable array.
|
java.lang.String |
toString() |
void |
trimToSize()
Shrinks the capacity to the current size of data in the array.
|
addListener, addListener, fireChange, removeListener, removeListenerclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddListener, removeListeneraddListener, removeListenerprivate static final int[] INITIAL
private int[] array
private int size
private static final int MAX_ARRAY_SIZE
public ObservableIntegerArrayImpl()
public ObservableIntegerArrayImpl(int... elements)
elements - initial values to copy to observable integer arraypublic ObservableIntegerArrayImpl(ObservableIntegerArray src)
src - observable integer array to copypublic void clear()
ObservableArrayclear in interface ObservableArray<ObservableIntegerArray>ObservableArray.trimToSize()public int size()
ObservableArraysize in interface ObservableArray<ObservableIntegerArray>private void addAllInternal(ObservableIntegerArray src, int srcIndex, int length)
private void addAllInternal(int[] src,
int srcIndex,
int length)
public void addAll(ObservableIntegerArray src)
ObservableIntegerArrayaddAll in interface ObservableIntegerArraysrc - observable array with elements to appendpublic void addAll(int... elements)
ObservableIntegerArrayelements to the end of this array. Capacity is increased
if necessary to match the new size of the data.addAll in interface ObservableIntegerArrayelements - elements to appendpublic void addAll(ObservableIntegerArray src, int srcIndex, int length)
ObservableIntegerArrayaddAll in interface ObservableIntegerArraysrc - source observable arraysrcIndex - starting position in source arraylength - length of portion to appendpublic void addAll(int[] src,
int srcIndex,
int length)
ObservableIntegerArrayaddAll in interface ObservableIntegerArraysrc - source arraysrcIndex - starting position in source arraylength - length of portion to appendprivate void setAllInternal(ObservableIntegerArray src, int srcIndex, int length)
private void setAllInternal(int[] src,
int srcIndex,
int length)
public void setAll(ObservableIntegerArray src)
ObservableIntegerArraysetAll in interface ObservableIntegerArraysrc - source observable array to copy.public void setAll(ObservableIntegerArray src, int srcIndex, int length)
ObservableIntegerArraysetAll in interface ObservableIntegerArraysrc - source observable array to copy.srcIndex - starting position in source observable arraylength - length of a portion to copypublic void setAll(int[] src,
int srcIndex,
int length)
ObservableIntegerArraysetAll in interface ObservableIntegerArraysrc - source array to copy.srcIndex - starting position in source observable arraylength - length of a portion to copypublic void setAll(int[] src)
ObservableIntegerArraysetAll in interface ObservableIntegerArraysrc - elements to put into array contentpublic void set(int destIndex,
int[] src,
int srcIndex,
int length)
ObservableIntegerArraySystem.arraycopy() method.set in interface ObservableIntegerArraydestIndex - the starting destination position in this observable arraysrc - source array to copysrcIndex - starting position in source arraylength - length of portion to copypublic void set(int destIndex,
ObservableIntegerArray src,
int srcIndex,
int length)
ObservableIntegerArraySystem.arraycopy() method.set in interface ObservableIntegerArraydestIndex - the starting destination position in this observable arraysrc - source observable array to copysrcIndex - starting position in source arraylength - length of portion to copypublic int[] toArray(int[] dest)
ObservableIntegerArraytoArray in interface ObservableIntegerArraydest - the array into which the observable array to be copied,
if it is big enough; otherwise, a new int array is allocated.
Ignored, if null.public int get(int index)
ObservableIntegerArrayget in interface ObservableIntegerArrayindex - index of element to getpublic void set(int index,
int value)
ObservableIntegerArrayset in interface ObservableIntegerArrayindex - index of the value to setvalue - new value for the given indexpublic int[] toArray(int index,
int[] dest,
int length)
ObservableIntegerArraytoArray in interface ObservableIntegerArrayindex - starting position in the observable arraydest - the array into which specified portion of the observable array
to be copied, if it is big enough;
otherwise, a new int array is allocated.
Ignored, if null.length - length of portion to copypublic void copyTo(int srcIndex,
int[] dest,
int destIndex,
int length)
ObservableIntegerArraydest array. Throws
the same exceptions as System.arraycopy() method.copyTo in interface ObservableIntegerArraysrcIndex - starting position in the observable arraydest - destination arraydestIndex - starting position in destination arraylength - length of portion to copypublic void copyTo(int srcIndex,
ObservableIntegerArray dest,
int destIndex,
int length)
ObservableIntegerArraydest observable array.
Throws the same exceptions as System.arraycopy() method.copyTo in interface ObservableIntegerArraysrcIndex - starting position in the observable arraydest - destination observable arraydestIndex - starting position in destination observable arraylength - length of portion to copypublic void resize(int newSize)
ObservableArrayresize in interface ObservableArray<ObservableIntegerArray>newSize - new length of data in this arrayprivate void growCapacity(int length)
public void ensureCapacity(int capacity)
ObservableArraycapacity, does nothing if it already exceeds
the capacity.ensureCapacity in interface ObservableArray<ObservableIntegerArray>private static int hugeCapacity(int minCapacity)
public void trimToSize()
ObservableArraytrimToSize in interface ObservableArray<ObservableIntegerArray>private void rangeCheck(int size)
private void rangeCheck(ObservableIntegerArray src, int srcIndex, int length)
private void rangeCheck(int[] src,
int srcIndex,
int length)
public java.lang.String toString()
toString in class java.lang.Object