public class DefaultEventStore extends Object implements EventStore
Constructor and Description |
---|
DefaultEventStore() |
Modifier and Type | Method and Description |
---|---|
boolean |
add(Event event)
Adds an event to the event store.
|
void |
clear()
Removes all events in the event store.
|
boolean |
contains(Event event)
Indicates whether the event store contains the given event.
|
Timestamp |
earliestTimestamp()
Returns the earliest timestamp contained in this event store.
|
boolean |
isEmpty()
Indicates whether the event store is empty (i.e. contains no events).
|
boolean |
remove(Event event)
Removes an event from the event store.
|
int |
size()
Returns the number of events contained in the event store.
|
Set<Event> |
subsetAt(Timestamp timestamp)
Returns the subset of all events that occurred at the given timestamp.
|
SortedSet<Event> |
subsetSince(Timestamp timestamp)
Returns the subset of all events that occurred since the given timestamp.
|
SortedSet<Event> |
subsetUntil(Timestamp timestamp)
Returns the subset of all events that occurred until the given timestamp.
|
public Set<Event> subsetAt(Timestamp timestamp)
EventStore
subsetAt
in interface EventStore
timestamp
- The time filter criterion. Only events at that exact timestamp
are to be contained in the subset.null
, unmodifiable subset of all events with a
timestamp equal to the given timestamp
argument.public Timestamp earliestTimestamp()
EventStore
earliestTimestamp
in interface EventStore
public SortedSet<Event> subsetUntil(Timestamp timestamp)
EventStore
subsetUntil
in interface EventStore
timestamp
- The time filter criterion. Only events at that timestamp or
earlier are to be contained in the subset.null
, unmodifiable subset of all events with a
timestamp smaller than or equal to the given timestamp
argument.public SortedSet<Event> subsetSince(Timestamp timestamp)
EventStore
subsetSince
in interface EventStore
timestamp
- The time filter criterion. Only events at that timestamp or
later are to be contained in the subset.null
, unmodifiable subset of all events with a
timestamp greater than or equal to the given timestamp
argument.public int size()
EventStore
size
in interface EventStore
public boolean contains(Event event)
EventStore
contains
in interface EventStore
true
if the store contains the event,
false
otherwise.public boolean isEmpty()
EventStore
isEmpty
in interface EventStore
true
if the store size is 0,
false
otherwise.public void clear()
EventStore
clear
in interface EventStore
public boolean add(Event event)
EventStore
add
in interface EventStore
event
- the event to be added to the event storetrue
if the store did not already contain the
specified event, false
otherwisepublic boolean remove(Event event)
EventStore
remove
in interface EventStore
event
- the event to be removed from the event storetrue
if store contained the specified event,
false
otherwiseCopyright © Aimpulse Intelligent Systems GmbH
All rights reserved.