To allow for efficiently increasing all keys above a certain value or decreasing all keys below a certain value, the keys values are stored relative to their parent. This makes this map a good backing for fast insertion and removal of indices in a vector. Null values are supported.
This implementation is thread-safe except for its iterators.
Other than that, this tree is based on the Glasgow Haskell Compiler's Data.Map implementation, which in turn is based on "size balanced binary trees" as described by:
Stephen Adams, "Efficient sets: a balancing act", Journal of Functional Programming 3(4):553-562, October 1993, http://www.swiss.ai.mit.edu/~adams/BB/.
J. Nievergelt and E.M. Reingold, "Binary search trees of bounded balance", SIAM journal of computing 2(1), March 1973.
| Modifier and Type | Class and Description |
|---|---|
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private static final int | |
| pack-priv static final IntTree | |
| private final long | |
| private final IntTree | |
| private static final int | |
| private final IntTree | |
| private static final long | |
| private final int | |
| private final V |
| Access | Constructor and Description |
|---|---|
| private | |
| private |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv IntTree | |
| pack-priv IntTree | changeKeysBelow(final long key, final int delta)
Changes every key k<key to k+delta. 0 and the distance between the largest k<key in this and the smallest j>=key in this is delta or less. |
| pack-priv boolean | |
| pack-priv V | |
| pack-priv Iterator | |
| private long | |
| pack-priv IntTree | |
| pack-priv IntTree | |
| private IntTree | |
| private static <V> IntTree | |
| pack-priv int | |
| private IntTree |
| ALPHA | back to summary |
|---|---|
| private static final int ALPHA | |
| EMPTYNODE | back to summary |
|---|---|
| pack-priv static final IntTree<Object> EMPTYNODE | |
| key | back to summary |
|---|---|
| private final long key | |
| left | back to summary |
|---|---|
| private final IntTree<V> left | |
| OMEGA | back to summary |
|---|---|
| private static final int OMEGA | |
| right | back to summary |
|---|---|
| private final IntTree<V> right | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID | |
| size | back to summary |
|---|---|
| private final int size | |
| value | back to summary |
|---|---|
| private final V value | |
| IntTree | back to summary |
|---|---|
| private IntTree() | |
| IntTree | back to summary |
|---|---|
| private IntTree(final long key, final V value, final IntTree<V> left, final IntTree<V> right) | |
| changeKeysAbove | back to summary |
|---|---|
| pack-priv IntTree Changes every key k>=key to k+delta. This method will create an _invalid_ tree if delta<0 and the distance between the smallest
k>=key in this and the largest j | |
| changeKeysBelow | back to summary |
|---|---|
| pack-priv IntTree Changes every key k In other words, this method must not result in any overlap or change in the order of the
keys in this, since the tree _structure_ is not being changed at all.
| |
| containsKey | back to summary |
|---|---|
| pack-priv boolean containsKey(final long key) | |
| get | back to summary |
|---|---|
| pack-priv V get(final long key) | |
| iterator | back to summary |
|---|---|
| pack-priv Iterator | |
| minKey | back to summary |
|---|---|
| private long minKey() | |
| minus | back to summary |
|---|---|
| pack-priv IntTree | |
| plus | back to summary |
|---|---|
| pack-priv IntTree | |
| rebalanced | back to summary |
|---|---|
| private IntTree | |
| rebalanced | back to summary |
|---|---|
| private static <V> IntTree | |
| size | back to summary |
|---|---|
| pack-priv int size() | |
| withKey | back to summary |
|---|---|
| private IntTree | |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| public boolean | |
| public Map. | |
| public void | remove()
Overrides default java. Removes from the underlying collection the last element returned by this iterator (optional operation). |
| key | back to summary |
|---|---|
| private int key | |
| stack | back to summary |
|---|---|
| private PStack<IntTree<V>> stack | |
| EntryIterator | back to summary |
|---|---|
| pack-priv EntryIterator(final IntTree<V> root) | |
| gotoMinOf | back to summary |
|---|---|
| private void gotoMinOf(IntTree<V> node) | |
| hasNext | back to summary |
|---|---|
| public boolean hasNext() Implements java. Doc from java. Returns
| |
| next | back to summary |
|---|---|
| public Map. Implements java. Doc from java. Returns the next element in the iteration. | |
| remove | back to summary |
|---|---|
| public void remove() Overrides default java. Doc from java. Removes from the underlying collection the last element returned
by this iterator (optional operation). This method can be called
only once per call to The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method, unless an overriding class has specified a concurrent modification policy.
The behavior of an iterator is unspecified if this method is called
after a call to the | |