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); }
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 }
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 }
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); }
public ExitConditionException(IExitCondition exitCondition, InternalState internalState, LifecycleEventType eventType) { this.ExitCondition = exitCondition; this.InternalState = internalState; this.EventType = eventType; }