import { SMStateName, SMEvent, IStateMachine, IState, EventDescription, StateDescription, Visitable, SMVisitor, Substates } from "./types"; /** * A state is ultimately a set of transition actions event handlers and guard conditions * * When event is sent to the machine, * machine should find a state node that can handle that event. * * Once state node is found event processing begins on its parent. * Transition can only happen withing the same parent, other transitions are illegal * * Event processing: * First we find the right event descriptor by evaluating guards *k * With descriptor: * If there are just actions - then they are executed. * * If it is a transition, then we do following * * 1. We call children nodes that are active to withdraw and perform exit actions * 2. Get new state node, ask it to recursevly resume * * What happens when some handler throws error? global state handling * * */ export declare class State implements IState, Visitable { private stateMachine; name: SMStateName; config: StateDescription; parent?: IState; enabled: boolean; enabledSubstate?: IState; substates: Substates; logger: any; parallel: boolean; initial: boolean; final: boolean; isLeafState: boolean; initialSubstate?: IState; historySubstate?: IState; constructor(stateMachine: IStateMachine, name: SMStateName, config: StateDescription, parent?: IState); accept(visitor: SMVisitor): void; private createSubstates; withdraw(eventName: SMEvent, eventArgs: any): void; withdrawSubstates(eventName: SMEvent, eventArgs: any): void; resume(eventName?: SMEvent, eventArgs?: any): void; resumeSubstates(eventName: SMEvent, eventArgs: any): void; getResumingSubstate(): IState; hasEvent(event: SMEvent): boolean; setEnabledSubstate(state?: IState): void; setHistorySubstate(state?: IState): void; setEnabled(isEnabled: boolean): void; performTransition(newStateName: SMStateName, eventName: SMEvent, eventArgs?: any): void; private performExitActions; private performEntryActions; private performActions; private checkFinal; processEvent(eventName: SMEvent, eventArgs?: any): void; withdrawOnTransition(eventDescription: EventDescription, eventName: SMEvent, eventArgs: any): void; private executeEvent; requestTransitionOnTransition(eventDescription: EventDescription, eventName: SMEvent, eventArgs: any): void; sendEntryMessage(eventArgs?: any): void; sendExitMessage(eventArgs?: any): void; sendTransitionMessage(event: EventDescription, eventArgs?: any): void; private exitMessage; private entryMessage; private performOnTransitionActions; getEventDescription(eventName: SMEvent, eventArgs?: any): EventDescription; validateSingleLegalDescriptions(descriptions: Array, eventName: SMEvent): EventDescription[]; getGuardsPassingEventDescriptions(eventName: SMEvent, eventArgs: any): EventDescription[]; areGuardsPassed(evDescription: EventDescription, eventName: SMEvent, eventArgs: any): boolean; } export declare function createState(stateMachine: IStateMachine, name: SMStateName, config: StateDescription, parent?: IState): State;