{$MODE FPC}
{$MODESWITCH RESULT}
{$MODESWITCH AUTODEREF}
unit dtrie;

interface

uses
  dcollection;

type
generic TTrie<TItem, TValue> = object
public type
  TCollection = TTrie;
  PCollection = ^TTrie;

  PNode = ^TNode;
  TNode = packed record
    Parent: PNode;
    Next: PNode;
    Item: TItem;
    Value: TValue;
  end;
  TCursor = PNode;

  TSequence = array of TItem;

  PElement = ^TElement;
  TElement = packed record
    Item: TItem;
    Value: TValue;
  end;

  TCursorEnumerator = object
  end;
  TElementEnumerator = object
  end;

private
  FRoot: PNode;

public
  // general_begin
  constructor Init;
  constructor Init(const Values: array of TElement);
  destructor Done;
  procedure Free;
  function Cursors: TCursorEnumerator;
  function Elements: TElementEnumerator;
  function First: TCursor; inline;
  function Get(const Cursor: TCursor): PElement; inline;
  function Insert(const Element: TElement): TCursor;
  function Last: TCursor; inline;
  function Length: Integer; inline;
  function Remove(const Cursor: TCursor): TCursor;
  procedure Clear;
  procedure CopyFrom(const Collection: TCollection);
  // general_end
end;

implementation

constructor TTrie.Init;
begin
  FRoot := nil;
end;

constructor TTrie.Init(const Values: array of TElement);
begin
end;

destructor TTrie.Done;
begin
end;

procedure TTrie.Free;
begin
end;

function TTrie.Cursors: TCursorEnumerator;
begin
end;

function TTrie.Elements: TElementEnumerator;
begin
end;

function TTrie.First: TCursor; inline;
begin
end;

function TTrie.Get(const Cursor: TCursor): PElement; inline;
begin
end;

function TTrie.Insert(const Element: TElement): TCursor;
begin
end;

function TTrie.Last: TCursor; inline;
begin
end;

function TTrie.Length: Integer; inline;
begin
end;

function TTrie.Remove(const Cursor: TCursor): TCursor;
begin
end;

procedure TTrie.Clear;
begin
end;

procedure TTrie.CopyFrom(const Collection: TCollection);
begin
end;

end.
