products/Sources/formale Sprachen/PVS/measure_integration image not shown  

Quellcode-Bibliothek

© Kompilation durch diese Firma

[Weder Korrektheit noch Funktionsfähigkeit der Software werden zugesichert.]

Datei: composition_borel.prf   Sprache: VDM

Original von: VDM©

% DirectionSwitch.vdmrt

\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 to be regularly checked by the controller.
There is no event notification, it is a pure data pull mechanism.

\begin{vdm_al}
class DirectionSwitch

instance variables
  -- link back to the controller managing this resource
  private mController : Controller;

operations
  public DirectionSwitch: Controller ==> DirectionSwitch
  DirectionSwitch (pController) == mController := pController

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 then return <LEFT>;
        -- positive value indicates right turn
        if dir > 0.0 then return <RIGHT>;
        -- zero indicates no turn - move straight
        return <NEUTRAL> )

end DirectionSwitch
\end{vdm_al}

¤ Dauer der Verarbeitung: 0.19 Sekunden  (vorverarbeitet)  ¤





Druckansicht
unsichere Verbindung
Druckansicht
sprechenden Kalenders

Eigene Datei ansehen




Haftungshinweis

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.


Bot Zugriff