Add some missing features from the JDK 5 TreeSet. More...
Classes | |
class | DescendingIterator< T > |
Public Member Functions | |
TreeSet6 (Comparator<?super E > c) | |
E | floorCompatible (E key) |
Returns the greatest element in this set less than or equal to the given element, or null if there is no such element. | |
E | ceilingCompatible (E key) |
Returns the least element in this set greater than or equal to the given element, or null if there is no such element. | |
E | lowerCompatible (E key) |
Returns the greatest element in this set strictly less than the given element, or null if there is no such element. | |
E | higherCompatible (E key) |
Returns the least element in this set strictly greater than the given element, or null if there is no such element. | |
Iterator< E > | descendingIteratorCompatible () |
Returns an iterator over the elements in this set in descending order. | |
Protected Member Functions | |
Method | getMethod (Class<?> c, String name, Class<?>...parameterTypes) |
Our own wrapper for getMethod that returns null if the method is not found. | |
E | internalFloor (E key) |
Returns the greatest element in this set less than or equal to the given element, or null if there is no such element. | |
E | internalCeiling (E key) |
Returns the least element in this set greater than or equal to the given element, or null if there is no such element. | |
E | internalHigher (E key) |
Returns the least element in this set strictly greater than the given element, or null if there is no such element. | |
E | internalLower (E key) |
Returns the greatest element in this set strictly less than the given element, or null if there is no such element. | |
int | mycompare (Comparator<?super E > comparator, Comparable<?super E > comparable, E a, E b) throws ClassCastException |
if comp not null, use comp, else use comparable if not null, else throw a ClassCast exception |
Add some missing features from the JDK 5 TreeSet.
If running on JDK 6, use them as they will be way more efficient. This class is to provide JDK compatibility for the versioning package and only implements the needed functionality.
The user should call the *Compatible methods (floorCompatible, etc.) instead of the Java 6 methods (e.g. floor).
When used in a JDK 5 environment, the implementations of the provided algorithms is going to be O(N), not O(log N). There is no fast-fail detection for concurrent modifications. The descendingIterator works fine for iteration and calling remove(), but if you mix in other calls, like to add() while iterating, you will not see those values.
E org.ccnx.ccn.profiles.versioning.TreeSet6< E >.ceilingCompatible | ( | E | key | ) |
Returns the least element in this set greater than or equal to the given element, or null if there is no such element.
Use this method, not ceiling().
Iterator<E> org.ccnx.ccn.profiles.versioning.TreeSet6< E >.descendingIteratorCompatible | ( | ) |
Returns an iterator over the elements in this set in descending order.
E org.ccnx.ccn.profiles.versioning.TreeSet6< E >.floorCompatible | ( | E | key | ) |
Returns the greatest element in this set less than or equal to the given element, or null if there is no such element.
Use this method, not floor().
Method org.ccnx.ccn.profiles.versioning.TreeSet6< E >.getMethod | ( | Class<?> | c, | |
String | name, | |||
Class<?>... | parameterTypes | |||
) | [protected] |
Our own wrapper for getMethod that returns null if the method is not found.
c | class to search for method | |
name | method name | |
parameterTypes |
E org.ccnx.ccn.profiles.versioning.TreeSet6< E >.higherCompatible | ( | E | key | ) |
Returns the least element in this set strictly greater than the given element, or null if there is no such element.
Use this method, not higher().
E org.ccnx.ccn.profiles.versioning.TreeSet6< E >.lowerCompatible | ( | E | key | ) |
Returns the greatest element in this set strictly less than the given element, or null if there is no such element.
Use this method, not lower().
int org.ccnx.ccn.profiles.versioning.TreeSet6< E >.mycompare | ( | Comparator<?super E > | comparator, | |
Comparable<?super E > | comparable, | |||
E | a, | |||
E | b | |||
) | throws ClassCastException [protected] |
if comp not null, use comp, else use comparable if not null, else throw a ClassCast exception
comparator | the Comparator to use | |
comparable | the casting to (Comparable) from a | |
a | ||
b |