/// <summary> /// Helper method for access to the underlying state via Interlocked /// </summary> /// <param name="oldState">Previous state on transition</param> /// <param name="newState">Next state on transition</param> /// <returns>Whether the previous state matched correctly</returns> private bool SwapState(AtomicState oldState, AtomicState newState) { return(Interlocked.CompareExchange(ref _currentState, newState, oldState) == oldState); }
/// <summary> /// Trips breaker to an open state. This is valid from Closed or Half-Open states /// </summary> /// <param name="fromState">State we're coming from (Closed or Half-Open)</param> internal void TripBreaker(AtomicState fromState) { Transition(fromState, Open); }
public Actor(AtomicState state, IScrollableCursor cursor) { this.state = state; this.cursor = cursor; }
public EpsilonTransition(AtomicState fromState) : base(fromState, true) { }
public Transition(AtomicState fromState, bool epsilon) : this(fromState, null) { this.epsilon = epsilon; }
public Transition(AtomicState fromState, Func <Char> input) { this.fromState = fromState; this.input = input; }