Пример #1
0
 /// <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);
 }
Пример #2
0
 /// <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);
 }
Пример #3
0
 public Actor(AtomicState state, IScrollableCursor cursor)
 {
     this.state  = state;
     this.cursor = cursor;
 }
Пример #4
0
 public EpsilonTransition(AtomicState fromState)
     : base(fromState, true)
 {
 }
Пример #5
0
 public Transition(AtomicState fromState, bool epsilon)
     : this(fromState, null)
 {
     this.epsilon = epsilon;
 }
Пример #6
0
 public Transition(AtomicState fromState, Func <Char> input)
 {
     this.fromState = fromState;
     this.input     = input;
 }