Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/VDM/VDMPP/CMSeqPP/     Datei vom 13.4.2020 mit Größe 1 kB image not shown  

Quelle  global.vdmpp   Sprache: VDM

 

\begin{vdm_al}
class GLOBAL

values

public SENSOR_APERTURE = 90;
public FLARE_APERTURE = 120;
public DISPENSER_APERTURE = 30

types

-- there are three different types of missiles
public MissileType = <MissileA> | <MissileB> | <MissileC> | <None>;

-- there are nine different flare types, three per missile
public FlareType =
    <FlareOneA> | <FlareTwoA> | <DoNothingA> | 
    <FlareOneB> | <FlareTwoB> | <DoNothingB> | 
    <FlareOneC> | <FlareTwoC> | <DoNothingC>;

-- the angle at which the missile is incoming
public Angle = nat
inv num == num < 360;

public EventId = nat;

public Time = nat

operations

pure public canObserve: Angle * Angle * Angle ==> bool
canObserve (pangle, pleft, psize) ==
  def pright = (pleft + psize) mod 360 in
    if pright < pleft
    -- check between [0,pright> and [pleft,360>
    then return (pangle < pright or pangle >= pleft)
    -- check between [pleft, pright>
    else return (pangle >= pleft and pangle < pright);
       
pure public getAperture: () ==> Angle * Angle
getAperture () == is subclass responsibility;

end GLOBAL
\end{vdm_al}

\begin{rtinfo}[GLOBAL`canObserve]
{vdm.tc}[GLOBAL]
\end{rtinfo}

Messung
CHZG
8810010096

¤ Dauer der Verarbeitung: 0.1 Sekunden  (vorverarbeitet am  2026-11-24) ¤

*© Formatika GbR, Deutschland