Теория и практика объектно-ориентированного программирования. Ноткин А.М. - 32 стр.

UptoLike

Составители: 

33
Procedure TInt.Execute;
Var E: TEvent;
Begin
repeat
EndState:= 0;
GetEvent (E);
HandleEvent (E);
until Valid;
End;
Procedure TInt.HandleEvent;
Begin
if Event. what = evMessage then begin
case Event. command of
cmAdd: AddY (Event. A);
cmQuit: EndExec;
else exit end;
ClearEvent (Event) end
End;
Function TInt.Valid;
Begin
if EndState = 0 then Valid:= false
else Valid:= true
End;
Procedure TInt.ClearEvent;
Begin
Event. what:= evNothing
End;
Procedure TInt.EndExec;
Begin
EndState:= 1
End;
Procedure TInt.AddY;
Begin
X:= X+Y
End;
                                33

Procedure TInt.Execute;
Var E: TEvent;
Begin
  repeat
    EndState:= 0;
    GetEvent (E);
    HandleEvent (E);
  until Valid;
End;

Procedure TInt.HandleEvent;
Begin
  if Event. what = evMessage then begin
     case Event. command of
       cmAdd: AddY (Event. A);
       …
       cmQuit: EndExec;
     else exit end;
  ClearEvent (Event) end
End;

Function TInt.Valid;
Begin
 if EndState = 0 then Valid:= false
 else Valid:= true
End;

Procedure TInt.ClearEvent;
Begin
  Event. what:= evNothing
End;

Procedure TInt.EndExec;
Begin
  EndState:= 1
End;

Procedure TInt.AddY;
Begin
  X:= X+Y
End;