示例#1
0
        public void RemoveExitCondition(int index)
        {
            IExitCondition condition = exitConditions[index];

            foreach (LifecycleEventType eventType in condition.EventsSubscription)
            {
                conditionCountByEvent[(int)eventType]--;
                if (conditionCountByEvent[(int)eventType] == 0)
                {
                    switch (eventType)
                    {
                    case LifecycleEventType.HalfTState:
                        HalfTState -= CheckExitCondition;
                        break;

                    case LifecycleEventType.InstructionEnd:
                        InstructionEnd -= CheckExitCondition;
                        break;

                    case LifecycleEventType.InstructionStart:
                        InstructionStart -= CheckExitCondition;
                        break;

                    case LifecycleEventType.MachineCycleEnd:
                        MachineCycleEnd -= CheckExitCondition;
                        break;

                    case LifecycleEventType.MachineCycleStart:
                        MachineCycleStart -= CheckExitCondition;
                        break;
                    }
                }
            }
            exitConditions.RemoveAt(index);
        }
示例#2
0
        public int AddExitCondition(IExitCondition condition)
        {
            foreach (LifecycleEventType eventType in condition.EventsSubscription)
            {
                conditionCountByEvent[(int)eventType]++;
                if (conditionCountByEvent[(int)eventType] == 1)
                {
                    switch (eventType)
                    {
                    case LifecycleEventType.HalfTState:
                        HalfTState += CheckExitCondition;
                        break;

                    case LifecycleEventType.InstructionEnd:
                        InstructionEnd += CheckExitCondition;
                        break;

                    case LifecycleEventType.InstructionStart:
                        InstructionStart += CheckExitCondition;
                        break;

                    case LifecycleEventType.MachineCycleEnd:
                        MachineCycleEnd += CheckExitCondition;
                        break;

                    case LifecycleEventType.MachineCycleStart:
                        MachineCycleStart += CheckExitCondition;
                        break;
                    }
                }
            }
            exitConditions.Add(condition);
            return(exitConditions.Count - 1); // return index of exit condition to be able to remove it later
        }
示例#3
0
 public int AddExitCondition(IExitCondition condition)
 {
     foreach (LifecycleEventType eventType in condition.EventsSubscription)
     {
         switch (eventType)
         {
         case LifecycleEventType.ClockCycle:
             ClockCycle += condition.CheckExitCondition;
             break;
         }
     }
     exitConditions.Add(condition);
     return(exitConditions.Count - 1); // return index of exit condition to be able to remove it later
 }
 public int AddExitCondition(IExitCondition condition)
 {
     foreach (LifecycleEventType eventType in condition.EventsSubscription)
     {
         switch (eventType)
         {
             case LifecycleEventType.ClockCycle:
                 ClockCycle += condition.CheckExitCondition;
                 break;
         }
     }
     exitConditions.Add(condition);
     return exitConditions.Count - 1; // return index of exit condition to be able to remove it later
 }
示例#5
0
        public void RemoveExitCondition(int index)
        {
            IExitCondition condition = exitConditions[index];

            foreach (LifecycleEventType eventType in condition.EventsSubscription)
            {
                switch (eventType)
                {
                case LifecycleEventType.ClockCycle:
                    ClockCycle -= condition.CheckExitCondition;
                    break;
                }
            }
            exitConditions.RemoveAt(index);
        }
示例#6
0
 public ExitConditionException(IExitCondition exitCondition, InternalState internalState, LifecycleEventType eventType)
 {
     this.ExitCondition = exitCondition;
     this.InternalState = internalState;
     this.EventType     = eventType;
 }
 public ExitConditionException(IExitCondition exitCondition, InternalState internalState, LifecycleEventType eventType)
 {
     this.ExitCondition = exitCondition;
     this.InternalState = internalState;
     this.EventType = eventType;
 }