A scheduler snapshot is a consistent set of data for the scheduler. It is containing the simulation state, past events and future events and iteration number scheduler snapshot is identified with an id property and is related to exactly one date. Past and Future events are sorted collection of events.
Remarks:
An entity using the scheduler snapshot should not access past or future events to have some information on the state the simulation.
A scheduler snapshot is a consistent set of data for the scheduler. It is containing the simulation state, past events and future events and iteration number scheduler snapshot is identified with an id property and is related to exactly one date. Past and Future events are sorted collection of events. Remarks: * An entity using the scheduler snapshot should not access past or future events to have some information on the state the simulation. * [See entity](docs/archi/snapshot_entity.png)
(consume-first-event {:automaton-simulation-de.simulation-engine/keys
[id iteration state past-events future-events date]
:as _snapshot})
Returns a snapshot
where the first future-event
is moved to the past-events
and date
is updated to this date
.
Returns a `snapshot` where the first `future-event` is moved to the `past-events` and `date` is updated to this `date`.
(inconsistency? {:automaton-simulation-de.simulation-engine/keys [date]
:as snapshot})
Check snapshot consistency
Returns:
::sim-engine/nil-date
if there is no date set in the snapshot.Check snapshot consistency Returns: * `::sim-engine/nil-date` if there is no date set in the snapshot. * sequence of future events which are before current date * past events which are after current date Returns false if consistent
(initial starting-evt-type date)
Creates an initial snapshsot
Creates an initial snapshsot
(next-iteration snapshot)
Update the snapshot
to the next iteration.
Update the `snapshot` to the next iteration.
Scheduler snapshot is a map containing:
id
- Unique identificator of an scheduler snapshot. It is in a one to one relationship with a scheduler snapshot (so it acts like an id of that scheduler snapshot in the context of a scheduler play) in the context scheduler.iteration
- A counter of scheduler iteration. By convention, the counter is starting at 1.date
- Defines the date where that scheduler-snapshot happensstate
- State modified by the eventpast-events
- Collection of a past event. A past event is event that has already been executed, so its date is in the past. A past event cannot be modified anymore (i.e. it is immutable).future-events
- Collection of a future event. A future event is an event that has not been executed yet, so its date is in the future. A future event may be updated during the simulation - its date may change, its data may change or it could be cancelled (i.e. it’s a mutable event)Scheduler snapshot is a map containing: * `id` - Unique identificator of an scheduler snapshot. It is in a one to one relationship with a scheduler snapshot (so it acts like an id of that scheduler snapshot in the context of a scheduler play) in the context scheduler. * `iteration` - A counter of scheduler iteration. By convention, the counter is starting at 1. * `date` - Defines the date where that scheduler-snapshot happens * `state` - State modified by the event * `past-events` - Collection of a past event. A past event is event that has already been executed, so its date is in the past. A past event cannot be modified anymore (i.e. it is immutable). * `future-events` - Collection of a future event. A future event is an event that has not been executed yet, so its date is in the future. A future event may be updated during the simulation - its date may change, its data may change or it could be cancelled (i.e. it’s a mutable event)
(sort-future-events snapshot sorting)
Sort future-events
in snapshot
thanks the sorting
sorter.
Sort `future-events` in `snapshot` thanks the `sorting` sorter.
(update snapshot future-events state)
Helper to update future-events
and state
.
Please note both will be replaced and not updated.
Helper to update `future-events` and `state`. Please note both will be replaced and not updated.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close