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 monitor machine case separately for the halt event else if (eventValue.IsEqual(PrtValue.HaltEvent)) { throw new PrtUnhandledEventException(); } else { 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 {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); }
public PrtMachine() { this.instanceNumber = 0; this.fields = new List <PrtValue>(); this.eventValue = PrtValue.NullValue; this.stateStack = new PrtStateStack(); this.invertedFunStack = new PrtFunStack(); this.continuation = new PrtContinuation(); this.currentTrigger = PrtValue.NullValue; this.currentPayload = PrtValue.NullValue; this.currentStatus = PrtMachineStatus.Enabled; this.nextSMOperation = PrtNextStatemachineOperation.EntryOperation; this.stateExitReason = PrtStateExitReason.NotExit; this.stateImpl = null; }
public PrtMachine() { this.instanceNumber = 0; this.fields = new List <PrtValue>(); this.eventValue = PrtValue.@null; this.stateStack = new PrtStateStack(); this.invertedFunStack = new PrtFunStack(); this.continuation = new PrtContinuation(); this.currentTrigger = PrtValue.@null; this.currentPayload = PrtValue.@null; this.currentStatus = PrtMachineStatus.Enabled; this.nextSMOperation = PrtNextStatemachineOperation.ExecuteFunctionOperation; this.stateExitReason = PrtStateExitReason.NotExit; this.sends = new List <PrtEventValue>(); this.stateImpl = null; this.renamedName = null; this.isSafe = false; }