public bool PrtPopState(bool isPopStatement) { Debug.Assert(stateStack.TopOfStack != null); //pop stack stateStack.PopStackFrame(); if (stateStack.TopOfStack == null) { if (isPopStatement) { throw new PrtInvalidPopStatement(); } //TODO : Handle the spec machine case separately for the halt event else if (!eventValue.Equals(PrtValue.halt)) { throw new PrtUnhandledEventException(string.Format("{0} failed to handle {1}", Name, eventValue.ToString())); } else { stateImpl.TraceLine("<HaltLog> Machine {0}-{1} HALTED", this.Name, this.instanceNumber); currentStatus = PrtMachineStatus.Halted; } } return(currentStatus == PrtMachineStatus.Halted); }
public bool PrtPopState(bool isPopStatement) { Debug.Assert(stateStack.TopOfStack != null); //pop stack stateStack.PopStackFrame(); if (stateStack.TopOfStack == null) { if (isPopStatement) { throw new PrtInvalidPopStatement(); } //TODO : Handle the spec machine case separately for the halt event else if (!eventValue.Equals(PrtValue.halt)) { throw new PrtUnhandledEventException(string.Format("{0} failed to handle event {1}", Name, eventValue.ToString())); } else { if (this as PrtImplMachine != null) { stateImpl.TraceLine("<HaltLog> Machine {0}-{1} HALTED with {2} events in the queue", this.Name, this.instanceNumber, (((PrtImplMachine)this).eventQueue).Size()); } else { //SpecMachine case: //TODO: is it possible to send "halt" event to a spec machine? stateImpl.TraceLine("<HaltLog> Machine {0}-{1} HALTED", this.Name, this.instanceNumber); } currentStatus = PrtMachineStatus.Halted; } } return(currentStatus == PrtMachineStatus.Halted); }