26156-1 (Моделирование систем), страница 3
Описание файла
Документ из архива "Моделирование систем", который расположен в категории "". Всё это находится в предмете "информатика" из 1 семестр, которые можно найти в файловом архиве . Не смотря на прямую связь этого архива с , его также можно найти и в других разделах. Архив можно найти в разделе "курсовые/домашние работы", в предмете "информатика, программирование" в общих файлах.
Онлайн просмотр документа "26156-1"
Текст 3 страницы из документа "26156-1"
begin
if CanTake then Pass(-1);
end;
constructor TAccumulator.Create;
begin
FLimited := False;
FParcels := TList.Create;
inherited;
end;
destructor TAccumulator.Destroy;
begin
FParcels.Free;
end;
function TAccumulator.GetParcel(Index : integer): TParcel;
begin
Result := FParcels[Index];
end;
function TAccumulator.GetCanDrop: Boolean;
begin
if Empty then AskForParcel;
if not Empty then Container := FParcels.First;
Result := not Empty;
end;
function TAccumulator.GetCanTake: Boolean;
begin
Result := FreeSpacePresent;
end;
function TAccumulator.GetFreeSpacePresent: Boolean;
begin
Result := (Capacity <> FParcels.Count) or (not Limited);
end;
function TAccumulator.GetEmpty: Boolean;
begin
Result := FParcels.Count = 0;
//if not Result then Container := FParcels.First;
end;
procedure TAccumulator.DropParcel;
begin
if not Empty then FParcels.Delete(0);
inherited;
end;
function TAccumulator.GetCapacity : integer;
begin
Result := FCapacity;
end;
function TAccumulator.GetParcelCount: integer;
begin
Result := FParcels.Count;
end;
procedure TAccumulator.SetCapacity(Value : integer);
begin
FLimited := True;
FCapacity := Value;
end;
procedure TAccumulator.ClearContainer;
begin
FParcels.Clear;
inherited;
end;
procedure TAccumulator.Pass(SourceIndex : integer);
begin
inherited;
Container.State := psStore;
end;
procedure TAccumulator.TakeParcel(Index : integer);
begin
FParcels.Add(Sources[Index].Container);
TQSheme(Sheme).NewEvent(EV_TAKE,Self,Sources[Index],Sources[Index].Container.Info);
Container := FParcels.Last;
Sources[Index].DropParcel;
end;
end.