{$MODE FPC}
{$MODESWITCH RESULT}
unit dtree;

interface

uses
  darray,
  dlist;

type
generic TTree<TValue> = object
public type
  PValue = ^TValue;
  PNode = ^TNode;
  TNode = packed object
    Parent: PNode;
    Next: PNode;
    Sub: PNode;
	Value: TValue;
    function Iterate: PNode;
  end;
  TCursor = PNode;

  PElement = ^TElement;
  TElement = TValue;

  TEnumerator = object
  private
    FCursor: TCursor;
  public
    {function MoveNext: Boolean;
	function GetEnumerator: TCursorEnumerator;
	property Current: PNode read GetCurrent;}
  end;
public
  // general_begin
  constructor Init;
  constructor Init(const Values: array of TElement);
  destructor Done;
  procedure Free;
  function Cursors: TCursorEnumerator;
  function Elements: TElementEnumerator;
  function AsCollection: ICollection;
  function First: TCursor; inline;
  function Get(const Cursor: TCursor): PElement; inline;
  function Insert(const Element: TElement): TCursor; overload;
  function Last: TCursor; inline;
  function Length: Integer; inline;
  function Remove(const Cursor: TCursor): TCursor;
  procedure Clear;
  procedure CopyFrom(const Collection: TCollection);
  // general_end

  // begin_interface
  function Insert(const Cursor: TCursor; const Element: TElement): TCursor; overload;
  // end_interface
end;

implementation

constructor TTree.Init;
begin
end;

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

destructor TTree.Done;
begin
end;

procedure TTree.Free;
begin
end;

function TTree.Cursors: TCursorEnumerator;
begin
end;

function TTree.Elements: TElementEnumerator;
begin
end;

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

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

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

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

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

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

procedure TTree.Clear;
begin
end;

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

function TTree.Insert(const Cursor: TCursor; const Element: TElement): TCursor; overload;
begin
end;

end.
