/// <summary> /// Record statistics for specific variant. Now it's for #22's. /// </summary> /// <param name="currentState">Current state.</param> private void RecordTargetStatistics(SmsState currentState) { // hardcode: // container index = 0 // emitter index = 1 containerContentLength.Add(currentState.Key.ElementsStates[0].Code); if (currentState.Key.ElementsStates[1].CurrentState == SmsElementStateCode.Blocked) { ++emitterBlockedTakts; } }
/// <summary> /// Records data about current state. /// </summary> /// <param name="elements">Array of sms elements.</param> internal void Add(params IStateElement[] elements) { SmsStateKey key = new SmsStateKey( elements.Select(e => e.GetState()).ToList() ); SmsState currentState = SmsStates.FirstOrDefault(state => state.Key.Equals(key)); if (currentState == null) { SmsState newState = new SmsState(key); currentState = newState; SmsStates.Add(newState); } ++currentState; AddTransition(currentState); RecordTargetStatistics(currentState); previousState = currentState; }
private void AddTransition(SmsState currentState) { possibleTransitions.Add(new Transition() { From = previousState ?? currentState, To = currentState } ); }