java.lang.Object
de.grogra.xl.util.FloatList
de.grogra.mesh.utils.FloatListArray
- All Implemented Interfaces:
FloatConsumer
,VoidToFloatGenerator
,Serializable
,Cloneable
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionboolean
True if there is enough memory to add more to the list -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
add
(float o) Addso
as last element to this list.void
add
(int index, float o) Insertso
at positionindex
to this list.addAll
(float[] v, int begin, int length) Appendslength
components ofv
to this list, starting at indexbegin
.Appends all elements ofv
to this list.void
addIfNotContained
(float o) Addso
as last element to this list if is not yet contained as reported byFloatList.contains(float)
.static void
arraycopyAll
(FloatListArray src, int srcIndex, float[] dest, int destIndex, int length) int
binarySearch
(float value) Searches this list for the specified value using the binary search algorithm.clone()
void
consume
(float value) Receives a value of typefloat
.boolean
contains
(float o) Returnstrue
iff this list contains the given elemento
.void
ensureCapacity
(int capacity) If the capacity is not high enough, the currentList is added to the list of lists and a new FloatList is createdboolean
void
evaluateFloat
(FloatConsumer cons) This generator method yields all values tocons
.float
get
(int index) Returns the list element atindex
.int
indexOf
(float o) Returns the index ofo
in this list.int
lastIndexOf
(float o) Returns the last index ofo
in this list.float
peek
(int index) Returns the list element atindex
as seen from the top, i.e., at absolute positionsize - index
.float
pop()
Removes and returns the object at the top of this list.float[]
reduce
(int i) Returns an array of the size - i of the elementsboolean
remove
(float o) Removes the elemento
.float
removeAt
(int index) Removes the element at positionindex
.float[]
safelyCreate
(int size) float
set
(int index, float o) Sets the element at positionindex
too
.void
setSize
(int size) Sets the size of this list to the given value.float[]
toArray()
Returns an array containing the elements of this list.float[]
toArray
(float[] array) Returns an array containing the elements of this list.float[]
toArray
(int x) This toArray is specifically made for the collection display, where each object HAS to be a set of x floats.void
Trims the capacity of this list to be its current size.void
values
(FloatConsumer cons) This method is an alias forFloatList.evaluateFloat(de.grogra.xl.lang.FloatConsumer)
.void
writeTo
(FloatBuffer out)
-
Field Details
-
currentList
-
shouldContinue
public boolean shouldContinueTrue if there is enough memory to add more to the list
-
-
Constructor Details
-
FloatListArray
public FloatListArray() -
FloatListArray
public FloatListArray(int size)
-
-
Method Details
-
safelyCreate
-
safelyCast
-
ensureCapacity
public void ensureCapacity(int capacity) If the capacity is not high enough, the currentList is added to the list of lists and a new FloatList is created- Overrides:
ensureCapacity
in classFloatList
- Parameters:
capacity
- the desired minimum capacity
-
add
public boolean add(float o) Description copied from class:FloatList
Addso
as last element to this list. -
addAll
Description copied from class:FloatList
Appendslength
components ofv
to this list, starting at indexbegin
. -
toArray
public float[] toArray()Description copied from class:FloatList
Returns an array containing the elements of this list. -
toArray
public float[] toArray(int x) This toArray is specifically made for the collection display, where each object HAS to be a set of x floats. -
reduce
public float[] reduce(int i) Returns an array of the size - i of the elements -
toArray
public float[] toArray(float[] array) Description copied from class:FloatList
Returns an array containing the elements of this list. The type of the returned array is that of the specifiedarray
. If this list fits in the specifiedarray
, it is returned therein. Otherwise, a new array is allocated whose length is the size of this list's size, the values of this list are copied into the new array, and this array is returned.If there is room for an additional element in the
array
, a0
-value is written behind the last copied element. -
arraycopyAll
public static void arraycopyAll(FloatListArray src, int srcIndex, float[] dest, int destIndex, int length) -
clone
-
trimToSize
public void trimToSize()Description copied from class:FloatList
Trims the capacity of this list to be its current size.- Overrides:
trimToSize
in classFloatList
-
add
public void add(int index, float o) Description copied from class:FloatList
Insertso
at positionindex
to this list. Ifindex
is not less thansize
, the list is enlarged and filled with0
-values before. -
addIfNotContained
public void addIfNotContained(float o) Description copied from class:FloatList
Addso
as last element to this list if is not yet contained as reported byFloatList.contains(float)
.- Overrides:
addIfNotContained
in classFloatList
- Parameters:
o
- the value to add
-
addAll
Description copied from class:FloatList
Appends all elements ofv
to this list. -
removeAt
public float removeAt(int index) Description copied from class:FloatList
Removes the element at positionindex
. -
remove
public boolean remove(float o) Description copied from class:FloatList
Removes the elemento
. The last occurence ofo
in this list is removed. -
set
public float set(int index, float o) Description copied from class:FloatList
Sets the element at positionindex
too
. Ifindex
is not less thansize
, the list is enlarged and filled with0
-values before. -
get
public float get(int index) Description copied from class:FloatList
Returns the list element atindex
. Ifindex
is not less thansize
,0
is returned. -
peek
public float peek(int index) Description copied from class:FloatList
Returns the list element atindex
as seen from the top, i.e., at absolute positionsize - index
. Thus, the topmost element has index 1. -
contains
public boolean contains(float o) Description copied from class:FloatList
Returnstrue
iff this list contains the given elemento
. -
indexOf
public int indexOf(float o) Description copied from class:FloatList
Returns the index ofo
in this list. -
lastIndexOf
public int lastIndexOf(float o) Description copied from class:FloatList
Returns the last index ofo
in this list.- Overrides:
lastIndexOf
in classFloatList
- Parameters:
o
- a value- Returns:
- the index of
o
, or -1 ofo
is not contained
-
binarySearch
public int binarySearch(float value) Description copied from class:FloatList
Searches this list for the specified value using the binary search algorithm. This list has to be sorted in ascending order.- Overrides:
binarySearch
in classFloatList
- Parameters:
value
- the value to be searched for- Returns:
- index of the searched value, if it is contained in this list;
otherwise,
(-(insertion point) - 1)
. The insertion point is defined as the point at which the value would be inserted into the list: the index of the first element greater than the value, orFloatList.size()
, if all elements in the list are less than the specified value.
-
writeTo
-
pop
public float pop()Description copied from class:FloatList
Removes and returns the object at the top of this list. -
setSize
public void setSize(int size) Description copied from class:FloatList
Sets the size of this list to the given value. If the new size is greater than the old size, the new elements are initialized with0
-values. -
equals
-
consume
public void consume(float value) Description copied from interface:FloatConsumer
Receives a value of typefloat
.- Specified by:
consume
in interfaceFloatConsumer
- Overrides:
consume
in classFloatList
-
evaluateFloat
Description copied from class:FloatList
This generator method yields all values tocons
.- Specified by:
evaluateFloat
in interfaceVoidToFloatGenerator
- Overrides:
evaluateFloat
in classFloatList
- Parameters:
cons
- the consumer which receives the values
-
values
Description copied from class:FloatList
This method is an alias forFloatList.evaluateFloat(de.grogra.xl.lang.FloatConsumer)
.
-