Coverage Summary for Class: Transition (vit.khudenko.android.sessiontracker)
Class |
Class, %
|
Method, %
|
Line, %
|
Transition |
100%
(1/1)
|
100%
(1/1)
|
100%
(6/6)
|
1 package vit.khudenko.android.sessiontracker
2
3 import vit.khudenko.android.fsm.StateMachine
4
5 /**
6 * A transition defines its identity as a pair of the [`event`][event] and the starting state
7 * (the first item in the [`statePath`][statePath]). `StateMachine` allows unique transitions
8 * only (each transition must have a unique identity).
9 *
10 * @param event [`Event`][Event] - triggering event for this transition.
11 * @param statePath a list of states for this transition.
12 * First item is a starting state for the transition.
13 * Must have at least two items. Must not have repeating items in a row.
14 *
15 * @throws [IllegalArgumentException] if statePath has less than 2 items OR has repeating items in a row
16 *
17 * @param [Event] event parameter of enum type.
18 * @param [State] state parameter of enum type.
19 */
20 class Transition<Event : Enum<Event>, State : Enum<State>>(
21 val event: Event,
22 val statePath: List<State>
23 ) {
24 init {
25 // trigger validation
26 StateMachine.Transition(event, statePath)
27 }
28 }