All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
io.sirix.index.art.AscendingSubMap Maven / Gradle / Ivy
package io.sirix.index.art;
import java.util.*;
final class AscendingSubMap extends NavigableSubMap {
// TODO: look into making ART and it's views (bounds) serializable later
// private static final long serialVersionUID = 912986545866124060L;
AscendingSubMap(AdaptiveRadixTree tree, boolean fromStart, K lo, boolean loInclusive, boolean toEnd, K hi,
boolean hiInclusive) {
super(tree, fromStart, lo, loInclusive, toEnd, hi, hiInclusive);
}
@Override
public Comparator super K> comparator() {
return tree.comparator();
}
@Override
public NavigableMap subMap(K fromKey, boolean fromInclusive, K toKey, boolean toInclusive) {
if (!inRange(fromKey, fromInclusive))
throw new IllegalArgumentException("fromKey out of range");
if (!inRange(toKey, toInclusive))
throw new IllegalArgumentException("toKey out of range");
return new AscendingSubMap<>(tree, false, fromKey, fromInclusive, false, toKey, toInclusive);
}
// TODO: offer another ctor to take in loBytes
@Override
public NavigableMap headMap(K toKey, boolean inclusive) {
if (!inRange(toKey, inclusive))
throw new IllegalArgumentException("toKey out of range");
return new AscendingSubMap<>(tree, fromStart, lo, loInclusive, false, toKey, inclusive);
}
// TODO: offer another ctor to take in hiBytes
@Override
public NavigableMap tailMap(K fromKey, boolean inclusive) {
if (!inRange(fromKey, inclusive))
throw new IllegalArgumentException("fromKey out of range");
return new AscendingSubMap<>(tree, false, fromKey, inclusive, toEnd, hi, hiInclusive);
}
@Override
public NavigableMap descendingMap() {
NavigableMap mv = descendingMapView;
return (mv != null)
? mv
: (descendingMapView = new DescendingSubMap<>(tree, fromStart, lo, loInclusive, toEnd, hi, hiInclusive));
}
@Override
Iterator keyIterator() {
return new SubMapKeyIterator(absLowest(), absHighFence());
}
@Override
Spliterator keySpliterator() {
return new SubMapKeyIterator(absLowest(), absHighFence());
}
@Override
Iterator descendingKeyIterator() {
return new DescendingSubMapKeyIterator(absHighest(), absLowFence());
}
final class AscendingEntrySetView extends EntrySetView {
@Override
public Iterator> iterator() {
return new SubMapEntryIterator(absLowest(), absHighFence());
}
}
@Override
public Set> entrySet() {
EntrySetView es = entrySetView;
return (es != null) ? es : (entrySetView = new AscendingEntrySetView());
}
@Override
LeafNode subLowest() {
return absLowest();
}
@Override
LeafNode subHighest() {
return absHighest();
}
@Override
LeafNode subCeiling(K key) {
return absCeiling(key);
}
@Override
LeafNode subHigher(K key) {
return absHigher(key);
}
@Override
LeafNode subFloor(K key) {
return absFloor(key);
}
@Override
LeafNode subLower(K key) {
return absLower(key);
}
}