예제 #1
0
파일: HomeVM.cs 프로젝트: Wowand/quantum
        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);
            }
        }
예제 #2
0
파일: HomeVM.cs 프로젝트: Wowand/quantum
 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);
     }
 }