public override State TraverseDown(TransitionEvent transitionEvent)
		{
			Enter(transitionEvent);

			// If we have history, transition there
			if (lastState != null)
			{
				Transition transition = new Transition(this, HistoryTransition, lastState);
				TransitionEvent transitionFromHistory = new TransitionEvent(this, transition, new EventInstance(HistoryTransition));

				return TraverseUp(transitionFromHistory);
			}
			// If we have no history, transition to parent
			else
			{
				Transition transition = new Transition(this, StateMachine.DefaultEntryEvent, Parent);
				TransitionEvent transitionToDefault = 
					new TransitionEvent(this, transition, new EventInstance(StateMachine.DefaultEntryEvent));

				return TraverseUp(transitionToDefault);
			}
		}
		public override bool MatchesTransition(Transition transition)
		{
			return base.MatchesTransition(transition) && transition.SourceState.Equals(targetState);
		}
示例#3
0
		public void AddTransition(Transition transition)
		{
			transitions.AddTransition(transition);
		}
		public virtual bool MatchesTransition(Transition transition)
		{
			return eventTarget.Equals(transition.EventTarget);
		}
		public TransitionEvent(State sourceState, Transition transition, EventInstance eventInstance)
		{
			this.sourceState = sourceState;
			this.transition = transition;
			this.eventInstance = eventInstance;
		}