public void NextStep(object parameter) { try { CircuitEvaluator eval = CircuitEvaluator.GetInstance(); int currentStep = _model.CurrentStep; if (currentStep == 0) { eval.InitFromModel(_model); } if (currentStep < _model.Steps.Count) { StepEvaluator se = eval.GetStepEvaluator(); bool outputChanged = se.RunStep(_model.Steps[currentStep].Gates); _model.CurrentStep = currentStep + 1; if (outputChanged) { _outputModel.Update(eval.RootRegister); } } } catch (Exception e) { PrintException(e); } }
public void PrevStep(object parameter) { try { int currentStep = _model.CurrentStep; if (currentStep == 0) { Restart(parameter); } else { if (_model.CanStepBack(currentStep - 1)) { CircuitEvaluator eval = CircuitEvaluator.GetInstance(); StepEvaluator se = eval.GetStepEvaluator(); bool outputChanged = se.RunStep(_model.Steps[currentStep - 1].Gates, true); _model.CurrentStep = currentStep - 1; if (outputChanged) { _outputModel.Update(eval.RootRegister); } } } } catch (Exception e) { PrintException(e); } }