Files
MycLib/Src/Myc.Trade.Node.pas
T
2025-06-06 12:43:51 +02:00

49 lines
1.1 KiB
ObjectPascal

unit Myc.Trade.Node;
interface
uses
System.SysUtils;
type
// Base interface for all objects created by an INode factory.
ITradeObject = interface
['{B8A29A67-272E-456A-A816-A19A76E43213}']
end;
// Represents a node in the trading graph, acting as a factory for a trade object.
INode = interface
['{E879B5E4-3A4E-434A-8A4F-A9F71B0B7E1C}']
function GetCaption: string;
// Factory method to create the runtime object.
function CreateObject: ITradeObject;
property Caption: string read GetCaption;
end;
// Abstract base class for all node implementations.
TNodeBase = class abstract(TInterfacedObject, INode)
protected
fCaption: string;
function GetCaption: string;
public
constructor Create(const Caption: string);
function CreateObject: ITradeObject; virtual; abstract;
end;
implementation
{ TNodeBase }
constructor TNodeBase.Create(const Caption: string);
begin
fCaption := Caption;
end;
function TNodeBase.GetCaption: string;
begin
result := fCaption;
end;
end.