All Packages Class Hierarchy This Package Previous Next Index
Class com.micronova.util.SortedVector
java.lang.Object
|
+----netscape.util.Vector
|
+----com.micronova.util.SortedVector
- public class SortedVector
- extends Vector
A SortedVector keeps its Comparable elements sorted in ascending order.
- Version:
- 1.01
- Author:
- Makoto Nagata, MicroNova
- See Also:
- Comparable
-
SortedVector()
-
-
addComparable(Comparable)
- Adds a Comparable sorted in ascending order.
-
getSegmentIndex(Comparable)
- Returns the segment index to which a given Comparable p belongs.
SortedVector
public SortedVector()
addComparable
public void addComparable(Comparable p)
- Adds a Comparable sorted in ascending order. If there already exists a Comparable q such that q.equals(p), then q is replaced with p.
getSegmentIndex
public int getSegmentIndex(Comparable p)
- Returns the segment index to which a given Comparable p belongs.
For an ordered sequence of N Comparables q[0] < q[1] < ... < q[N-1],
the seqment index for a Comparable p is defined as follows:
- -1 if the vector is empty
- 0 if p < q[0]
- i if q[i] <= p < q[i + 1]
- N if q[N-1] <= p
All Packages Class Hierarchy This Package Previous Next Index