1 package org.simantics.simulator.toolkit;
3 import org.simantics.simulator.ExperimentState;
6 * @author Antti Villberg
9 public class StandardExperimentStates implements ExperimentState {
12 * The experiment context has been created.
15 * Allowed successor states: {@link Instantiated}, {@link ToBeDisposed}
17 public interface Created extends ExperimentState {}
20 * The experiment context has been instantiated, i.e. underlying experimentation
21 * resources have been acquired. Some experiment setup (e.g. setting certain
22 * values) can be done in this state that cannot be touched once the experiment
26 * Allowed successor states: {@link Initializing}, {@link ToBeDisposed}
28 public interface Instantiated extends ExperimentState {}
31 * The experiment context is in the process of being initialized. This means
32 * that any initial conditions or related data is being loaded into the
33 * simulator/solver/what ever system that runs the experiment.
35 * If the initialization fails due to an irrecoverable system error, the
36 * experiment shall move to {@link Failure} state. If the initialization fails
37 * due to a recoverable error in user input, the experiment shall move to
38 * {@link Instantiated} state.
41 * Allowed successor states: {@link Initialized}, {@link Instantiated},
44 public interface Initializing extends ExperimentState {}
47 * The experiment context has been initialized, i.e. the underlying
48 * experimentation resources have been both acquired and initialized with a
52 * Allowed successor states: {@link Stopped}, {@link Running},
53 * {@link ToBeDisposed}
55 public interface Initialized extends ExperimentState {}
58 * The experiment shall be ran until it reaches an objective such as
59 * steady-state or running for a duration or until the state changes to
63 * Allowed successor states: {@link Stopped}, {@link ToBeDisposed}
65 public interface Running extends ExperimentState {}
68 * The experiment shall remain stopped. Everything in the experiment context
69 * should remain constant while in this state.
72 * Allowed successor states: {@link Running}, {@link ToBeDisposed}
74 public interface Stopped extends ExperimentState {}
77 * Moving into this state marks the beginning of the disposal of this
78 * experiment. The imminent disposal is irreversible and cannot be vetoed
82 * Allowed successor states: {@link Disposing}
84 public interface ToBeDisposed extends ExperimentState {}
87 * The experiment context is being disposed, i.e. underlying experimentation
88 * resources are being freed and disposed of accordingly.
91 * Allowed successor states: {@link Disposing}
93 public interface Disposing extends ExperimentState {}
96 * The experiment has been completely disposed and cannot any longer be used for
100 * Allowed successor states: none, this is a final state
102 public interface Disposed extends ExperimentState {}
105 * The experiment implementation has ran into a fatal failure. The experiment
106 * context can still be accessed at this point but the experiment can only move
107 * into {@link Disposed} state.
110 * Allowed successor states: {@link Disposed}
112 public interface Failure extends ExperimentState {}
114 public static final ExperimentState CREATED = new Created() {};
115 public static final ExperimentState INSTANTIATED = new Instantiated() {};
116 public static final ExperimentState INITIALIZING = new Initializing() {};
117 public static final ExperimentState INITIALIZED = new Initialized() {};
118 public static final ExperimentState RUNNING = new Running() {};
119 public static final ExperimentState STOPPED = new Stopped() {};
120 public static final ExperimentState TO_BE_DISPOSED = new ToBeDisposed() {};
121 public static final ExperimentState DISPOSING = new Disposing() {};
122 public static final ExperimentState DISPOSED = new Disposed() {};