public abstract class IntervalSortedMultimap<K extends Comparable<K>,V extends Keyed<K>> extends Object
A data structure for storing Keyed
values (events with start and end times).
IntervalSortedMultimap supports querying for all values which contain a particular time, all
values which overlap with a particular time window, or all values which
are completely contained within a time window.
Although this collection is sorted based on the Event start and end
TimeStamps, it uses Object.equals(Object)
to satisfy the Set
contract.
If two values are equal they must also have the same Keyed.getStartTime()
and Keyed.getEndTime()
. However, two values which are not equal may have
the same start and end.
Constructor and Description |
---|
IntervalSortedMultimap() |
Modifier and Type | Method and Description |
---|---|
void |
add(V event) |
static <K,V> com.google.common.collect.SetMultimap<K,V> |
buildMap() |
void |
clear() |
K |
earliestTime()
Returns the earliest start TimeStamp among Events in the map.
|
Set<V> |
get(K time)
Return all Events which contain the provided TimeStamp (inclusive on the
start time and end time).
|
Set<V> |
get(K start,
boolean startInclusive,
K end,
boolean endInclusive)
Return all Events whose time span overlaps with the provided bounds.
|
Set<V> |
get(K start,
K end)
Return all Events whose time span overlaps with the provided bounds.
|
SortedMap<K,Collection<V>> |
getEndMap() |
com.google.common.collect.SetMultimap<K,V> |
getEndMultimap() |
Set<V> |
getInterior(K start,
boolean startInclusive,
K end,
boolean endInclusive)
Return all Events whose time span is strictly contained within the provided bounds.
|
Set<V> |
getInterior(K start,
K end)
Return all Events whose time span is strictly contained within the provided bounds.
|
com.google.common.collect.SetMultimap<K,V> |
getMap(K start,
boolean startInclusive,
K end,
boolean endInclusive) |
Set<V> |
getOverlapping(V event)
Returns all the Events which overlap in time with the provided Event.
|
SortedMap<K,Collection<V>> |
getStartMap() |
com.google.common.collect.SetMultimap<K,V> |
getStartMultimap() |
boolean |
isEmpty() |
K |
latestTime()
Returns the latest end TimeStamp among Events in the map.
|
void |
remove(V event) |
int |
size() |
public void clear()
public void add(V event)
public void remove(V event)
public SortedMap<K,Collection<V>> getStartMap()
public SortedMap<K,Collection<V>> getEndMap()
public K earliestTime()
public K latestTime()
public Set<V> get(K time)
public Set<V> get(K start, K end)
public Set<V> get(K start, boolean startInclusive, K end, boolean endInclusive)
public com.google.common.collect.SetMultimap<K,V> getMap(K start, boolean startInclusive, K end, boolean endInclusive)
public Set<V> getOverlapping(V event)
public Set<V> getInterior(K start, K end)
public Set<V> getInterior(K start, boolean startInclusive, K end, boolean endInclusive)
public boolean isEmpty()
public int size()
public static <K,V> com.google.common.collect.SetMultimap<K,V> buildMap()
Copyright © 2013 Metron, Inc.. All rights reserved.