|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--net.rim.device.api.util.IntVector
|
+--net.rim.device.api.util.SimpleSortingIntVector
Simple sorting vector of integers.
| Field Summary | ||
static short |
SORT_TYPE_COMPARISON
sort using a comparator |
|
static short |
SORT_TYPE_NONE
not sorted |
|
static short |
SORT_TYPE_NUMERIC
sort numerically |
|
| Fields inherited from class net.rim.device.api.util.IntVector |
capacityIncrement, elementCount, elementData |
| Constructor Summary | ||
SimpleSortingIntVector()
Constructs a new SimpleSortingIntVector instance. |
||
| Method Summary | ||
void |
addElement(int obj)
Adds provided object to this vector. |
|
int |
bestGuessBinarySearch(int object)
A bi-directional search that uses a binary search to guess the general vicinity of the required object, then branches out in either direction to find the exact object. |
|
int |
binarySearch(int obj,
short sortType)
Performs a binary search find the Object. |
|
short |
getSortState()
Retrieves this Vector's current sort state. |
|
int |
linearSearch(int obj)
Performs a linear search to find the Object. |
|
boolean |
removeElement(int obj)
Optimized removeElement() method. |
|
void |
reSort(short sortType)
Sorts this vector using the supplied comparator |
|
boolean |
setSortAsAdded(short sortType)
Set the option to sort this vector as elements are added |
|
void |
setSortComparator(IntComparator newComparator,
boolean sortNow,
boolean uniqueValueComparator)
Sets a new comparator for use with this sorting vector. |
|
| Methods inherited from class net.rim.device.api.util.IntVector |
capacity, contains, copyInto, elementAt, ensureCapacity, firstElement, getArray, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, removeAllElements, removeElementAt, setElementAt, setSize, size, toArray, trimToSize |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final short SORT_TYPE_COMPARISON
| Constructor Detail |
public SimpleSortingIntVector()
| Method Detail |
public void addElement(int obj)
If this vector was set to sort dynamically, then this vector sorts itself after the addition.
addElement in class IntVectorobj - Object to add.public int bestGuessBinarySearch(int object)
IllegalStateException - if sortType is not SORT_TYPE_COMPARISON.
public int binarySearch(int obj,
short sortType)
obj - Object to findIllegalStateException - if the sort type is SORT_TYPE_NONE.public short getSortState()
setSortAsAdded(short).SORT_TYPE_ constants defined in this class; the return value is
undefined in this vector is empty or if no elements have been added since
the last invocation of setSortAsAdded().public int linearSearch(int obj)
obj - Object To Findpublic boolean removeElement(int obj)
removeElement in class IntVectorobj - Object to be deletepublic void reSort(short sortType)
sortType - How to sort this vector, one of SORT_TYPE_*public boolean setSortAsAdded(short sortType)
sortType - Sort Type that should happen as elements are added,
default: SORT_TYPE_NONE (not sorted)public void setSortComparator(IntComparator newComparator, boolean sortNow, boolean uniqueValueComparator)
If this vector is currently set to be sorted as elements are added, then this method also sorts the vector.
newComparator - New comparator to use when sorting this vector.sortNow - True to sort array immediately using this comparatoruniqueValueComparator - True if the comparison is done on a unique value, if true this will optimize element operationsNullPointerException - If the newComparator parameter is null.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright 1999-2009 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.