> FCapacity: integer;
function GetParcel (Index: integer): TParcel;
function GetFreeSpacePresent: Boolean;
function GetEmpty: Boolean;
procedure SetCapacity (Value: integer);
function GetCapacity: integer;
function GetParcelCount: integer;
procedure Pass (SourceIndex: integer); override;
function GetCanTake: Boolean; override;
function GetCanDrop: Boolean; override;
public
constructor Create; override;
destructor Destroy; override;
procedure ClearContainer; override;
procedure DropParcel; override;
property ParcelCount: integer read GetParcelCount;
property Parcels [Index: integer]: TParcel read GetParcel;
property FreeSpacePresent: Boolean read GetFreeSpacePresent;
property Empty: Boolean read GetEmpty;
procedure TakeParcel (Index: integer); override;
published
property Capacity: integer read GetCapacity write SetCapacity;
property Limited: Boolean read FLimited write FLimited;
end;
TAccumulatorClass = class of TAccumulator;
implementation
uses QSheme;
constructor TElement.Create;
begin
FSources: = TList.Create;
end;
destructor TElement.Destroy;
begin
FSources.Free;
inherited;
end;
procedure TElement.SetSheme (ASheme: TObject);
begin
if Assigned (ASheme) then FSheme: = ASheme;
end;
procedure TElement.AddSource (Element: TElement);
begin
if Assigned (Element) then FSources.Add (Element);
end;
procedure TElement.DelSource (Element: TELement);
begin
if Assigned (Element) then FSources.Remove (Element);
end;
function TElement.GetSourceCount: integer;
begin
Result: = FSources.Count;
end;
function TElement.GetSource (Index: integer): TElement;
begin
Result: = FSources [Index];
end;
procedure TElement.TakeParcel (SourceIndex: integer);
begin
FContainer: = Sources [SourceIndex]. FContainer;
TQSheme (Sheme). NewEvent (EV_TAKE, Self, Sources [SourceIndex], FContainer.Info);
Sources [SourceIndex]. DropParcel;
end;
procedure TElement.Pass (SourceIndex: integer);
var Source: TElement;
begin
if SourceIndex <> -1 then Source: = Sources [SourceIndex];
DoBeforeTake (Self);
if SourceIndex <> -1 then Source.DoBeforeDrop (Source);
TakeParcel (SourceIndex);
DoAfterTake (Self);
if SourceIndex <> -1 then Source.DoAfterDrop (Source);
end;
function TElement.GetCanDropParcelFor (Destination: TElement): Boolean;
begin
Result: = CanDrop;
if...