if tDef <> nil then (period := tDef.p;
isPeriodic := tDef.isP;
);
BaseThread(self);
);
pure public GetAngle: () ==> nat
GetAngle() == return aperture;
public addThreat: EventId * MissileType * Time ==> ()
addThreat (evid, pmt, ptime) == if missilePriority(pmt) > curprio then (dcl newplan : Plan := [],
newtime : Time := ptime; -- construct an absolute time plan for mk_(fltp, fltime) in responseDB(pmt) do
(newplan := newplan ^ [mk_ (fltp, newtime)];
newtime := newtime + fltime ); -- immediately release the first action def mk_(fltp, fltime) = hd newplan;
t = World`timerRef.GetTime() in
releaseFlare(evid,fltp,fltime,t); -- store the rest of the plan
curplan := tl newplan;
eventid := evid;
curprio := missilePriority(pmt);
busy := true ) pre pmt insetdom missilePriority and
pmt insetdom responseDB;
protected Step: () ==> ()
Step () ==
(iflen curplan > 0 then (dcl curtime : Time := World`timerRef.GetTime(),
done : bool := false; whilenot done do
(dcl first : PlanStep := hd curplan,
next : Plan := tl curplan; let mk_(fltp, fltime) = first in if fltime <= curtime then (releaseFlare(eventid,fltp,fltime,curtime);
curplan := next; iflen next = 0 then (curprio := 0;
done := true;
busy := false ) ) else done := true ) ) );
private releaseFlare: EventId * FlareType * Time * Time ==> ()
releaseFlare (evid, pfltp, pt1, pt2) ==
World`env.handleEvent(evid,pfltp,aperture,pt1,pt2);
public isFinished: () ==> ()
isFinished () == skip;
sync
mutex (Step); mutex (addThreat); per isFinished => not busy
end FlareDispenser
\end{vdm_al}
¤ Dauer der Verarbeitung: 0.10 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.