\subsubsection{Observing user behavior -- the \texttt{DirectionSwitch} class}
The \texttt{DirectionSwitch} class obtains the status of the direction switch from the environment and translates this into an enumeration. Note that the
direction switch status needs tobe regularly checked by the controller.
There is no event notification, it is a pure data pull mechanism.
\begin{vdm_al} class DirectionSwitch
instancevariables -- link back to the controller managing this resource private mController : Controller;
types public tDirectionStatus = <LEFT> | <NEUTRAL> | <RIGHT>
operations public getStatus: () ==> tDirectionStatus
getStatus () == duration (0)
( dcl dir : real := mController.getValue("DIRECTION"); -- negative value indicates left turn if dir < 0.0 thenreturn <LEFT>; -- positive value indicates right turn if dir > 0.0 thenreturn <RIGHT>; -- zero indicates no turn - move straight return <NEUTRAL> )
end DirectionSwitch
\end{vdm_al}
¤ Dauer der Verarbeitung: 0.16 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.