]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.simulator.toolkit/src/org/simantics/simulator/toolkit/StandardExperimentStates.java
Simulator toolkit enhancements
[simantics/platform.git] / bundles / org.simantics.simulator.toolkit / src / org / simantics / simulator / toolkit / StandardExperimentStates.java
1 package org.simantics.simulator.toolkit;
2
3 import org.simantics.simulator.ExperimentState;
4
5 /**
6  * @author Antti Villberg
7  * @since 1.34.0
8  */
9 public class StandardExperimentStates implements ExperimentState {
10
11     /**
12      * The experiment context has been created.
13      *
14      * <p>
15      * Allowed successor states: {@link Instantiated}, {@link ToBeDisposed}
16      */
17     public interface Created extends ExperimentState {}
18
19     /**
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
23      * is initialized.
24      *
25      * <p>
26      * Allowed successor states: {@link Initializing}, {@link ToBeDisposed}
27      */
28     public interface Instantiated extends ExperimentState {}
29
30     /**
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.
34      * 
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.
39      *
40      * <p>
41      * Allowed successor states: {@link Initialized}, {@link Instantiated},
42      * {@link Failure}
43      */
44     public interface Initializing extends ExperimentState {}
45
46     /**
47      * The experiment context has been initialized, i.e. the underlying
48      * experimentation resources have been both acquired and initialized with a
49      * specific state.
50      * 
51      * <p>
52      * Allowed successor states: {@link Stopped}, {@link Running},
53      * {@link ToBeDisposed}
54      */
55     public interface Initialized extends ExperimentState {}
56
57     /**
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
60      * {@link Stopped}.
61      *
62      * <p>
63      * Allowed successor states: {@link Stopped}, {@link ToBeDisposed}
64      */
65     public interface Running extends ExperimentState {}
66
67     /**
68      * The experiment shall remain stopped. Everything in the experiment context
69      * should remain constant while in this state.
70      *
71      * <p>
72      * Allowed successor states: {@link Running}, {@link ToBeDisposed}
73      */
74     public interface Stopped extends ExperimentState {}
75
76     /**
77      * Moving into this state marks the beginning of the disposal of this
78      * experiment. The imminent disposal is irreversible and cannot be vetoed
79      * or interrupted.
80      *
81      * <p>
82      * Allowed successor states: {@link Disposing}
83      */
84     public interface ToBeDisposed extends ExperimentState {}
85
86     /**
87      * The experiment context is being disposed, i.e. underlying experimentation
88      * resources are being freed and disposed of accordingly.
89      *
90      * <p>
91      * Allowed successor states: {@link Disposing}
92      */
93     public interface Disposing extends ExperimentState {}
94
95     /**
96      * The experiment has been completely disposed and cannot any longer be used for
97      * anything.
98      *
99      * <p>
100      * Allowed successor states: none, this is a final state
101      */
102     public interface Disposed extends ExperimentState {}
103
104     /**
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.
108      *
109      * <p>
110      * Allowed successor states: {@link Disposed}
111      */
112     public interface Failure extends ExperimentState {}
113
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() {};
123
124 }