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