products/Sources/formale Sprachen/VDM/VDMRT/RobotRT image not shown  

Quellcode-Bibliothek

© Kompilation durch diese Firma

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

Datei: ObstacleSensor.vdmrt   Sprache: VDM

Original von: VDM©

class ObstacleSensor
types
public SensorDirection = <North> | <South> | <East> | <West>;
 
instance variables
sDirection : SensorDirection;
 
operations
 public ObstacleSensor : SensorDirection ==> ObstacleSensor
 ObstacleSensor(direction) ==
   sDirection:= direction;
 
 public GetPointAvalibility : Grid`Point ==> Grid`PointAvalibility
 GetPointAvalibility (p) ==
   if World`env.GetPointAvalibility(p) = <Occupied> then
     return <Occupied>
   else
     return <Free>
 pre World`env.completeGrid.IsValidGridPoint(p);
 
  public GetDirection : () ==> SensorDirection
 GetDirection() == return sDirection;
 
end ObstacleSensor



class ObstacleSensorTest is subclass of TestCase
values
 
operations
 protected SetUp: () ==> ()
 SetUp () == skip;
 
 protected RunTest: () ==> ()
 RunTest () ==
    (
     dcl tc : ObstacleSensor:= new ObstacleSensor(<North>);
      AssertTrue(tc.GetDirection() = <North>);
 
   );
    
  
  protected TearDown: () ==> ()
 TearDown () == skip
 
end ObstacleSensorTest

¤ Dauer der Verarbeitung: 0.2 Sekunden  (vorverarbeitet)  ¤





Download des
Quellennavigators
Download des
sprechenden Kalenders

in der Quellcodebibliothek suchen




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