Skip to content

Commit 1e41753

Browse files
Renamed to Isa88StateMachine
1 parent 20b54dc commit 1e41753

26 files changed

Lines changed: 207 additions & 207 deletions

src/main/java/statemachine/Isa88StateMachine.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@
55
import states.State;
66
import states.TransitionName;
77

8-
public class StateMachine {
8+
public class Isa88StateMachine {
99

1010
private State currentState;
1111
private StateActionManager stateActionManager = new StateActionManager();
1212
private ArrayList<IStateChangeObserver> stateChangeObservers = new ArrayList<>();
1313

1414
/**
15-
* Instantiates a new {@link StateMachine} with the a given initial state
15+
* Instantiates a new {@link Isa88StateMachine} with the a given initial state
1616
*
1717
* @param initialState State that the state machine is in upon starting
1818
*/
19-
StateMachine(State initialState) {
19+
Isa88StateMachine(State initialState) {
2020
this.currentState = initialState;
2121
}
2222

@@ -137,7 +137,7 @@ public State getState() {
137137
*
138138
* @param state The new state that will be set as the current state
139139
*/
140-
protected void setState(State state) {
140+
protected synchronized void setState(State state) {
141141
this.currentState = state;
142142
}
143143

@@ -146,7 +146,7 @@ protected void setState(State state) {
146146
*
147147
* @param state The new state that will be set as the current state
148148
*/
149-
public void setStateAndRunAction(State state) {
149+
public synchronized void setStateAndRunAction(State state) {
150150
this.currentState = state;
151151

152152
for (IStateChangeObserver observer : stateChangeObservers) {

src/main/java/statemachine/StateMachineBuilder.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
import states.impl.*;
77

88
/**
9-
* Builder class that is in charge of constructing a properly set up {@link StateMachine}
9+
* Builder class that is in charge of constructing a properly set up {@link Isa88StateMachine}
1010
*/
1111
public class StateMachineBuilder {
1212

13-
private StateMachine stateMachine;
13+
private Isa88StateMachine stateMachine;
1414

1515
public StateMachineBuilder() {
16-
this.stateMachine = new StateMachine(new IdleState());
16+
this.stateMachine = new Isa88StateMachine(new IdleState());
1717
}
1818

1919
/**
@@ -198,11 +198,11 @@ public StateMachineBuilder withActionInClearing(IStateAction action) {
198198
}
199199

200200
/**
201-
* Finishes building the {@link StateMachine} and returns a fresh instance with the given attributes
201+
* Finishes building the {@link Isa88StateMachine} and returns a fresh instance with the given attributes
202202
*
203-
* @return Fresh instance of {@link StateMachine}
203+
* @return Fresh instance of {@link Isa88StateMachine}
204204
*/
205-
public StateMachine build() {
205+
public Isa88StateMachine build() {
206206
return this.stateMachine;
207207
}
208208
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package states;
22

3-
import statemachine.StateMachine;
3+
import statemachine.Isa88StateMachine;
44
import states.impl.AbortingState;
55

66
/**
@@ -9,11 +9,11 @@
99
public abstract class AbortableState extends State {
1010

1111
@Override
12-
public void abort(StateMachine stateMachine) {
12+
public void abort(Isa88StateMachine stateMachine) {
1313
stateMachine.setStateAndRunAction(new AbortingState());
1414
}
1515

1616
@Override
17-
public void stop(StateMachine stateMachine) {
17+
public void stop(Isa88StateMachine stateMachine) {
1818
}
1919
}

src/main/java/states/IState.java

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package states;
22

3-
import statemachine.StateMachine;
3+
import statemachine.Isa88StateMachine;
44
import states.impl.AbortedState;
55
import states.impl.AbortingState;
66
import states.impl.ClearingState;
@@ -23,66 +23,66 @@ public interface IState {
2323

2424
/**
2525
* The start command does only have an effect in {@link IdleState}. With this command, the state machine will change to the {@link ExecuteState}
26-
* @param stateMachine A reference to the current {@link StateMachine} instance
26+
* @param stateMachine A reference to the current {@link Isa88StateMachine} instance
2727
*/
28-
public void start(StateMachine stateMachine);
28+
public void start(Isa88StateMachine stateMachine);
2929

3030
/**
3131
* The hold command is used when interal reasons of a machine should bring it to an halt. Such reasons could be e.g. necessary refill of material.
3232
* With this command, the state machine will transition to a {@link HoldingState} and eventually come to a full {@link HeldState}.
33-
* @param stateMachine A reference to the current {@link StateMachine} instance
33+
* @param stateMachine A reference to the current {@link Isa88StateMachine} instance
3434
*/
35-
public void hold(StateMachine stateMachine);
35+
public void hold(Isa88StateMachine stateMachine);
3636

3737
/**
3838
* The unhold command brings the machine into an {@link UnholdingState} that eventually leads back to the {@link ExecuteState}. The hold command
3939
* should be used when the internal reasons that brought a machine into a {@link HeldState} have been cleared.
40-
* @param stateMachine A reference to the current {@link StateMachine} instance
40+
* @param stateMachine A reference to the current {@link Isa88StateMachine} instance
4141
*/
42-
public void unhold(StateMachine stateMachine);
42+
public void unhold(Isa88StateMachine stateMachine);
4343

4444
/**
4545
* The suspend command is used when extenal reasons of a machine should bring it to an halt. Such reasons could be e.g. waiting for following
4646
* machines to accept a workpiece. With this command, the state machine will transition to a {@link SuspendingState} and eventually come to a full
4747
* {@link SuspendedState}.
48-
* @param stateMachine A reference to the current {@link StateMachine} instance
48+
* @param stateMachine A reference to the current {@link Isa88StateMachine} instance
4949
*/
50-
public void suspend(StateMachine stateMachine);
50+
public void suspend(Isa88StateMachine stateMachine);
5151

5252
/**
5353
* The unsuspend command brings the machine into an {@link UnsuspendingState} that eventually leads back to the {@link ExecuteState}. The
5454
* unsuspend command should be used when the external reasons that brought a machine into a {@link SuspendedState} have been cleared.
55-
* @param stateMachine A reference to the current {@link StateMachine} instance
55+
* @param stateMachine A reference to the current {@link Isa88StateMachine} instance
5656
*/
57-
public void unsuspend(StateMachine stateMachine);
57+
public void unsuspend(Isa88StateMachine stateMachine);
5858

5959
/**
6060
* The reset command brings the machine into a {@link ResettingState} that eventually leads back to the {@link IdleState}. The reset command can
6161
* be used when the machine has been brought to a sudden halt (e.g. with stop or abort command)
62-
* @param stateMachine A reference to the current {@link StateMachine} instance
62+
* @param stateMachine A reference to the current {@link Isa88StateMachine} instance
6363
*/
64-
public void reset(StateMachine stateMachine);
64+
public void reset(Isa88StateMachine stateMachine);
6565

6666
/**
6767
* The stop command can be triggered by an external system such as an MES. Stop brings the state machine to a {@link StoppingState} and from there
6868
* to a {@link StoppedState}. The currently produced product should not be destroyed and production can continue after the machine has been reset.
69-
* @param stateMachine A reference to the current {@link StateMachine} instance
69+
* @param stateMachine A reference to the current {@link Isa88StateMachine} instance
7070
*/
71-
public void stop(StateMachine stateMachine);
71+
public void stop(Isa88StateMachine stateMachine);
7272

7373
/**
7474
* The abort command can be triggered by an external system such as an MES. Abort brings the state machine to a sudden stop by transitioning to
7575
* the {@link AbortingState} and eventually to the {@link AbortedState}. The machine is switched off, the currently produced product might have to
7676
* be destroyed and production of it can not be continued.
77-
* @param stateMachine A reference to the current {@link StateMachine} instance
77+
* @param stateMachine A reference to the current {@link Isa88StateMachine} instance
7878
*/
79-
public void abort(StateMachine stateMachine);
79+
public void abort(Isa88StateMachine stateMachine);
8080

8181
/**
8282
* After a machine has been brought to the {@link AbortedState}, a clear command can be used to bring it to a {@link ClearingState} to e.g. remove
8383
* destroyed products. From the {@link ClearingState}, the machine will come to the {@link StoppedState} from which it then can be reset.
84-
* @param stateMachine A reference to the current {@link StateMachine} instance
84+
* @param stateMachine A reference to the current {@link Isa88StateMachine} instance
8585
*/
86-
public void clear(StateMachine stateMachine);
86+
public void clear(Isa88StateMachine stateMachine);
8787

8888
}

src/main/java/states/State.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
package states;
22

3-
import statemachine.StateMachine;
3+
import statemachine.Isa88StateMachine;
44

55
public abstract class State implements IState {
66

77
/**
88
* Execute an action, complete this state and transition to the next state
99
* @param stateMachine The current state machine instance
1010
*/
11-
public void executeActionAndComplete(StateMachine stateMachine) {
11+
public void executeActionAndComplete(Isa88StateMachine stateMachine) {
1212
// Default implementation: Do nothing
1313
}
1414

src/main/java/states/StoppableState.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package states;
22

3-
import statemachine.StateMachine;
3+
import statemachine.Isa88StateMachine;
44
import states.impl.StoppedState;
55

66
/**
@@ -10,7 +10,7 @@ public abstract class StoppableState extends AbortableState {
1010

1111

1212
@Override
13-
public void stop(StateMachine stateMachine) {
13+
public void stop(Isa88StateMachine stateMachine) {
1414
// Execute the stop-method that the developer implemented (has that to be executed in another thread?)
1515
// Inside of the thread: Update the state in the ontology to now be "Stopping"
1616
// When the thread is done: Update the state in the ontology to now be "Stopped" (might have to be done in the other thread as well)

src/main/java/states/impl/AbortedState.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package states.impl;
22

3-
import statemachine.StateMachine;
3+
import statemachine.Isa88StateMachine;
44
import states.State;
55

66
/**
@@ -10,47 +10,47 @@
1010
public class AbortedState extends State {
1111

1212
@Override
13-
public void start(StateMachine stateMachine) {
13+
public void start(Isa88StateMachine stateMachine) {
1414
// Start cannot be fired from Aborted -> Do nothing except maybe giving a warning
1515
}
1616

1717
@Override
18-
public void hold(StateMachine stateMachine) {
18+
public void hold(Isa88StateMachine stateMachine) {
1919
// Hold cannot be fired from Aborted -> Do nothing except maybe giving a warning
2020
}
2121

2222
@Override
23-
public void unhold(StateMachine stateMachine) {
23+
public void unhold(Isa88StateMachine stateMachine) {
2424
// Unhold cannot be fired from Aborted -> Do nothing except maybe giving a warning
2525
}
2626

2727
@Override
28-
public void suspend(StateMachine stateMachine) {
28+
public void suspend(Isa88StateMachine stateMachine) {
2929
// Suspend cannot be fired from Aborted -> Do nothing except maybe giving a warning
3030
}
3131

3232
@Override
33-
public void unsuspend(StateMachine stateMachine) {
33+
public void unsuspend(Isa88StateMachine stateMachine) {
3434
// Unsuspend cannot be fired from Aborted -> Do nothing except maybe giving a warning
3535
}
3636

3737
@Override
38-
public void reset(StateMachine stateMachine) {
38+
public void reset(Isa88StateMachine stateMachine) {
3939
// Reset cannot be fired from Aborted -> Do nothing except maybe giving a warning
4040
}
4141

4242
@Override
43-
public void stop(StateMachine stateMachine) {
43+
public void stop(Isa88StateMachine stateMachine) {
4444
// Stop cannot be fired from Aborted -> Do nothing except maybe giving a warning
4545
}
4646

4747
@Override
48-
public void abort(StateMachine stateMachine) {
48+
public void abort(Isa88StateMachine stateMachine) {
4949
// Abort cannot be fired from Aborted -> Do nothing except maybe giving a warning
5050
}
5151

5252
@Override
53-
public void clear(StateMachine stateMachine) {
53+
public void clear(Isa88StateMachine stateMachine) {
5454
stateMachine.setStateAndRunAction(new ClearingState());
5555
}
5656

src/main/java/states/impl/AbortingState.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package states.impl;
22

3-
import statemachine.StateMachine;
3+
import statemachine.Isa88StateMachine;
44
import states.ActiveStateName;
55
import states.IStateAction;
66
import states.State;
@@ -12,52 +12,52 @@
1212
public class AbortingState extends State {
1313

1414
@Override
15-
public void start(StateMachine stateMachine) {
15+
public void start(Isa88StateMachine stateMachine) {
1616
// Start cannot be fired from Aborting -> Do nothing except maybe giving a warning
1717
}
1818

1919
@Override
20-
public void hold(StateMachine stateMachine) {
20+
public void hold(Isa88StateMachine stateMachine) {
2121
// Hold cannot be fired from Aborting -> Do nothing except maybe giving a warning
2222
}
2323

2424
@Override
25-
public void unhold(StateMachine stateMachine) {
25+
public void unhold(Isa88StateMachine stateMachine) {
2626
// Unhold cannot be fired from Aborting -> Do nothing except maybe giving a warning
2727
}
2828

2929
@Override
30-
public void suspend(StateMachine stateMachine) {
30+
public void suspend(Isa88StateMachine stateMachine) {
3131
// Suspend cannot be fired from Aborting -> Do nothing except maybe giving a warning
3232
}
3333

3434
@Override
35-
public void unsuspend(StateMachine stateMachine) {
35+
public void unsuspend(Isa88StateMachine stateMachine) {
3636
// Unsuspend cannot be fired from Aborting -> Do nothing except maybe giving a warning
3737
}
3838

3939
@Override
40-
public void reset(StateMachine stateMachine) {
40+
public void reset(Isa88StateMachine stateMachine) {
4141
// Reset cannot be fired from Aborting -> Do nothing except maybe giving a warning
4242
}
4343

4444
@Override
45-
public void stop(StateMachine stateMachine) {
45+
public void stop(Isa88StateMachine stateMachine) {
4646
// Stop cannot be fired from Aborting -> Do nothing except maybe giving a warning
4747
}
4848

4949
@Override
50-
public void abort(StateMachine stateMachine) {
50+
public void abort(Isa88StateMachine stateMachine) {
5151
// Abort cannot be fired from Aborting -> Do nothing except maybe giving a warning
5252
}
5353

5454
@Override
55-
public void clear(StateMachine stateMachine) {
55+
public void clear(Isa88StateMachine stateMachine) {
5656
// Clear cannot be fired from Aborting -> Do nothing except maybe giving a warning
5757
}
5858

5959
@Override
60-
public void executeActionAndComplete(StateMachine stateMachine) {
60+
public void executeActionAndComplete(Isa88StateMachine stateMachine) {
6161
IStateAction actionToRun = stateMachine.getStateActionManager().getAction(ActiveStateName.Aborting);
6262
super.executeAction(actionToRun);
6363

0 commit comments

Comments
 (0)