Class AdaptiveFloatArrayList
java.lang.Object
com.amalgamasimulation.utils.container.AdaptiveFloatArrayList
- All Implemented Interfaces:
IFloatArrayList
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(float val) Adds val to the end of the list, growing as needed.intbinarySearch(float value) Performs a binary search for value in the entire list.voidclear()copy()floatget(int offset) Returns the value at the specified offset.voidinsert(int offset, float value) Inserts value into the list at offset.booleanisEmpty()Tests whether this list contains any values.voidset(int offset, float val) Sets the value at the specified offset.intsize()Returns the number of values in the list.float[]void
-
Constructor Details
-
AdaptiveFloatArrayList
public AdaptiveFloatArrayList() -
AdaptiveFloatArrayList
public AdaptiveFloatArrayList(int capacity)
-
-
Method Details
-
size
public int size()Description copied from interface:IFloatArrayListReturns the number of values in the list.- Specified by:
sizein interfaceIFloatArrayList- Returns:
- the number of values in the list.
-
add
public void add(float val) Description copied from interface:IFloatArrayListAdds val to the end of the list, growing as needed.- Specified by:
addin interfaceIFloatArrayList- Parameters:
val- anfloatvalue
-
insert
public void insert(int offset, float value) Description copied from interface:IFloatArrayListInserts value into the list at offset. All values including and to the right of offset are shifted to the right.- Specified by:
insertin interfaceIFloatArrayList- Parameters:
offset- anintvaluevalue- anfloatvalue
-
get
public float get(int offset) Description copied from interface:IFloatArrayListReturns the value at the specified offset.- Specified by:
getin interfaceIFloatArrayList- Parameters:
offset- anintvalue- Returns:
- an
floatvalue
-
set
public void set(int offset, float val) Description copied from interface:IFloatArrayListSets the value at the specified offset.- Specified by:
setin interfaceIFloatArrayList- Parameters:
offset- anintvalueval- anfloatvalue
-
binarySearch
public int binarySearch(float value) Description copied from interface:IFloatArrayListPerforms a binary search for value in the entire list. Note that you must @{link #sort sort} the list before doing a search.- Specified by:
binarySearchin interfaceIFloatArrayList- Parameters:
value- the value to search for- Returns:
- the absolute offset in the list of the value, or its negative insertion point into the sorted list.
-
isEmpty
public boolean isEmpty()Description copied from interface:IFloatArrayListTests whether this list contains any values.- Specified by:
isEmptyin interfaceIFloatArrayList- Returns:
- true if the list is empty.
-
copy
- Specified by:
copyin interfaceIFloatArrayList
-
toNativeArray
public float[] toNativeArray()- Specified by:
toNativeArrayin interfaceIFloatArrayList
-
clear
public void clear()- Specified by:
clearin interfaceIFloatArrayList
-
trimToSize
public void trimToSize()- Specified by:
trimToSizein interfaceIFloatArrayList
-