- Type Parameters:
N- the type of endpointsS- the type of spansV- the type of values
- All Implemented Interfaces:
Span.MutableSpanMap<N,,S, V> Span.SpanMap<N,S, V>
- Direct Known Subclasses:
ULongSpan.DefaultULongSpanMap
Span.SpanMap and Span.MutableSpanMap using an interval
tree
The interfaces can prevent accidental mutation of a map where it shouldn't be allowed; however, nothing prevents a client from casting to the mutable interface. If proper immutability is required, this will need to be wrapped or extended to prevent mutation.
- Implementation Notes:
- While this map is concrete and can be used as is for spans in the given domain, it is recommended to create your own extension implementing an interface specific to your span type and domain.
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultSpanMap(Span.Domain<N, S> domain) Create a span map on the given domain -
Method Summary
Modifier and TypeMethodDescriptionbound()Get a span which encloses all spans in the mapvoidclear()Remove all entries from the mapentries()Get the entries in this mapbooleanGet the value of the given keyGet the entry whose span contains the given keyIterate over all entries whose spans intersect the given spanIterate over all spans in the map that intersect the given spanbooleanintersects(S s) Check if any span in the map intersects the given spanbooleanisEmpty()Check if this map has any entriesvoidPut an entry, mapping all keys contains in the span to the given valuevoidputAll(Span.SpanMap<N, S, V> map) Copy all entries from the given map into this onevoidDelete all keys in the given spanspans()Get the spans in this mapprotected NavigableMap<N, Map.Entry<S, V>> Get the portion of the interval tree whose entries intersect the given spantoString()values()Get the values in this map
-
Constructor Details
-
DefaultSpanMap
Create a span map on the given domainExtensions should invoke this as a super constructor with a fixed domain. See
ULongSpan.DefaultULongSpanMapfor an example.- Parameters:
domain- the domain
-
-
Method Details
-
equals
-
toString
-
toString
-
isEmpty
public boolean isEmpty()Description copied from interface:Span.SpanMapCheck if this map has any entries -
spans
Description copied from interface:Span.SpanMapGet the spans in this mapNote that the behavior regarding a copy versus a view is not specified. Clients should not rely on one or the other.
-
bound
Description copied from interface:Span.SpanMapGet a span which encloses all spans in the map -
values
Description copied from interface:Span.SpanMapGet the values in this mapNote that the behavior regarding a copy versus a view is not specified. Clients should not rely on one of the other.
-
entries
Description copied from interface:Span.SpanMapGet the entries in this mapNote that the behavior regarding a copy versus a view is not specified. Clients should not rely on one or the other.
-
getEntry
Description copied from interface:Span.SpanMapGet the entry whose span contains the given key -
get
Description copied from interface:Span.SpanMapGet the value of the given keyNote that a null return could indicate either that no entry has a span containing the given key, or that the entry whose span contains it has the null value. To distinguish the two, consider using
Span.SpanMap.getEntry(Object). -
subMap
Get the portion of the interval tree whose entries intersect the given span- Parameters:
min- the lower endpoint of the spanmax- the upper endpoint of the span- Returns:
- the sub map
-
intersectingEntries
Description copied from interface:Span.SpanMapIterate over all entries whose spans intersect the given span- Specified by:
intersectingEntriesin interfaceSpan.SpanMap<N,S extends Span<N, S>, V> - Parameters:
s- the span- Returns:
- an iterable of entries
-
intersectingSpans
Description copied from interface:Span.SpanMapIterate over all spans in the map that intersect the given span- Specified by:
intersectingSpansin interfaceSpan.SpanMap<N,S extends Span<N, S>, V> - Parameters:
s- the span- Returns:
- an iterable of spans
-
intersects
Description copied from interface:Span.SpanMapCheck if any span in the map intersects the given span- Specified by:
intersectsin interfaceSpan.SpanMap<N,S extends Span<N, S>, V> - Parameters:
s- the span- Returns:
- true if any span in the map intersects it
-
put
Description copied from interface:Span.MutableSpanMapPut an entry, mapping all keys contains in the span to the given valueEach key can only be mapped to a single value. Thus existing entries having the same value may be coalesced to this new entry. Existing entries having a different value will be truncated or deleted to make room for this entry.
-
putAll
Description copied from interface:Span.MutableSpanMapCopy all entries from the given map into this oneThe entries from both maps may be coalesced when entered into this one. (The given map remains unmodified.) The entries in this map may be truncated or deleted to make room for those in the given map.
-
remove
Description copied from interface:Span.MutableSpanMapDelete all keys in the given spanEntries which intersect the given span are truncated. Entries which are enclosed are deleted, such that every key in the given span is no longer mapped to a value.
-
clear
public void clear()Description copied from interface:Span.MutableSpanMapRemove all entries from the map
-