DefaultEditablePlanDriver

A default (but optional) driver for EditablePlan implementations that handles commits/rollbacks, staleness checking, and anchor deletion automatically.

The EditablePlan interface requires the implementor to perform some fairly complex stateful operations, with a tangle of interdependent algorithmic guarantees. Most of those operations are standard among all implementations though, so this driver captures most of it in a reusable form. Just implement the must simpler PlanEditAdapter from this class to make a valid EditablePlan.

The implementor is still responsible for simulation and the basic context-free creation and deletion operations. See the Contracts section of the interface methods' doc comments.

Constructors

Link copied to clipboard

Types

Link copied to clipboard
interface PlanEditAdapter : Plan

Properties

Link copied to clipboard

Whether there are uncommitted changes.

Link copied to clipboard

The total reduced set of changes made to the plan.

Functions

Link copied to clipboard
open override fun commit()

Commit plan edits, making them final.

Link copied to clipboard
open fun create(type: String, start: DirectiveStart, arguments: Map<String, SerializedValue>): ActivityDirectiveId

A simplified version of create with minimal arguments.

open override fun create(directive: NewDirective): ActivityDirectiveId

Create a new activity.

Link copied to clipboard
open fun delete(directive: Directive<AnyDirective>)

Delete an activity and throw an error if any activities are anchored to it.

open fun delete(id: ActivityDirectiveId)

Delete an activity specified by directive id, and throw an error if any activities are anchored to it.

open override fun delete(directive: Directive<AnyDirective>, strategy: DeletedAnchorStrategy)

Delete an activity with a strategy to handle activities that are anchored to it.

open override fun delete(id: ActivityDirectiveId, strategy: DeletedAnchorStrategy)

Delete an activity specified by directive id, with a strategy to handle activities that are anchored to it.

Link copied to clipboard
open override fun directives(): Directives<AnyDirective>

Queries all activity directives, deserializing them as AnyDirective.

open override fun directives(type: String): Directives<AnyDirective>

Queries activity directives, filtered by type, deserializing them as AnyDirective.

open override fun <A : Any> directives(type: String?, deserializer: (SerializedValue) -> A): Directives<A>

Query activity directives.

Link copied to clipboard
open override fun duration(): Duration

The total duration of the plan, whether simulated on the full extent or not.

Link copied to clipboard
open override fun events(): ExternalEvents

Get all external events across all derivation groups associated with this plan.

open override fun events(query: EventQuery): ExternalEvents

Get external events associated with this plan.

Link copied to clipboard
open override fun latestResults(): SimulationResults?

Get the latest simulation results.

Link copied to clipboard
open override fun <V : Any, TL : SerialSegmentOps<V, TL>> resource(name: String, deserializer: (List<Segment<SerializedValue>>) -> TL): TL

Query a resource profile from the external datasets associated with this plan.

Link copied to clipboard
open override fun rollback(): List<Edit>

Roll back uncommitted edits.

Link copied to clipboard

A simplified version of simulate which uses the default configuration.

open override fun simulate(options: SimulateOptions): SimulationResults

Simulate the current plan, including committed and uncommitted changes.

Link copied to clipboard
open override fun toAbsolute(rel: Duration): Instant

Convert a relative duration to a time instant.

Link copied to clipboard
open override fun toRelative(abs: Instant): Duration

Convert a time instant to a relative duration (relative to plan start).

Link copied to clipboard
open override fun totalBounds(): Interval

Total extent of the plan's bounds, whether it was simulated on the full extent or not.