Interface EventGraph<Event>
- Type Parameters:
Event- The type of event to be stored in the graph structure.
- All Superinterfaces:
EffectExpression<Event>
- All Known Implementing Classes:
EventGraph.Atom,EventGraph.Concurrently,EventGraph.Empty,EventGraph.Sequentially
An event graph is a series-parallel graph whose edges represent atomic events. Event graphs may be composed sequentially (in series) or concurrently (in parallel).
As with many recursive tree-like structures, an event graph is utilized by accepting an EffectTrait visitor
and traversing the series-parallel structure recursively. This trait provides methods for each type of node in the
tree representation (empty, sequential composition, and parallel composition). For each node, the trait combines
the results from its children into a result that will be provided to the same trait at the node's parent. The result
of the traversal is the value computed by the trait at the root node.
Different domains may interpret each event differently, and so evaluate the same event graph under different projections. An event may have no particular effect in one domain, while being critically important to another domain.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordUseatom(Event)instead of instantiating this class directly.static final recordUseconcurrently(EventGraph[])} instead of instantiating this class directly.static final recordUseempty()instead of instantiating this class directly.static final classA "no-op" algebra that reconstructs an event graph from its pieces.static final recordUsesequentially(EventGraph[])} instead of instantiating this class directly. -
Method Summary
Modifier and TypeMethodDescriptionstatic <Event> EventGraph<Event> atom(Event atom) Create an event graph consisting of a single atomic event.static <Event> EventGraph<Event> concurrently(EventGraph<Event>... branches) Create an event graph by combining multiple event graphs of the same type in parallel.static <Event> EventGraph<Event> concurrently(EventGraph<Event> left, EventGraph<Event> right) Create an event graph by combining multiple event graphs of the same type in parallel.static <Event> EventGraph<Event> concurrently(Collection<EventGraph<Event>> branches) Create an event graph by combining multiple event graphs of the same type in parallel.static <Event> EventGraph<Event> empty()Create an empty event graph.default <Effect> Effectevaluate(gov.nasa.jpl.aerie.merlin.protocol.model.EffectTrait<Effect> trait, Function<Event, Effect> substitution) Produce an effect in the domain of effects described by the provided trait and event substitution.static <Event> EventGraph<Event> sequentially(EventGraph<Event>... segments) Create an event graph by combining multiple event graphs of the same type in sequence.static <Event> EventGraph<Event> sequentially(EventGraph<Event> prefix, EventGraph<Event> suffix) Create an event graph by combining multiple event graphs of the same type in sequence.static <Event> EventGraph<Event> sequentially(List<EventGraph<Event>> segments) Create an event graph by combining multiple event graphs of the same type in sequence.Methods inherited from interface gov.nasa.jpl.aerie.merlin.driver.timeline.EffectExpression
evaluate, map, substitute
-
Method Details
-
evaluate
default <Effect> Effect evaluate(gov.nasa.jpl.aerie.merlin.protocol.model.EffectTrait<Effect> trait, Function<Event, Effect> substitution) Description copied from interface:EffectExpressionProduce an effect in the domain of effects described by the provided trait and event substitution.- Specified by:
evaluatein interfaceEffectExpression<Event>- Type Parameters:
Effect- The type of effect produced by the visitor.- Parameters:
trait- A visitor to be used to compose effects in sequence or concurrently.substitution- A visitor to be applied at any atomic events.- Returns:
- The effect described by this object, within the provided domain of effects.
-
empty
Create an empty event graph.- Type Parameters:
Event- The type of event that might be contained by this event graph.- Returns:
- An empty event graph.
-
atom
Create an event graph consisting of a single atomic event.- Type Parameters:
Event- The type of the given atomic event.- Parameters:
atom- An atomic event.- Returns:
- An event graph consisting of a single atomic event.
-
sequentially
Create an event graph by combining multiple event graphs of the same type in sequence.- Type Parameters:
Event- The type of atomic event contained by these graphs.- Parameters:
prefix- The first event graph to apply.suffix- The second event graph to apply.- Returns:
- An event graph consisting of a sequence of subgraphs.
-
concurrently
Create an event graph by combining multiple event graphs of the same type in parallel.- Type Parameters:
Event- The type of atomic event contained by these graphs.- Parameters:
left- An event graph to apply concurrently.right- An event graph to apply concurrently.- Returns:
- An event graph consisting of a set of concurrent subgraphs.
-
sequentially
Create an event graph by combining multiple event graphs of the same type in sequence.- Type Parameters:
Event- The type of atomic event contained by these graphs.- Parameters:
segments- A series of event graphs to combine in sequence.- Returns:
- An event graph consisting of a sequence of subgraphs.
-
concurrently
Create an event graph by combining multiple event graphs of the same type in parallel.- Type Parameters:
Event- The type of atomic event contained by these graphs.- Parameters:
branches- A set of event graphs to combine in parallel.- Returns:
- An event graph consisting of a set of concurrent subgraphs.
-
sequentially
Create an event graph by combining multiple event graphs of the same type in sequence.- Type Parameters:
Event- The type of atomic event contained by these graphs.- Parameters:
segments- A series of event graphs to combine in sequence.- Returns:
- An event graph consisting of a sequence of subgraphs.
-
concurrently
Create an event graph by combining multiple event graphs of the same type in parallel.- Type Parameters:
Event- The type of atomic event contained by these graphs.- Parameters:
branches- A set of event graphs to combine in parallel.- Returns:
- An event graph consisting of a set of concurrent subgraphs.
-