Class OffsetMap<V>
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.TreeMap<org.apache.commons.lang3.Range<Integer>,V>
-
- de.julielab.java.utilities.spanutils.OffsetMap<V>
-
- All Implemented Interfaces:
Serializable,Cloneable,Map<org.apache.commons.lang3.Range<Integer>,V>,NavigableMap<org.apache.commons.lang3.Range<Integer>,V>,SortedMap<org.apache.commons.lang3.Range<Integer>,V>
public class OffsetMap<V> extends TreeMap<org.apache.commons.lang3.Range<Integer>,V>
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object>
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <V> OffsetMap<V>emptyOffsetMap()VgetFirstLargestIntersectionValue(org.apache.commons.lang3.Range<Integer> range)Returns the first value in the map that intersects the given range and does not have a smaller intersection than following elements.VgetFirstLargestOverlappingValue(org.apache.commons.lang3.Range<Integer> range)NavigableMap<org.apache.commons.lang3.Range<Integer>,V>getOverlapping(Span range)NavigableMap<org.apache.commons.lang3.Range<Integer>,V>getOverlapping(org.apache.commons.lang3.Range<Integer> range)Vput(Span span)NavigableMap<org.apache.commons.lang3.Range<Integer>,V>restrictTo(Span range)Limits a map to entries within a range.NavigableMap<org.apache.commons.lang3.Range<Integer>,V>restrictTo(org.apache.commons.lang3.Range<Integer> range)Limits a map to entries within a range.-
Methods inherited from class java.util.TreeMap
ceilingEntry, ceilingKey, clear, clone, comparator, containsKey, containsValue, descendingKeySet, descendingMap, entrySet, firstEntry, firstKey, floorEntry, floorKey, forEach, get, headMap, headMap, higherEntry, higherKey, keySet, lastEntry, lastKey, lowerEntry, lowerKey, navigableKeySet, pollFirstEntry, pollLastEntry, put, putAll, remove, replace, replace, replaceAll, size, subMap, subMap, tailMap, tailMap, values
-
Methods inherited from class java.util.AbstractMap
equals, hashCode, isEmpty, toString
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, getOrDefault, hashCode, isEmpty, merge, putIfAbsent, remove
-
-
-
-
Method Detail
-
restrictTo
public NavigableMap<org.apache.commons.lang3.Range<Integer>,V> restrictTo(org.apache.commons.lang3.Range<Integer> range)
Limits a map to entries within a range.- Parameters:
range- The range containing the limits- Returns:
- A map of all entries whose keys lie between the minimum of range, inclusive, and the maximum of range, also inclusive.
-
restrictTo
public NavigableMap<org.apache.commons.lang3.Range<Integer>,V> restrictTo(Span range)
Limits a map to entries within a range.- Parameters:
range- The range containing the limits- Returns:
- A map of all entries whose keys lie between the minimum of range, inclusive, and the maximum of range, also inclusive.
-
getOverlapping
public NavigableMap<org.apache.commons.lang3.Range<Integer>,V> getOverlapping(Span range)
-
getOverlapping
public NavigableMap<org.apache.commons.lang3.Range<Integer>,V> getOverlapping(org.apache.commons.lang3.Range<Integer> range)
-
emptyOffsetMap
public static <V> OffsetMap<V> emptyOffsetMap()
-
getFirstLargestIntersectionValue
public V getFirstLargestIntersectionValue(org.apache.commons.lang3.Range<Integer> range)
Returns the first value in the map that intersects the given range and does not have a smaller intersection than following elements.
- Parameters:
range- The range to check for intersections.- Returns:
- The first value with the largest intersection with the given range or null if there is no intersecting element.
-
-