Курсовая работа: Моделирование систем
end;
function TElement.GetCanTakeParcelFrom(Source : TElement) : Boolean;
begin
if Assigned(OnSourceValidate) then
Result := OnSourceValidate(Source)
else Result := True;
end;
procedure TElement.AskForParcel;
var i : integer;
Source : TElement;
begin
for i := 0 to SourceCount - 1 do begin
Source := Sources[i];
if Source.CanDropParcelFor[Self] and CanTakeParcelFrom[Source] then
if CanTake then begin
Pass(i);
if Self is TShop then Exit;
end
else
if not (Source is TAccumulator) then RefuseParcel(i);
end;//for
end;
function TElement.GetParcelPresent: Boolean;
begin
Result := FContainer <> nil;
end;
procedure TElement.ClearContainer;
begin
DropParcel;