/ fm / liveswitch / StreamStateMachine
Class: StreamStateMachine
fm.liveswitch.StreamStateMachine
A state machine for stream states.
Hierarchy
-
↳ StreamStateMachine
Table of contents
Constructors
Methods
- addTransition
- canTransition
- getLastStateMillis
- getLastStateTicks
- getPromise
- getState
- getStateValue
- getSystemTimestamp
- getTypeString
- isReachable
- stateToValue
- transition
- valueToState
Constructors
constructor
+ new StreamStateMachine(): StreamStateMachine
Initializes a new instance of the [[fm.liveswitch.streamStateMachine]] class.
Returns: StreamStateMachine
Inherited from: StateMachine
Defined in: Generated/TypeScript/fm.liveswitch/StreamStateMachine.ts:12
Methods
addTransition
▸ addTransition(fromState
: StreamState, toState
: StreamState): void
Adds an allowed transition.
Parameters:
Name | Type | Description |
---|---|---|
fromState |
StreamState | The "from" state. |
toState |
StreamState | The "to" state. |
Returns: void
Inherited from: StateMachine
Defined in: Generated/TypeScript/fm.liveswitch/StateMachine.ts:85
canTransition
▸ canTransition(toState
: StreamState): boolean
Determines whether a transition to the specified state is allowed.
Parameters:
Name | Type | Description |
---|---|---|
toState |
StreamState | The "to" state. |
Returns: boolean
true
if a transition to the specified state is allowed; otherwise, false
.
Inherited from: StateMachine
Defined in: Generated/TypeScript/fm.liveswitch/StateMachine.ts:118
getLastStateMillis
▸ getLastStateMillis(): number
Gets the length of time spent in the last state, in milliseconds.
Returns: number
Inherited from: StateMachine
Defined in: Generated/TypeScript/fm.liveswitch/StateMachine.ts:183
getLastStateTicks
▸ getLastStateTicks(): number
Gets the length of time spent in the last state, in ticks.
Returns: number
Inherited from: StateMachine
Defined in: Generated/TypeScript/fm.liveswitch/StateMachine.ts:200
getPromise
▸ getPromise<R>(state
: StreamState, returnValue
: R): Promise<R>
Gets a promise, which may be resolved or rejected depending on the current state of this machine.
Type parameters:
Name | Type |
---|---|
R |
Object |
Parameters:
Name | Type | Description |
---|---|---|
state |
StreamState | State, in which promise must be resolved. |
returnValue |
R | Return type of this promise. |
Returns: Promise<R>
Promise, which may be resolved or rejected depending on the current state of this machine
Inherited from: StateMachine
Defined in: Generated/TypeScript/fm.liveswitch/StateMachine.ts:215
getState
▸ getState(): StreamState
Gets the state.
Returns: StreamState
Inherited from: StateMachine
Defined in: Generated/TypeScript/fm.liveswitch/StateMachine.ts:238
getStateValue
▸ Protected
getStateValue(): number
Gets the state value.
Returns: number
Inherited from: StateMachine
Defined in: Generated/TypeScript/fm.liveswitch/StateMachine.ts:250
getSystemTimestamp
▸ getSystemTimestamp(): number
Gets the system timestamp of the last state transition.
Returns: number
Inherited from: StateMachine
Defined in: Generated/TypeScript/fm.liveswitch/StateMachine.ts:263
getTypeString
▸ getTypeString(): string
Returns: string
Overrides: StateMachine
Defined in: Generated/TypeScript/fm.liveswitch/StreamStateMachine.ts:10
isReachable
▸ isReachable(state
: StreamState): boolean
Determines whether a transition to a specified state is possible (even via intermediate hops).
Parameters:
Name | Type | Description |
---|---|---|
state |
StreamState | The "to" state. |
Returns: boolean
true
if a transition to the specified state is possible; otherwise, false
.
Inherited from: StateMachine
Defined in: Generated/TypeScript/fm.liveswitch/StateMachine.ts:278
stateToValue
▸ Protected
stateToValue(state
: StreamState): number
Converts a state to an integer value.
Parameters:
Name | Type | Description |
---|---|---|
state |
StreamState | The state. |
Returns: number
Overrides: StateMachine
Defined in: Generated/TypeScript/fm.liveswitch/StreamStateMachine.ts:49
transition
▸ transition(toState
: StreamState): boolean
Transitions to the specified state.
Parameters:
Name | Type | Description |
---|---|---|
toState |
StreamState | The "to" state. |
Returns: boolean
true
if a transition to the specified state is allowed; otherwise, false
.
Inherited from: StateMachine
Defined in: Generated/TypeScript/fm.liveswitch/StateMachine.ts:333
valueToState
▸ Protected
valueToState(value
: number): StreamState
Converts an integer value to a state.
Parameters:
Name | Type | Description |
---|---|---|
value |
number | The integer value. |
Returns: StreamState
Overrides: StateMachine
Defined in: Generated/TypeScript/fm.liveswitch/StreamStateMachine.ts:62