SSF.Util.Plot
Class SelfExpandingFloatArray
java.lang.Object
|
+--java.util.AbstractCollection
|
+--java.util.AbstractList
|
+--java.util.ArrayList
|
+--SSF.Util.Plot.SelfExpandingFloatArray
- All Implemented Interfaces:
- java.lang.Cloneable, java.util.Collection, java.util.List, java.util.RandomAccess, java.io.Serializable
- public class SelfExpandingFloatArray
- extends java.util.ArrayList
Class to implement an "automatically extending Float array" by
extending the Vector class. Overloads the set(...) method of the
Vector class to check whether or not the index is within the current
bounds of the array. If it's outside, the size of the array is increased
to fit in this new element. Also implements a new convenience method
"update(...)" for a "read-modify-write" operation on a element in the
array.
NOTE: The methods supplied in this class are the only ones supported
for self-expanding arrays. Using other methods in the superclasses may
have "undefined" results - generally resulting in an "index out of bounds"
exception.
- See Also:
- Serialized Form
| Fields inherited from class java.util.AbstractList |
modCount |
|
Method Summary |
float |
getVal(int index)
Returns the element at the specified position in the array. |
void |
set(int index,
float element)
Sets the specified element (by index) to "element", and automatically
increases the size of the array if necessary. |
void |
update(int index,
float increment)
Update element at index by increment (+/-) |
void |
updateMax(int index,
float newVal)
Update element by setting it to max(previous, new) |
| Methods inherited from class java.util.ArrayList |
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, removeRange, set, size, toArray, toArray, trimToSize |
| Methods inherited from class java.util.AbstractList |
equals, hashCode, iterator, listIterator, listIterator, subList |
| Methods inherited from class java.util.AbstractCollection |
containsAll, remove, removeAll, retainAll, toString |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.List |
containsAll, equals, hashCode, iterator, listIterator, listIterator, remove, removeAll, retainAll, subList |
SelfExpandingFloatArray
public SelfExpandingFloatArray()
set
public void set(int index,
float element)
- Sets the specified element (by index) to "element", and automatically
increases the size of the array if necessary.
getVal
public float getVal(int index)
- Returns the element at the specified position in the array.
If this element has not been set, the value 0 will be returned
but the element will not be created in the array.
update
public void update(int index,
float increment)
- Update element at index by increment (+/-)
updateMax
public void updateMax(int index,
float newVal)
- Update element by setting it to max(previous, new)