|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.collections.primitives.AbstractDoubleCollection org.apache.commons.collections.primitives.RandomAccessDoubleList org.apache.commons.collections.primitives.ArrayDoubleList jopt.csp.util.SortableDoubleList
A flexible, sortable list of double primitives. Borrows much of its functionality from the ArrayDoubleList implementation given in the Commons Primitives project (http://jakarta.apache.org/commons/primitives/index.html)
Constructor Summary | |
SortableDoubleList()
Construct an empty list with the default initial capacity. |
|
SortableDoubleList(org.apache.commons.collections.primitives.DoubleCollection that)
Constructs a list containing the elements of the given collection, in the order they are returned by that collection's iterator. |
|
SortableDoubleList(int initialCapacity)
Construct an empty list with the given initial capacity. |
Method Summary | |
void |
add(int index,
double element)
Inserts the specified element at the specified position (optional operation). |
int |
binarySearch(double key)
Searches the list for the specified key via Arrays.binarySearch(double[], double)
|
void |
ensureCapacity(int mincap)
Increases my capacity, if necessary, to ensure that I can hold at least the number of elements specified by the minimum capacity argument without growing. |
double |
get(int index)
|
double |
removeElementAt(int index)
Removes the element at the specified position in (optional operation). |
void |
reverse()
Reverses the order of the elements |
double |
set(int index,
double element)
Replaces the element at the specified position in me with the specified element (optional operation). |
int |
size()
|
void |
sort()
Sorts the list into ascending numerical order via Arrays.sort(double[]) |
void |
sort(int fromIndex,
int toIndex)
Sorts the specified range of the list into ascending numerical order via Arrays.sort(double[], int, int) |
void |
swap(int i,
int j)
Swaps the two specified elements. |
void |
trimToSize()
Reduce my capacity, if necessary, to match my current size . |
Methods inherited from class org.apache.commons.collections.primitives.RandomAccessDoubleList |
add, addAll, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, subList, toString |
Methods inherited from class org.apache.commons.collections.primitives.AbstractDoubleCollection |
addAll, clear, contains, containsAll, isEmpty, removeAll, removeElement, retainAll, toArray, toArray |
Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.apache.commons.collections.primitives.DoubleList |
add, addAll, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, subList |
Methods inherited from interface org.apache.commons.collections.primitives.DoubleCollection |
addAll, clear, contains, containsAll, isEmpty, removeAll, removeElement, retainAll, toArray, toArray |
Constructor Detail |
public SortableDoubleList()
public SortableDoubleList(int initialCapacity)
java.lang.IllegalArgumentException
- when initialCapacity is negativepublic SortableDoubleList(org.apache.commons.collections.primitives.DoubleCollection that)
that
- the non-null
collection of double
s
to add
java.lang.NullPointerException
- if that is null
AbstractDoubleCollection.addAll(org.apache.commons.collections.primitives.DoubleCollection)
Method Detail |
public double get(int index)
public int size()
public double removeElementAt(int index)
index
- the index of the element to remove
java.lang.UnsupportedOperationException
- when this operation is not
supported
java.lang.IndexOutOfBoundsException
- if the specified index is out of rangepublic double set(int index, double element)
index
- the index of the element to changeelement
- the value to be stored at the specified position
java.lang.UnsupportedOperationException
- when this operation is not
supportedpublic void add(int index, double element)
set(int, double)
.
index
- the index at which to insert the elementelement
- the value to insert
java.lang.UnsupportedOperationException
- when this operation is not
supported
java.lang.IllegalArgumentException
- if some aspect of the specified element
prevents it from being added to mepublic void ensureCapacity(int mincap)
public void trimToSize()
size
.
public void sort()
Arrays.sort(double[])
public void reverse()
public void swap(int i, int j)
public int binarySearch(double key)
Arrays.binarySearch(double[], double)
The array must be sorted (as by the sort method, above) prior to making this call. If it is not sorted, the results are undefined. If the list contains multiple elements with the specified value, there is no guarantee which one will be found.
key
- the value to be searched for
public void sort(int fromIndex, int toIndex)
Arrays.sort(double[], int, int)
fromIndex
- the index of the first element (inclusive) to be sortedtoIndex
- the index of the last element (exclusive) to be sorted
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |