Skip to content

Commit 3a1ab3a

Browse files
committed
Remove old StateMachineBuilder code
1 parent e65574b commit 3a1ab3a

1 file changed

Lines changed: 0 additions & 74 deletions

File tree

lib/src/main/kotlin/io/nexure/fsm/StateMachineBuilder.kt

Lines changed: 0 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -64,77 +64,3 @@ sealed class StateMachineBuilder<S : Any, E : Any> {
6464
operator fun <S : Any, E : Any> invoke(): Uninitialized<S, E> = Uninitialized()
6565
}
6666
}
67-
//
68-
///**
69-
// * - [S] - the type of state that the state machine handles
70-
// * - [E] - the type of events that the can trigger state changes
71-
// */
72-
//class StateMachineBuilder<S : Any, E : Any> private constructor(
73-
// private var initialState: S? = null,
74-
// private val transitions: List<Edge<S, E>> = emptyList(),
75-
//) {
76-
// constructor() : this(null, emptyList())
77-
//
78-
// /**
79-
// * Set the initial state for this state machine. There must be exactly one initial state,
80-
// * no more or less. Failing to set an initial state for a state machine will cause an
81-
// * [InvalidStateMachineException] to be thrown when [build()] is invoked.
82-
// *
83-
// * Calling this method more than once, with a different initial state will also cause an
84-
// * [InvalidStateMachineException] to be thrown, but immediately upon the second call to this
85-
// * method rather when the state machine is built.
86-
// */
87-
// @Throws(InvalidStateMachineException::class)
88-
// fun initial(state: S): StateMachineBuilder<S, E> {
89-
// return if (initialState == null) {
90-
// StateMachineBuilder(state, transitions)
91-
// } else if (state === initialState) {
92-
// StateMachineBuilder(initialState, transitions)
93-
// } else {
94-
// throw InvalidStateMachineException("There can only be one initial state")
95-
// }
96-
// }
97-
//
98-
// /**
99-
// * Create a state transition from [source] state to [target] state that will be triggered by
100-
// * [event]. There can be multiple events that connect [source] and [target],
101-
// * but there must never be any ambiguous transitions.
102-
// *
103-
// * For example, having both of the following transitions, would NOT be permitted
104-
// * - `(S1, E1) -> S2`
105-
// * - `(S1, E1) -> S3`
106-
// *
107-
// * since it would not be clear if the new state should be `S2` or `S3` when event `E1` is
108-
// * received.
109-
// */
110-
// fun connect(
111-
// source: S,
112-
// target: S,
113-
// event: E,
114-
// ): StateMachineBuilder<S, E> = connect(Edge(source, target, event))
115-
//
116-
// private fun connect(edge: Edge<S, E>): StateMachineBuilder<S, E> =
117-
// StateMachineBuilder(initialState, transitions.plus(edge))
118-
//
119-
// /**
120-
// * @throws InvalidStateMachineException if the configured state machine is not valid. The main
121-
// * reasons for a state machine not being valid are:
122-
// * - No initial state
123-
// * - More than one initial state
124-
// * - The state machine is not connected (some states are not possible to reach from the initial
125-
// * state)
126-
// * - The same source state and event is defined twice
127-
// */
128-
// @Throws(InvalidStateMachineException::class)
129-
// fun build(): StateMachine<S, E> {
130-
// val initState: S = initialState
131-
// ?: throw InvalidStateMachineException("No initial state set for state machine")
132-
//
133-
// StateMachineValidator.validate(initState, transitions)
134-
//
135-
// return StateMachineImpl(
136-
// initState,
137-
// transitions,
138-
// )
139-
// }
140-
//}

0 commit comments

Comments
 (0)