//------------------------------------------------------------------------------ Solver::SolverState Solver::AdvanceState() { switch (currentState) { case INITIALIZING: CompleteInitialization(); break; case NOMINAL: RunNominal(); break; case PERTURBING: RunPerturbation(); break; case ITERATING: RunIteration(); break; case CALCULATING: CalculateParameters(); break; case CHECKINGRUN: CheckCompletion(); break; case RUNEXTERNAL: RunExternal(); break; case FINISHED: RunComplete(); break; default: throw SolverException(wxT("Undefined Solver state")); }; ReportProgress(); return currentState; }
void CSmsSendRecvTest::RunL() { switch (iState) { case EStateSending: { DoRunSendingL(); delete iOperation; iOperation = NULL; break; } case EStateWaitingToReceive: { DoRunWaitingToReceiveL(); break; } case EStateWaitingToReceiveAnyExtra: { DoRunWaitForExtraL(); break; } case EStateMessageReceived: { TestParseL(); break; } case EStateParsing: { DoRunTestParseL(); break; } default: { break; } } RunComplete(); }
//------------------------------------------------------------------------------ Solver::SolverState BatchEstimator::AdvanceState() { switch (currentState) { case INITIALIZING: #ifdef DEBUG_STATE_MACHINE MessageInterface::ShowMessage("Entered Estimator state machine: " "INITIALIZING\n"); #endif // ReportProgress(); CompleteInitialization(); break; case PROPAGATING: #ifdef DEBUG_STATE_MACHINE MessageInterface::ShowMessage("Entered Estimator state machine: " "PROPAGATING\n"); #endif // ReportProgress(); FindTimeStep(); break; case CALCULATING: #ifdef DEBUG_STATE_MACHINE MessageInterface::ShowMessage("Entered Estimator state machine: " "CALCULATING\n"); #endif // ReportProgress(); CalculateData(); break; case LOCATING: #ifdef DEBUG_STATE_MACHINE MessageInterface::ShowMessage("Entered Estimator state machine: " "LOCATING\n"); #endif // ReportProgress(); ProcessEvent(); break; case ACCUMULATING: #ifdef DEBUG_STATE_MACHINE MessageInterface::ShowMessage("Entered Estimator state machine: " "ACCUMULATING\n"); #endif // ReportProgress(); Accumulate(); break; case ESTIMATING: #ifdef DEBUG_STATE_MACHINE MessageInterface::ShowMessage("Entered Estimator state machine: " "ESTIMATING\n"); #endif // ReportProgress(); Estimate(); break; case CHECKINGRUN: #ifdef DEBUG_STATE_MACHINE MessageInterface::ShowMessage("Entered Estimator state machine: " "CHECKINGRUN\n"); #endif // ReportProgress(); CheckCompletion(); break; case FINISHED: #ifdef DEBUG_STATE_MACHINE MessageInterface::ShowMessage("Entered Estimator state machine: " "FINISHED\n"); #endif RunComplete(); // ReportProgress(); break; default: #ifdef DEBUG_STATE_MACHINE MessageInterface::ShowMessage("Entered Estimator state machine: " "Bad state for an estimator.\n"); #endif /* throw EstimatorException("Solver state not supported for the simulator")*/; } return currentState; }
//------------------------------------------------------------------------------ Solver::SolverState SteepestDescent::AdvanceState() { switch (currentState) { case INITIALIZING: #ifdef SD_DEBUG_STATE_MACHINE MessageInterface::ShowMessage(wxT("Entered state machine; ") wxT("INITIALIZING\n")); #endif iterationsTaken = 0; WriteToTextFile(); // ReportProgress(); CompleteInitialization(); #ifdef SD_DEBUG_STATE_MACHINE MessageInterface::ShowMessage( wxT("SteepestDescent State Transitions from %d to %d\n"), INITIALIZING, currentState); #endif break; case NOMINAL: #ifdef SD_DEBUG_STATE_MACHINE MessageInterface::ShowMessage(wxT("Entered state machine; ") wxT("NOMINAL\n")); #endif // ReportProgress(); RunNominal(); // ReportProgress(); #ifdef SD_DEBUG_STATE_MACHINE MessageInterface::ShowMessage( wxT("SteepestDescent State Transitions from %d to %d\n"), NOMINAL, currentState); #endif // ReportProgress(); break; case PERTURBING: #ifdef SD_DEBUG_STATE_MACHINE MessageInterface::ShowMessage(wxT("Entered state machine; ") wxT("PERTURBING\n")); #endif RunPerturbation(); #ifdef SD_DEBUG_STATE_MACHINE MessageInterface::ShowMessage( wxT("SteepestDescent State Transitions from %d to %d\n"), PERTURBING, currentState); #endif // ReportProgress(); break; case Solver::CALCULATING: #ifdef SD_DEBUG_STATE_MACHINE MessageInterface::ShowMessage(wxT("Entered state machine; ") wxT("CALCULATING\n")); #endif // ReportProgress(); CalculateParameters(); #ifdef SD_DEBUG_STATE_MACHINE MessageInterface::ShowMessage( wxT("SteepestDescent State Transitions from %d to %d\n"), CALCULATING, currentState); #endif break; case CHECKINGRUN: #ifdef SD_DEBUG_STATE_MACHINE MessageInterface::ShowMessage(wxT("Entered state machine; ") wxT("CHECKINGRUN\n")); #endif CheckCompletion(); #ifdef SD_DEBUG_STATE_MACHINE MessageInterface::ShowMessage( wxT("SteepestDescent State Transitions from %d to %d\n"), CHECKINGRUN, currentState); #endif // ReportProgress(); break; case FINISHED: #ifdef SD_DEBUG_STATE_MACHINE MessageInterface::ShowMessage(wxT("Entered state machine; ") wxT("FINISHED\n")); #endif RunComplete(); #ifdef SD_DEBUG_STATE_MACHINE MessageInterface::ShowMessage( wxT("SteepestDescent State Transitions from %d to %d\n"), FINISHED, currentState); #endif // ReportProgress(); break; default: throw SolverException( wxT("Steepest Descent Solver \"") + instanceName + wxT("\" encountered an unexpected state.")); } return currentState; }
TInt CSmsSendRecvTest::RunError(TInt aError) { aError = CSmsTestBase::RunError(aError); RunComplete(); return aError; }
//------------------------------------------------------------------------------ Solver::SolverState SequentialEstimator::AdvanceState() { switch (currentState) { case INITIALIZING: #ifdef WALK_STATE_MACHINE MessageInterface::ShowMessage("Executing the INITIALIZING state\n"); #endif CompleteInitialization(); break; case PROPAGATING: #ifdef WALK_STATE_MACHINE MessageInterface::ShowMessage("Executing the PROPAGATING state\n"); #endif FindTimeStep(); break; case CALCULATING: #ifdef WALK_STATE_MACHINE MessageInterface::ShowMessage("Executing the CALCULATING state\n"); #endif CalculateData(); break; case LOCATING: #ifdef WALK_STATE_MACHINE MessageInterface::ShowMessage("Executing the LOCATING state\n"); #endif ProcessEvent(); break; case ESTIMATING: #ifdef WALK_STATE_MACHINE MessageInterface::ShowMessage("Executing the ESTIMATING state\n"); #endif Estimate(); break; case CHECKINGRUN: #ifdef WALK_STATE_MACHINE MessageInterface::ShowMessage("Executing the CHECKINGRUN state\n"); #endif CheckCompletion(); break; case FINISHED: #ifdef WALK_STATE_MACHINE MessageInterface::ShowMessage("Executing the FINISHED state\n"); #endif RunComplete(); break; default: throw EstimatorException("Unknown state encountered in the " + instanceName + " sequential estimator."); } return currentState; }