Period: = FastestStepPeriod;
finally
FreeAnalize;
end;
except
on EInvalidPointer do raise;
end;
end;
procedure TQSheme.ClearEventQueue;
var i: integer;
begin
if Assigned (FEventQueue) then begin
for i: = 0 to FEventQueue.Count - 1 do FreeMem (FEventQueue [i], SizeOf (TEventRec));
FEventQueue.Clear;
end;
end;
procedure TQSheme.ClearParcelList;
var i: integer;
begin
if Assigned (FParcels) then begin
for i: = 0 to FParcels.Count - 1 do TParcel (FParcels [i]). Free;
FParcels.Clear;
end;
end;
procedure TQSheme.InitEmulation;
var i: integer;
begin
ClearParcelList;
ClearEventQueue;
for i: = 0 to ElementCount - 1 do
Elements [i]. ClearContainer;
FFinishElements: = TList.Create;
end;
procedure TQSheme.FreeEmulation;
begin
FFinishElements.Free;
end;
procedure TQSheme.Emulation;
begin
try
InitEmulation;
Analize;
while FSysTime
Form1.Gauge1.Progress: = 100;
// RedrawDiagram;
finally
FreeEmulation;
end;
end;
function TQSheme.NewParcel: Pointer;
var P: Pointer;
begin
P: = FParcelsClass.Create;
FParcels.Add (P);
Result: = P;
end;
procedure TQSheme.NewEvent (AEvent: Integer; ASender, ASource: TObject; AInfo: TInfo);
var P: PEventRec;
begin
GetMem (P, SizeOf (TEventRec));
with P ^ do begin
Event: = AEvent;
Sender: = ASender;
Source: = ASource;
Info: = AInfo;
SysTime: = FSysTime;
end;
FEventQueue.Add (P);
end;
function TQSheme.GetCounts (Index: integer): integer;
var i: integer;
begin
Result: = 0;
for i: = 0 to FParcels.Count-1 do
if Ord (TParcel (FParcels [i]). State) = Index then Inc (Result);
end;
function TQSheme.GetParcelCount: integer;
begin
Result: = FParcels.Count;
end;
const// DrawConstants
Top = 20;
Left = 20;
Interval = 20;
procedure TQSheme.DrawElementLines;
var i: integer;
Y: integer;
begin
for i: = 0 to ElementCount-1 do begin
Y: = Top + interval * i;
with Diagram.Canvas do begin
TextOut (0, Y + Font.Height, Elements [i]. Name);
MoveTo (0, Y);
LineTo (Diagram.ClientWidth, Y)
end;
end;
end;
procedure TQSheme.DisplayEvents;
{var i: integer;
s: string;}
begin
{Form1.mRes...