public class FloatPointList
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected int |
modCount
The number of times this list has been structurally modified.
|
Constructor and Description |
---|
FloatPointList()
Constructs an empty list with an initial capacity of ten.
|
FloatPointList(float[] points)
Constructs an empty list with the specified initial capacity.
|
FloatPointList(int initialCapacity)
Constructs an empty list with the specified initial capacity.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(float e)
Appends the specified element to the end of this list.
|
void |
add(int index,
float element)
Inserts the specified element at the specified position in this
list.
|
boolean |
addAll(float[] a)
Appends all of the elements in the specified collection to the end of
this list, in the order that they are returned by the
specified collection's Iterator.
|
boolean |
addAll(int index,
float[] a)
Inserts all of the elements in the specified collection into this
list, starting at the specified position.
|
boolean |
addPoint(float[] point)
Appends the specified element to the end of this list.
|
boolean |
addPoint(float x,
float y)
Appends the specified element to the end of this list.
|
void |
addPoint(int pointIndex,
float[] point)
Inserts the specified element at the specified position in this
list.
|
void |
addPoint(int pointIndex,
float x,
float y)
Inserts the specified element at the specified position in this
list.
|
void |
clear()
Removes all of the elements from this list.
|
float[] |
createArray() |
void |
ensureCapacity(int minCapacity)
Increases the capacity of this ArrayList instance, if
necessary, to ensure that it can hold at least the number of elements
specified by the minimum capacity argument.
|
boolean |
equals(java.lang.Object o)
Compares the specified object with this list for equality.
|
float |
get(int index)
Returns the element at the specified position in this list.
|
float[] |
getPoint(int pointIndex)
Returns the element at the specified position in this list.
|
float[] |
getPoint(int pointIndex,
float[] dst)
Returns the element at the specified position in this list.
|
int |
hashCode()
Returns the hash code value for this list.
|
boolean |
isEmpty()
Returns true if this list contains no elements.
|
FloatPointList |
mapPoints(android.graphics.Matrix matrix) |
int |
pointCount()
Returns the number of points in this list.
|
float[] |
rawArray() |
float |
remove(int index)
Removes the element at the specified position in this list.
|
boolean |
remove(java.lang.Object o)
Removes the first occurrence of the specified element from this list,
if it is present.
|
void |
removePoint(int pointIndex)
Removes the element at the specified position in this list.
|
protected void |
removeRange(int fromIndex,
int toIndex)
Removes from this list all of the elements whose index is between
fromIndex , inclusive, and toIndex , exclusive. |
float |
set(int index,
float element)
Replaces the element at the specified position in this list with
the specified element.
|
void |
set(int pointIndex,
float[] point)
Replaces the element at the specified position in this list with
the specified element.
|
int |
size()
Returns the number of elements in this list.
|
void |
trimToSize()
Trims the capacity of this ArrayList instance to be the
list's current size.
|
protected transient int modCount
This field is used by the iterator and list iterator implementation
returned by the iterator
and listIterator
methods.
If the value of this field changes unexpectedly, the iterator (or list
iterator) will throw a ConcurrentModificationException
in
response to the next
, remove
, previous
,
set
or add
operations. This provides
fail-fast behavior, rather than non-deterministic behavior in
the face of concurrent modification during iteration.
Use of this field by subclasses is optional. If a subclass
wishes to provide fail-fast iterators (and list iterators), then it
merely has to increment this field in its add(int, E)
and
remove(int)
methods (and any other methods that it overrides
that result in structural modifications to the list). A single call to
add(int, E)
or remove(int)
must add no more than
one to this field, or the iterators (and list iterators) will throw
bogus ConcurrentModificationExceptions
. If an implementation
does not wish to provide fail-fast iterators, this field may be
ignored.
public FloatPointList(int initialCapacity)
initialCapacity
- the initial capacity of the listjava.lang.IllegalArgumentException
- if the specified initial capacity
is negativepublic FloatPointList(@NonNull float[] points)
points
- the initial point list to copy intojava.lang.IllegalArgumentException
- if the specified initial capacity
is negativepublic FloatPointList()
public float[] createArray()
public float[] rawArray()
public FloatPointList mapPoints(android.graphics.Matrix matrix)
public void trimToSize()
public void ensureCapacity(int minCapacity)
minCapacity
- the desired minimum capacitypublic int size()
public int pointCount()
public boolean isEmpty()
public float get(int index)
index
- index of the element to returnjava.lang.IndexOutOfBoundsException
@CheckResult public float[] getPoint(int pointIndex)
pointIndex
- index of the element to returnjava.lang.IndexOutOfBoundsException
public float[] getPoint(int pointIndex, float[] dst)
pointIndex
- index of the element to returndst
- destination elementjava.lang.IndexOutOfBoundsException
public float set(int index, float element)
index
- index of the element to replaceelement
- element to be stored at the specified positionjava.lang.IndexOutOfBoundsException
public void set(int pointIndex, float[] point)
pointIndex
- index of the element to replacepoint
- element to be stored at the specified positionjava.lang.IndexOutOfBoundsException
public boolean add(float e)
e
- element to be appended to this listpublic boolean addPoint(@NonNull float[] point)
point
- point to be appended to this listpublic boolean addPoint(@NonNull float x, float y)
x
- point x coordinate to be appended to this listy
- point y coordinate to be appended to this listpublic void add(int index, float element)
index
- index at which the specified element is to be insertedelement
- element to be insertedjava.lang.IndexOutOfBoundsException
public void addPoint(int pointIndex, float[] point)
pointIndex
- index at which the specified element is to be insertedpoint
- element to be insertedjava.lang.IndexOutOfBoundsException
public void addPoint(int pointIndex, float x, float y)
pointIndex
- index at which the specified element is to be insertedx
- point x coordinate to be insertedy
- point y coordinate to be insertedjava.lang.IndexOutOfBoundsException
public float remove(int index)
index
- the index of the element to be removedjava.lang.IndexOutOfBoundsException
public void removePoint(int pointIndex)
pointIndex
- the index of the element to be removedjava.lang.IndexOutOfBoundsException
public boolean remove(java.lang.Object o)
o
- element to be removed from this list, if presentpublic void clear()
public boolean addAll(float[] a)
a
- collection containing elements to be added to this listjava.lang.NullPointerException
- if the specified collection is nullpublic boolean addAll(int index, float[] a)
index
- index at which to insert the first element from the
specified collectiona
- collection containing elements to be added to this listjava.lang.IndexOutOfBoundsException
java.lang.NullPointerException
- if the specified collection is nullprotected void removeRange(int fromIndex, int toIndex)
fromIndex
, inclusive, and toIndex
, exclusive.
Shifts any succeeding elements to the left (reduces their index).
This call shortens the list by (toIndex - fromIndex)
elements.
(If toIndex==fromIndex
, this operation has no effect.)java.lang.IndexOutOfBoundsException
- if fromIndex
or
toIndex
is out of range
(fromIndex < 0 ||
fromIndex >= size() ||
toIndex > size() ||
toIndex < fromIndex
)public boolean equals(java.lang.Object o)
true
if and only if the specified object is also a list, both
lists have the same size, and all corresponding pairs of elements in
the two lists are equal. (Two elements e1
and
e2
are equal if (e1==null ? e2==null :
e1.equals(e2))
.) In other words, two lists are defined to be
equal if they contain the same elements in the same order.
This implementation first checks if the specified object is this
list. If so, it returns true
; if not, it checks if the
specified object is a list. If not, it returns false
; if so,
it iterates over both lists, comparing corresponding pairs of elements.
If any comparison returns false
, this method returns
false
. If either iterator runs out of elements before the
other it returns false
(as the lists are of unequal length);
otherwise it returns true
when the iterations complete.
equals
in class java.lang.Object
o
- the object to be compared for equality with this listtrue
if the specified object is equal to this listpublic int hashCode()
This implementation uses exactly the code that is used to define the
list hash function in the documentation for the List.hashCode()
method.
hashCode
in class java.lang.Object