private void GatherPeers(List <ObjectModel.ITransition> peerTransitions, ObjectModel.ITransition transition, IEnumerable <ObjectModel.ITransition> transitionList)
 {
     foreach (ObjectModel.ITransition t in transitionList)
     {
         if ((t.SourceState == transition.SourceState && t.DestinationState == transition.DestinationState) ||
             (t.SourceState == transition.DestinationState && t.DestinationState == transition.SourceState))
         {
             if (!peerTransitions.Contains(t))
             {
                 peerTransitions.Add(t);
             }
         }
     }
 }
        //  This method calculates the relative position of a transition among all the transitions that originate or
        //  terminate at this state, which share a common opposite state.

        public int GetRelativePeerPosition(ObjectModel.ITransition transition)
        {
            List <ObjectModel.ITransition> peerTransitions = new List <ObjectModel.ITransition>();

            GatherPeers(peerTransitions, transition, TransitionsFrom);
            GatherPeers(peerTransitions, transition, TransitionsTo);

            int position = 0;

            foreach (ObjectModel.ITransition t in peerTransitions)
            {
                if (t.Id < transition.Id)
                {
                    position++;
                }
            }
            return(position);
        }
Ejemplo n.º 3
0
 internal MembershipChangeArgument(MembershipChangeAction action, ObjectModel.ITransition transition)
 {
     Action     = action;
     Endpoint   = null;
     Transition = transition;
 }
Ejemplo n.º 4
0
 internal MembershipChangeArgument(MembershipChangeAction action, ObjectModel.ITransitionEndpoint endpoint)
 {
     Action     = action;
     Endpoint   = endpoint;
     Transition = null;
 }