Class TContractLeg

Unit

Declaration

type TContractLeg = class(TObject)

Description

Represents a transport contract within a main contract.

Hierarchy

Overview

Methods

Public procedure AddOrSetTradeRouteLeg(const ID: Integer; const ATradeRouteLeg: TTradeRouteLeg; out AItemError: TTradeRouteLegItemError);
Public procedure RemoveTradeRouteLeg(const ID: Integer);
Public procedure TryGetTradeRouteLeg(const ID: Integer; out ATradeRouteLeg: TTradeRouteLeg);
Public function GetTradeRouteLegIDs: TIDArray;
Public function TradeRouteLegsContainsID(const ID: Integer) : Boolean;
Public function TradeRouteLegsToArray: TTradeRouteLegDictionaryPairArray;
Public constructor Create(const ALoadingName: String; const ACommodity: String; const ASCUMaxSize: TSCUSize); overload;
Public constructor Create(const ALoading: TLoadingRecord; const ASCUMaxSize: TSCUSize); overload;
Public destructor Destroy; override;
Public function GetGroupedUnloadings(const StationCommodityGrouping: Boolean): TUnloadingRecordArray;
Public function Clone: TContractLeg;
Public function LoadingToString: String;
Public function UnloadingsToString: String;
Public function ToString: String; override;
Public class function IsConformedTradeRouteLeg(ATradeRouteLeg: TTradeRouteLeg) : Boolean; static;

Properties

Public property Loading: TLoadingRecord read FLoading;
Public property Unloadings: TUnloadingRecordArray read GetUnloadings;
Public property UnloadingsCount: Integer read GetUnloadingsCount;
Public property SCUMaxSize: TSCUSize read FSCUMaxSize;

Description

Methods

Public procedure AddOrSetTradeRouteLeg(const ID: Integer; const ATradeRouteLeg: TTradeRouteLeg; out AItemError: TTradeRouteLegItemError);

Adds or sets a trade route leg.

Parameters
ID
The ID (PanelID) of the trade route leg.
ATradeRouteLeg
The trade route leg.
AItemError
The error of the trade route leg.
Public procedure RemoveTradeRouteLeg(const ID: Integer);

Removes a trade route leg.

Parameters
ID
The ID (PanelID) of the trade route leg.
Public procedure TryGetTradeRouteLeg(const ID: Integer; out ATradeRouteLeg: TTradeRouteLeg);

Tries to get a trade route leg.

Parameters
ID
The ID (PanelID) of the trade route leg.
ATradeRouteLeg
The trade route leg.
Public function GetTradeRouteLegIDs: TIDArray;
 
Returns

the IDs of all trade route legs.

Public function TradeRouteLegsContainsID(const ID: Integer) : Boolean;

Parameters
ID
The ID (PanelID) of the trade route leg.
Returns

True if the trade route leg with the given ID exists.

Public function TradeRouteLegsToArray: TTradeRouteLegDictionaryPairArray;
 
Returns

the trade route legs as an array of dictionary pairs.

Public constructor Create(const ALoadingName: String; const ACommodity: String; const ASCUMaxSize: TSCUSize); overload;

Creates a new TContractLeg instance.

Parameters
ALoadingName
The name of the loading station.
ACommodity
The commodity.
ASCUMaxSize
The maximum container size.
Exceptions raised
EArgumentException
if ALoadingName or ACommodity is empty.
Public constructor Create(const ALoading: TLoadingRecord; const ASCUMaxSize: TSCUSize); overload;

Creates a new TContractLeg instance.

Parameters
ALoading
The loading station.
ASCUMaxSize
The maximum container size.
Public destructor Destroy; override;

Destructor.

Public function GetGroupedUnloadings(const StationCommodityGrouping: Boolean): TUnloadingRecordArray;

Groups the unloading stations by station and commodity. TODO: generalize for the custom filter

Parameters
StationCommodityGrouping
If True, the unloading stations are grouped by station and commodity.
Returns

TUnloadingRecordArray with all unloading stations.

Public function Clone: TContractLeg;

Returns a deep copy of the TContractLeg instance.

Public function LoadingToString: String;

Returns a string representation of the Loading field.

Public function UnloadingsToString: String;

Returns a string representation of the Unloadings field.

Public function ToString: String; override;

Returns a string representation of the TContractLeg instance.

Public class function IsConformedTradeRouteLeg(ATradeRouteLeg: TTradeRouteLeg) : Boolean; static;

Checks if the given TTradeRouteLeg conforms to the rules for being part of a TContractLeg.

Properties

Public property Loading: TLoadingRecord read FLoading;

Data relating to the loading station.

Public property Unloadings: TUnloadingRecordArray read GetUnloadings;

Data relating to the unloading stations.

Public property UnloadingsCount: Integer read GetUnloadingsCount;

Number of unloading stations.

Public property SCUMaxSize: TSCUSize read FSCUMaxSize;

Maximum container size.