home *** CD-ROM | disk | FTP | other *** search
/ Chip 2003 January / Chip_2003-01_cd1.bin / zkuste / delphi / unity / d56 / FNDUTL.ZIP / Datastructs / cLinkedLists.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2002-10-29  |  39.1 KB  |  1,414 lines

  1. {$INCLUDE ..\cDefines.inc}
  2. unit cLinkedLists;
  3.  
  4. {                                                                              }
  5. {                     Data structures: Linked lists v3.02                      }
  6. {                                                                              }
  7. {      This unit is copyright ⌐ 2000-2002 by David Butler (david@e.co.za)      }
  8. {                                                                              }
  9. {                  This unit is part of Delphi Fundamentals.                   }
  10. {                  Its original file name is cLinkedLists.pas                  }
  11. {                     It was generated 29 Oct 2002 02:22.                      }
  12. {       The latest version is available from the Fundamentals home page        }
  13. {                     http://fundementals.sourceforge.net/                     }
  14. {                                                                              }
  15. {                I invite you to use this unit, free of charge.                }
  16. {        I invite you to distibute this unit, but it must be for free.         }
  17. {             I also invite you to contribute to its development,              }
  18. {             but do not distribute a modified copy of this file.              }
  19. {                                                                              }
  20. {          A forum is available on SourceForge for general discussion          }
  21. {             http://sourceforge.net/forum/forum.php?forum_id=2117             }
  22. {                                                                              }
  23. {                                                                              }
  24. { Revision history:                                                            }
  25. {   [ cUtils ]                                                                 }
  26. {   2000/06/10  1.01  Added linked lists.                                      }
  27. {   [ cLinkedLists ]                                                           }
  28. {   2002/05/31  3.02  Created cLinkedLists from cUtils.                        }
  29. {                                                                              }
  30. interface
  31.  
  32. const
  33.   UnitName      = 'cLinkedLists';
  34.   UnitVersion   = '3.02';
  35.   UnitDesc      = 'Miscelleanous utility functions';
  36.   UnitCopyright = '(c) 2000-2002 David J Butler';
  37.  
  38.  
  39.  
  40. {                                                                              }
  41. { Linked lists                                                                 }
  42. {                                                                              }
  43. type
  44.   TLinkedItem = class
  45.     Next : TLinkedItem;
  46.  
  47.     Function  HasNext : Boolean;
  48.     Function  Last : TLinkedItem;
  49.     Function  Count : Integer;
  50.     Function  RemoveNext : TLinkedItem;
  51.     Procedure DeleteNext;
  52.     Procedure InsertAfter (const Item : TLinkedItem);
  53.  
  54.     Destructor DestroyList;
  55.   end;
  56.  
  57.   TDoublyLinkedItem = class
  58.     Next : TDoublyLinkedItem;
  59.     Prev : TDoublyLinkedItem;
  60.  
  61.     Function  HasNext : Boolean;
  62.     Function  HasPrev : Boolean;
  63.     Function  Last : TDoublyLinkedItem;
  64.     Function  First : TDoublyLinkedItem;
  65.     Function  Count : Integer;
  66.     Procedure Remove;
  67.     Function  RemoveNext : TDoublyLinkedItem;
  68.     Procedure DeleteNext;
  69.     Function  RemovePrev : TDoublyLinkedItem;
  70.     Procedure DeletePrev;
  71.     Procedure InsertAfter (const Item : TDoublyLinkedItem);
  72.     Procedure InsertBefore (const Item : TDoublyLinkedItem);
  73.     Procedure Delete;
  74.  
  75.     Destructor DestroyList;
  76.   end;
  77.  
  78.   TLinkedInteger = class (TLinkedItem)
  79.     Value : Integer;
  80.  
  81.     Constructor Create (const V : Integer);
  82.  
  83.     Procedure InsertAfter (const V : Integer); reintroduce; overload;
  84.     Procedure Append (const V : Integer);
  85.     Function  FindNext (const Find : Integer) : TLinkedInteger;
  86.   end;
  87.   TDoublyLinkedInteger = class (TDoublyLinkedItem)
  88.     Value : Integer;
  89.  
  90.     Constructor Create (const V : Integer);
  91.  
  92.     Procedure InsertAfter (const V : Integer); reintroduce; overload;
  93.     Procedure InsertBefore (const V : Integer); reintroduce; overload;
  94.     Procedure InsertFirst (const V : Integer);
  95.     Procedure Append (const V : Integer);
  96.     Function  FindNext (const Find : Integer) : TDoublyLinkedInteger;
  97.     Function  FindPrev (const Find : Integer) : TDoublyLinkedInteger;
  98.   end;
  99.  
  100.   TLinkedInt64 = class (TLinkedItem)
  101.     Value : Int64;
  102.  
  103.     Constructor Create (const V : Int64);
  104.  
  105.     Procedure InsertAfter (const V : Int64); reintroduce; overload;
  106.     Procedure Append (const V : Int64);
  107.     Function  FindNext (const Find : Int64) : TLinkedInt64;
  108.   end;
  109.   TDoublyLinkedInt64 = class (TDoublyLinkedItem)
  110.     Value : Int64;
  111.  
  112.     Constructor Create (const V : Int64);
  113.  
  114.     Procedure InsertAfter (const V : Int64); reintroduce; overload;
  115.     Procedure InsertBefore (const V : Int64); reintroduce; overload;
  116.     Procedure InsertFirst (const V : Int64);
  117.     Procedure Append (const V : Int64);
  118.     Function  FindNext (const Find : Int64) : TDoublyLinkedInt64;
  119.     Function  FindPrev (const Find : Int64) : TDoublyLinkedInt64;
  120.   end;
  121.  
  122.   TLinkedSingle = class (TLinkedItem)
  123.     Value : Single;
  124.  
  125.     Constructor Create (const V : Single);
  126.  
  127.     Procedure InsertAfter (const V : Single); reintroduce; overload;
  128.     Procedure Append (const V : Single);
  129.     Function  FindNext (const Find : Single) : TLinkedSingle;
  130.   end;
  131.   TDoublyLinkedSingle = class (TDoublyLinkedItem)
  132.     Value : Single;
  133.  
  134.     Constructor Create (const V : Single);
  135.  
  136.     Procedure InsertAfter (const V : Single); reintroduce; overload;
  137.     Procedure InsertBefore (const V : Single); reintroduce; overload;
  138.     Procedure InsertFirst (const V : Single);
  139.     Procedure Append (const V : Single);
  140.     Function  FindNext (const Find : Single) : TDoublyLinkedSingle;
  141.     Function  FindPrev (const Find : Single) : TDoublyLinkedSingle;
  142.   end;
  143.  
  144.   TLinkedDouble = class (TLinkedItem)
  145.     Value : Double;
  146.  
  147.     Constructor Create (const V : Double);
  148.  
  149.     Procedure InsertAfter (const V : Double); reintroduce; overload;
  150.     Procedure Append (const V : Double);
  151.     Function  FindNext (const Find : Double) : TLinkedDouble;
  152.   end;
  153.   TDoublyLinkedDouble = class (TDoublyLinkedItem)
  154.     Value : Double;
  155.  
  156.     Constructor Create (const V : Double);
  157.  
  158.     Procedure InsertAfter (const V : Double); reintroduce; overload;
  159.     Procedure InsertBefore (const V : Double); reintroduce; overload;
  160.     Procedure InsertFirst (const V : Double);
  161.     Procedure Append (const V : Double);
  162.     Function  FindNext (const Find : Double) : TDoublyLinkedDouble;
  163.     Function  FindPrev (const Find : Double) : TDoublyLinkedDouble;
  164.   end;
  165.  
  166.   TLinkedExtended = class (TLinkedItem)
  167.     Value : Extended;
  168.  
  169.     Constructor Create (const V : Extended);
  170.  
  171.     Procedure InsertAfter (const V : Extended); reintroduce; overload;
  172.     Procedure Append (const V : Extended);
  173.     Function  FindNext (const Find : Extended) : TLinkedExtended;
  174.   end;
  175.   TDoublyLinkedExtended = class (TDoublyLinkedItem)
  176.     Value : Extended;
  177.  
  178.     Constructor Create (const V : Extended);
  179.  
  180.     Procedure InsertAfter (const V : Extended); reintroduce; overload;
  181.     Procedure InsertBefore (const V : Extended); reintroduce; overload;
  182.     Procedure InsertFirst (const V : Extended);
  183.     Procedure Append (const V : Extended);
  184.     Function  FindNext (const Find : Extended) : TDoublyLinkedExtended;
  185.     Function  FindPrev (const Find : Extended) : TDoublyLinkedExtended;
  186.   end;
  187.  
  188.   TLinkedString = class (TLinkedItem)
  189.     Value : String;
  190.  
  191.     Constructor Create (const V : String);
  192.  
  193.     Procedure InsertAfter (const V : String); reintroduce; overload;
  194.     Procedure Append (const V : String);
  195.     Function  FindNext (const Find : String) : TLinkedString;
  196.   end;
  197.   TDoublyLinkedString = class (TDoublyLinkedItem)
  198.     Value : String;
  199.  
  200.     Constructor Create (const V : String);
  201.  
  202.     Procedure InsertAfter (const V : String); reintroduce; overload;
  203.     Procedure InsertBefore (const V : String); reintroduce; overload;
  204.     Procedure InsertFirst (const V : String);
  205.     Procedure Append (const V : String);
  206.     Function  FindNext (const Find : String) : TDoublyLinkedString;
  207.     Function  FindPrev (const Find : String) : TDoublyLinkedString;
  208.   end;
  209.  
  210.   TLinkedObject = class (TLinkedItem)
  211.     Value : TObject;
  212.  
  213.     Constructor Create (const V : TObject);
  214.  
  215.     Procedure InsertAfter (const V : TObject); reintroduce; overload;
  216.     Procedure Append (const V : TObject);
  217.     Function  FindNext (const Find : TObject) : TLinkedObject;
  218.   end;
  219.   TDoublyLinkedObject = class (TDoublyLinkedItem)
  220.     Value : TObject;
  221.  
  222.     Constructor Create (const V : TObject);
  223.  
  224.     Procedure InsertAfter (const V : TObject); reintroduce; overload;
  225.     Procedure InsertBefore (const V : TObject); reintroduce; overload;
  226.     Procedure InsertFirst (const V : TObject);
  227.     Procedure Append (const V : TObject);
  228.     Function  FindNext (const Find : TObject) : TDoublyLinkedObject;
  229.     Function  FindPrev (const Find : TObject) : TDoublyLinkedObject;
  230.   end;
  231.  
  232.  
  233. Function  AsLinkedIntegerList (const V : Array of Integer) : TLinkedInteger;
  234. Function  AsLinkedInt64List (const V : Array of Int64) : TLinkedInt64;
  235. Function  AsLinkedSingleList (const V : Array of Single) : TLinkedSingle;
  236. Function  AsLinkedDoubleList (const V : Array of Double) : TLinkedDouble;
  237. Function  AsLinkedExtendedList (const V : Array of Extended) : TLinkedExtended;
  238. Function  AsLinkedStringList (const V : Array of String) : TLinkedString;
  239. Function  AsDoublyLinkedIntegerList (const V : Array of Integer) : TDoublyLinkedInteger;
  240. Function  AsDoublyLinkedInt64List (const V : Array of Int64) : TDoublyLinkedInt64;
  241. Function  AsDoublyLinkedSingleList (const V : Array of Single) : TDoublyLinkedSingle;
  242. Function  AsDoublyLinkedDoubleList (const V : Array of Double) : TDoublyLinkedDouble;
  243. Function  AsDoublyLinkedExtendedList (const V : Array of Extended) : TDoublyLinkedExtended;
  244. Function  AsDoublyLinkedStringList (const V : Array of String) : TDoublyLinkedString;
  245.  
  246.  
  247.  
  248. {                                                                              }
  249. { TDoublyLinkedList                                                            }
  250. {                                                                              }
  251. type
  252.   TDoublyLinkedList = class
  253.     protected
  254.     FFirst, FLast : TDoublyLinkedItem;
  255.     FCount        : Integer;
  256.  
  257.     public
  258.     Destructor Destroy; override;
  259.  
  260.     Property  First : TDoublyLinkedItem read FFirst;
  261.     Property  Last : TDoublyLinkedItem read FLast;
  262.     Function  IsEmpty : Boolean;
  263.     Function  Count : Integer;
  264.  
  265.     Procedure Remove (const Item : TDoublyLinkedItem);
  266.     Function  RemoveFirst : TDoublyLinkedItem;
  267.     Function  RemoveLast : TDoublyLinkedItem;
  268.  
  269.     Procedure Delete (const Item : TDoublyLinkedItem);
  270.     Procedure DeleteFirst;
  271.     Procedure DeleteLast;
  272.  
  273.     Procedure Append (const Item : TDoublyLinkedItem);
  274.     Procedure InsertFront (const Item : TDoublyLinkedItem);
  275.   end;
  276.  
  277.  
  278.  
  279. implementation
  280.  
  281.  
  282.  
  283. {                                                                              }
  284. { TLinkedItem                                                                  }
  285. {                                                                              }
  286. Function TLinkedItem.HasNext : Boolean;
  287.   Begin
  288.     Result := Assigned (Next);
  289.   End;
  290.  
  291. Function TLinkedItem.Last : TLinkedItem;
  292. var P : TLinkedItem;
  293.   Begin
  294.     P := self;
  295.     Repeat
  296.       Result := P;
  297.       P := P.Next;
  298.     Until not Assigned (P);
  299.   End;
  300.  
  301. Function TLinkedItem.Count : Integer;
  302. var N : TLinkedItem;
  303.   Begin
  304.     Result := 1;
  305.     N := self.Next;
  306.     While Assigned (N) do
  307.       begin
  308.         Inc (Result);
  309.         N := N.Next;
  310.       end;
  311.   End;
  312.  
  313. Function TLinkedItem.RemoveNext : TLinkedItem;
  314.   Begin
  315.     Result := Next;
  316.     if Assigned (Result) then
  317.       Next := Result.Next;
  318.   End;
  319.  
  320. Procedure TLinkedItem.DeleteNext;
  321.   Begin
  322.     RemoveNext.Free;
  323.   End;
  324.  
  325. Procedure TLinkedItem.InsertAfter (const Item : TLinkedItem);
  326.   Begin
  327.     Item.Next := Next;
  328.     Next := Item;
  329.   End;
  330.  
  331. Destructor TLinkedItem.DestroyList;
  332. var N : TLinkedItem;
  333.   Begin
  334.     While Assigned (Next) do
  335.       begin
  336.         N := Next;
  337.         Next := N.Next;
  338.         N.Free;
  339.       end;
  340.     inherited Destroy;
  341.   End;
  342.  
  343.  
  344.  
  345. {                                                                              }
  346. { TDoublyLinkedItem                                                            }
  347. {                                                                              }
  348. Function TDoublyLinkedItem.HasNext : Boolean;
  349.   Begin
  350.     Result := Assigned (Next);
  351.   End;
  352.  
  353. Function TDoublyLinkedItem.Last : TDoublyLinkedItem;
  354. var P : TDoublyLinkedItem;
  355.   Begin
  356.     P := self;
  357.     Repeat
  358.       Result := P;
  359.       P := P.Next;
  360.     Until not Assigned (P);
  361.   End;
  362.  
  363. Function TDoublyLinkedItem.Count : Integer;
  364. var N : TDoublyLinkedItem;
  365.   Begin
  366.     Result := 1;
  367.     N := self.Next;
  368.     While Assigned (N) do
  369.       begin
  370.         Inc (Result);
  371.         N := N.Next;
  372.       end;
  373.   End;
  374.  
  375. Function TDoublyLinkedItem.HasPrev : Boolean;
  376.   Begin
  377.     Result := Assigned (Prev);
  378.   End;
  379.  
  380. Function TDoublyLinkedItem.First : TDoublyLinkedItem;
  381. var P : TDoublyLinkedItem;
  382.   Begin
  383.     P := self;
  384.     Repeat
  385.       Result := P;
  386.       P := P.Prev;
  387.     Until not Assigned (P);
  388.   End;
  389.  
  390. Procedure TDoublyLinkedItem.Delete;
  391.   Begin
  392.     Remove;
  393.     Free;
  394.   End;
  395.  
  396. Procedure TDoublyLinkedItem.Remove;
  397.   Begin
  398.     if Assigned (Next) then
  399.       Next.Prev := Prev;
  400.     if Assigned (Prev) then
  401.       Prev.Next := Next;
  402.   End;
  403.  
  404. Function TDoublyLinkedItem.RemoveNext : TDoublyLinkedItem;
  405.   Begin
  406.     Result := Next;
  407.     if Assigned (Result) then
  408.       begin
  409.         Next := Result.Next;
  410.         if Assigned (Next) then
  411.           Next.Prev := self;
  412.       end;
  413.   End;
  414.  
  415. Procedure TDoublyLinkedItem.DeleteNext;
  416.   Begin
  417.     RemoveNext.Free;
  418.   End;
  419.  
  420. Function TDoublyLinkedItem.RemovePrev : TDoublyLinkedItem;
  421.   Begin
  422.     Result := Prev;
  423.     if Assigned (Result) then
  424.       begin
  425.         Prev := Result.Prev;
  426.         if Assigned (Prev) then
  427.           Prev.Next := self;
  428.       end;
  429.   End;
  430.  
  431. Procedure TDoublyLinkedItem.DeletePrev;
  432.   Begin
  433.     RemovePrev.Free;
  434.   End;
  435.  
  436. Procedure TDoublyLinkedItem.InsertAfter (const Item : TDoublyLinkedItem);
  437.   Begin
  438.     Item.Next := Next;
  439.     Item.Prev := self;
  440.     Next := Item;
  441.   End;
  442.  
  443. Procedure TDoublyLinkedItem.InsertBefore (const Item : TDoublyLinkedItem);
  444.   Begin
  445.     Item.Next := self;
  446.     Item.Prev := Prev;
  447.     Prev := Item;
  448.   End;
  449.  
  450. Destructor TDoublyLinkedItem.DestroyList;
  451. var N : TDoublyLinkedItem;
  452.   Begin
  453.     While Assigned (Next) do
  454.       begin
  455.         N := Next;
  456.         Next := N.Next;
  457.         N.Free;
  458.       end;
  459.     inherited Destroy;
  460.   End;
  461.  
  462.  
  463. {                                                                              }
  464. { TLinkedInteger                                                               }
  465. {                                                                              }
  466. Constructor TLinkedInteger.Create (const V : Integer);
  467.   Begin
  468.     inherited Create;
  469.     Value := V;
  470.   End;
  471.  
  472. Procedure TLinkedInteger.InsertAfter (const V : Integer);
  473.   Begin
  474.     inherited InsertAfter (TLinkedInteger.Create (V));
  475.   End;
  476.  
  477. Procedure TLinkedInteger.Append (const V : Integer);
  478.   Begin
  479.     TLinkedInteger (Last).InsertAfter (V);
  480.   End;
  481.  
  482. Function TLinkedInteger.FindNext (const Find : Integer) : TLinkedInteger;
  483.   Begin
  484.     Result := self;
  485.     Repeat
  486.       if Result.Value = Find then
  487.         exit;
  488.       Result := TLinkedInteger (Result.Next);
  489.     Until not Assigned (Result);
  490.   End;
  491.  
  492.  
  493.  
  494. {                                                                              }
  495. { TDoublyLinkedInteger                                                         }
  496. {                                                                              }
  497. Constructor TDoublyLinkedInteger.Create (const V : Integer);
  498.   Begin
  499.     inherited Create;
  500.     Value := V;
  501.   End;
  502.  
  503. Procedure TDoublyLinkedInteger.InsertAfter (const V : Integer);
  504.   Begin
  505.     inherited InsertAfter (TDoublyLinkedInteger.Create (V));
  506.   End;
  507.  
  508. Procedure TDoublyLinkedInteger.InsertBefore (const V : Integer);
  509.   Begin
  510.     inherited InsertBefore (TDoublyLinkedInteger.Create (V));
  511.   End;
  512.  
  513. Procedure TDoublyLinkedInteger.InsertFirst (const V : Integer);
  514.   Begin
  515.     TDoublyLinkedInteger (First).InsertBefore (V);
  516.   End;
  517.  
  518. Procedure TDoublyLinkedInteger.Append (const V : Integer);
  519.   Begin
  520.     TDoublyLinkedInteger (Last).InsertAfter (V);
  521.   End;
  522.  
  523. Function TDoublyLinkedInteger.FindNext (const Find : Integer) : TDoublyLinkedInteger;
  524.   Begin
  525.     Result := self;
  526.     Repeat
  527.       if Result.Value = Find then
  528.         exit;
  529.       Result := TDoublyLinkedInteger (Result.Next);
  530.     Until not Assigned (Result);
  531.   End;
  532.  
  533. Function TDoublyLinkedInteger.FindPrev (const Find : Integer) : TDoublyLinkedInteger;
  534.   Begin
  535.     Result := self;
  536.     Repeat
  537.       if Result.Value = Find then
  538.         exit;
  539.       Result := TDoublyLinkedInteger (Result.Prev);
  540.     Until not Assigned (Result);
  541.   End;
  542.  
  543.  
  544.  
  545. {                                                                              }
  546. { TLinkedInt64                                                                 }
  547. {                                                                              }
  548. Constructor TLinkedInt64.Create (const V : Int64);
  549.   Begin
  550.     inherited Create;
  551.     Value := V;
  552.   End;
  553.  
  554. Procedure TLinkedInt64.InsertAfter (const V : Int64);
  555.   Begin
  556.     inherited InsertAfter (TLinkedInt64.Create (V));
  557.   End;
  558.  
  559. Procedure TLinkedInt64.Append (const V : Int64);
  560.   Begin
  561.     TLinkedInt64 (Last).InsertAfter (V);
  562.   End;
  563.  
  564. Function TLinkedInt64.FindNext (const Find : Int64) : TLinkedInt64;
  565.   Begin
  566.     Result := self;
  567.     Repeat
  568.       if Result.Value = Find then
  569.         exit;
  570.       Result := TLinkedInt64 (Result.Next);
  571.     Until not Assigned (Result);
  572.   End;
  573.  
  574.  
  575.  
  576. {                                                                              }
  577. { TDoublyLinkedInt64                                                           }
  578. {                                                                              }
  579. Constructor TDoublyLinkedInt64.Create (const V : Int64);
  580.   Begin
  581.     inherited Create;
  582.     Value := V;
  583.   End;
  584.  
  585. Procedure TDoublyLinkedInt64.InsertAfter (const V : Int64);
  586.   Begin
  587.     inherited InsertAfter (TDoublyLinkedInt64.Create (V));
  588.   End;
  589.  
  590. Procedure TDoublyLinkedInt64.InsertBefore (const V : Int64);
  591.   Begin
  592.     inherited InsertBefore (TDoublyLinkedInt64.Create (V));
  593.   End;
  594.  
  595. Procedure TDoublyLinkedInt64.InsertFirst (const V : Int64);
  596.   Begin
  597.     TDoublyLinkedInt64 (First).InsertBefore (V);
  598.   End;
  599.  
  600. Procedure TDoublyLinkedInt64.Append (const V : Int64);
  601.   Begin
  602.     TDoublyLinkedInt64 (Last).InsertAfter (V);
  603.   End;
  604.  
  605. Function TDoublyLinkedInt64.FindNext (const Find : Int64) : TDoublyLinkedInt64;
  606.   Begin
  607.     Result := self;
  608.     Repeat
  609.       if Result.Value = Find then
  610.         exit;
  611.       Result := TDoublyLinkedInt64 (Result.Next);
  612.     Until not Assigned (Result);
  613.   End;
  614.  
  615. Function TDoublyLinkedInt64.FindPrev (const Find : Int64) : TDoublyLinkedInt64;
  616.   Begin
  617.     Result := self;
  618.     Repeat
  619.       if Result.Value = Find then
  620.         exit;
  621.       Result := TDoublyLinkedInt64 (Result.Prev);
  622.     Until not Assigned (Result);
  623.   End;
  624.  
  625.  
  626.  
  627. {                                                                              }
  628. { TLinkedSingle                                                                }
  629. {                                                                              }
  630. Constructor TLinkedSingle.Create (const V : Single);
  631.   Begin
  632.     inherited Create;
  633.     Value := V;
  634.   End;
  635.  
  636. Procedure TLinkedSingle.InsertAfter (const V : Single);
  637.   Begin
  638.     inherited InsertAfter (TLinkedSingle.Create (V));
  639.   End;
  640.  
  641. Procedure TLinkedSingle.Append (const V : Single);
  642.   Begin
  643.     TLinkedSingle (Last).InsertAfter (V);
  644.   End;
  645.  
  646. Function TLinkedSingle.FindNext (const Find : Single) : TLinkedSingle;
  647.   Begin
  648.     Result := self;
  649.     Repeat
  650.       if Result.Value = Find then
  651.         exit;
  652.       Result := TLinkedSingle (Result.Next);
  653.     Until not Assigned (Result);
  654.   End;
  655.  
  656.  
  657.  
  658. {                                                                              }
  659. { TDoublyLinkedSingle                                                          }
  660. {                                                                              }
  661. Constructor TDoublyLinkedSingle.Create (const V : Single);
  662.   Begin
  663.     inherited Create;
  664.     Value := V;
  665.   End;
  666.  
  667. Procedure TDoublyLinkedSingle.InsertAfter (const V : Single);
  668.   Begin
  669.     inherited InsertAfter (TDoublyLinkedSingle.Create (V));
  670.   End;
  671.  
  672. Procedure TDoublyLinkedSingle.InsertBefore (const V : Single);
  673.   Begin
  674.     inherited InsertBefore (TDoublyLinkedSingle.Create (V));
  675.   End;
  676.  
  677. Procedure TDoublyLinkedSingle.InsertFirst (const V : Single);
  678.   Begin
  679.     TDoublyLinkedSingle (First).InsertBefore (V);
  680.   End;
  681.  
  682. Procedure TDoublyLinkedSingle.Append (const V : Single);
  683.   Begin
  684.     TDoublyLinkedSingle (Last).InsertAfter (V);
  685.   End;
  686.  
  687. Function TDoublyLinkedSingle.FindNext (const Find : Single) : TDoublyLinkedSingle;
  688.   Begin
  689.     Result := self;
  690.     Repeat
  691.       if Result.Value = Find then
  692.         exit;
  693.       Result := TDoublyLinkedSingle (Result.Next);
  694.     Until not Assigned (Result);
  695.   End;
  696.  
  697. Function TDoublyLinkedSingle.FindPrev (const Find : Single) : TDoublyLinkedSingle;
  698.   Begin
  699.     Result := self;
  700.     Repeat
  701.       if Result.Value = Find then
  702.         exit;
  703.       Result := TDoublyLinkedSingle (Result.Prev);
  704.     Until not Assigned (Result);
  705.   End;
  706.  
  707.  
  708.  
  709. {                                                                              }
  710. { TLinkedDouble                                                                }
  711. {                                                                              }
  712. Constructor TLinkedDouble.Create (const V : Double);
  713.   Begin
  714.     inherited Create;
  715.     Value := V;
  716.   End;
  717.  
  718. Procedure TLinkedDouble.InsertAfter (const V : Double);
  719.   Begin
  720.     inherited InsertAfter (TLinkedDouble.Create (V));
  721.   End;
  722.  
  723. Procedure TLinkedDouble.Append (const V : Double);
  724.   Begin
  725.     TLinkedDouble (Last).InsertAfter (V);
  726.   End;
  727.  
  728. Function TLinkedDouble.FindNext (const Find : Double) : TLinkedDouble;
  729.   Begin
  730.     Result := self;
  731.     Repeat
  732.       if Result.Value = Find then
  733.         exit;
  734.       Result := TLinkedDouble (Result.Next);
  735.     Until not Assigned (Result);
  736.   End;
  737.  
  738.  
  739.  
  740. {                                                                              }
  741. { TDoublyLinkedDouble                                                          }
  742. {                                                                              }
  743. Constructor TDoublyLinkedDouble.Create (const V : Double);
  744.   Begin
  745.     inherited Create;
  746.     Value := V;
  747.   End;
  748.  
  749. Procedure TDoublyLinkedDouble.InsertAfter (const V : Double);
  750.   Begin
  751.     inherited InsertAfter (TDoublyLinkedDouble.Create (V));
  752.   End;
  753.  
  754. Procedure TDoublyLinkedDouble.InsertBefore (const V : Double);
  755.   Begin
  756.     inherited InsertBefore (TDoublyLinkedDouble.Create (V));
  757.   End;
  758.  
  759. Procedure TDoublyLinkedDouble.InsertFirst (const V : Double);
  760.   Begin
  761.     TDoublyLinkedDouble (First).InsertBefore (V);
  762.   End;
  763.  
  764. Procedure TDoublyLinkedDouble.Append (const V : Double);
  765.   Begin
  766.     TDoublyLinkedDouble (Last).InsertAfter (V);
  767.   End;
  768.  
  769. Function TDoublyLinkedDouble.FindNext (const Find : Double) : TDoublyLinkedDouble;
  770.   Begin
  771.     Result := self;
  772.     Repeat
  773.       if Result.Value = Find then
  774.         exit;
  775.       Result := TDoublyLinkedDouble (Result.Next);
  776.     Until not Assigned (Result);
  777.   End;
  778.  
  779. Function TDoublyLinkedDouble.FindPrev (const Find : Double) : TDoublyLinkedDouble;
  780.   Begin
  781.     Result := self;
  782.     Repeat
  783.       if Result.Value = Find then
  784.         exit;
  785.       Result := TDoublyLinkedDouble (Result.Prev);
  786.     Until not Assigned (Result);
  787.   End;
  788.  
  789.  
  790.  
  791. {                                                                              }
  792. { TLinkedExtended                                                              }
  793. {                                                                              }
  794. Constructor TLinkedExtended.Create (const V : Extended);
  795.   Begin
  796.     inherited Create;
  797.     Value := V;
  798.   End;
  799.  
  800. Procedure TLinkedExtended.InsertAfter (const V : Extended);
  801.   Begin
  802.     inherited InsertAfter (TLinkedExtended.Create (V));
  803.   End;
  804.  
  805. Procedure TLinkedExtended.Append (const V : Extended);
  806.   Begin
  807.     TLinkedExtended (Last).InsertAfter (V);
  808.   End;
  809.  
  810. Function TLinkedExtended.FindNext (const Find : Extended) : TLinkedExtended;
  811.   Begin
  812.     Result := self;
  813.     Repeat
  814.       if Result.Value = Find then
  815.         exit;
  816.       Result := TLinkedExtended (Result.Next);
  817.     Until not Assigned (Result);
  818.   End;
  819.  
  820.  
  821.  
  822. {                                                                              }
  823. { TDoublyLinkedExtended                                                        }
  824. {                                                                              }
  825. Constructor TDoublyLinkedExtended.Create (const V : Extended);
  826.   Begin
  827.     inherited Create;
  828.     Value := V;
  829.   End;
  830.  
  831. Procedure TDoublyLinkedExtended.InsertAfter (const V : Extended);
  832.   Begin
  833.     inherited InsertAfter (TDoublyLinkedExtended.Create (V));
  834.   End;
  835.  
  836. Procedure TDoublyLinkedExtended.InsertBefore (const V : Extended);
  837.   Begin
  838.     inherited InsertBefore (TDoublyLinkedExtended.Create (V));
  839.   End;
  840.  
  841. Procedure TDoublyLinkedExtended.InsertFirst (const V : Extended);
  842.   Begin
  843.     TDoublyLinkedExtended (First).InsertBefore (V);
  844.   End;
  845.  
  846. Procedure TDoublyLinkedExtended.Append (const V : Extended);
  847.   Begin
  848.     TDoublyLinkedExtended (Last).InsertAfter (V);
  849.   End;
  850.  
  851. Function TDoublyLinkedExtended.FindNext (const Find : Extended) : TDoublyLinkedExtended;
  852.   Begin
  853.     Result := self;
  854.     Repeat
  855.       if Result.Value = Find then
  856.         exit;
  857.       Result := TDoublyLinkedExtended (Result.Next);
  858.     Until not Assigned (Result);
  859.   End;
  860.  
  861. Function TDoublyLinkedExtended.FindPrev (const Find : Extended) : TDoublyLinkedExtended;
  862.   Begin
  863.     Result := self;
  864.     Repeat
  865.       if Result.Value = Find then
  866.         exit;
  867.       Result := TDoublyLinkedExtended (Result.Prev);
  868.     Until not Assigned (Result);
  869.   End;
  870.  
  871.  
  872.  
  873. {                                                                              }
  874. { TLinkedString                                                                }
  875. {                                                                              }
  876. Constructor TLinkedString.Create (const V : String);
  877.   Begin
  878.     inherited Create;
  879.     Value := V;
  880.   End;
  881.  
  882. Procedure TLinkedString.InsertAfter (const V : String);
  883.   Begin
  884.     inherited InsertAfter (TLinkedString.Create (V));
  885.   End;
  886.  
  887. Procedure TLinkedString.Append (const V : String);
  888.   Begin
  889.     TLinkedString (Last).InsertAfter (V);
  890.   End;
  891.  
  892. Function TLinkedString.FindNext (const Find : String) : TLinkedString;
  893.   Begin
  894.     Result := self;
  895.     Repeat
  896.       if Result.Value = Find then
  897.         exit;
  898.       Result := TLinkedString (Result.Next);
  899.     Until not Assigned (Result);
  900.   End;
  901.  
  902.  
  903.  
  904. {                                                                              }
  905. { TDoublyLinkedString                                                          }
  906. {                                                                              }
  907. Constructor TDoublyLinkedString.Create (const V : String);
  908.   Begin
  909.     inherited Create;
  910.     Value := V;
  911.   End;
  912.  
  913. Procedure TDoublyLinkedString.InsertAfter (const V : String);
  914.   Begin
  915.     inherited InsertAfter (TDoublyLinkedString.Create (V));
  916.   End;
  917.  
  918. Procedure TDoublyLinkedString.InsertBefore (const V : String);
  919.   Begin
  920.     inherited InsertBefore (TDoublyLinkedString.Create (V));
  921.   End;
  922.  
  923. Procedure TDoublyLinkedString.InsertFirst (const V : String);
  924.   Begin
  925.     TDoublyLinkedString (First).InsertBefore (V);
  926.   End;
  927.  
  928. Procedure TDoublyLinkedString.Append (const V : String);
  929.   Begin
  930.     TDoublyLinkedString (Last).InsertAfter (V);
  931.   End;
  932.  
  933. Function TDoublyLinkedString.FindNext (const Find : String) : TDoublyLinkedString;
  934.   Begin
  935.     Result := self;
  936.     Repeat
  937.       if Result.Value = Find then
  938.         exit;
  939.       Result := TDoublyLinkedString (Result.Next);
  940.     Until not Assigned (Result);
  941.   End;
  942.  
  943. Function TDoublyLinkedString.FindPrev (const Find : String) : TDoublyLinkedString;
  944.   Begin
  945.     Result := self;
  946.     Repeat
  947.       if Result.Value = Find then
  948.         exit;
  949.       Result := TDoublyLinkedString (Result.Prev);
  950.     Until not Assigned (Result);
  951.   End;
  952.  
  953.  
  954.  
  955. {                                                                              }
  956. { TLinkedObject                                                                }
  957. {                                                                              }
  958. Constructor TLinkedObject.Create (const V : TObject);
  959.   Begin
  960.     inherited Create;
  961.     Value := V;
  962.   End;
  963.  
  964. Procedure TLinkedObject.InsertAfter (const V : TObject);
  965.   Begin
  966.     inherited InsertAfter (TLinkedObject.Create (V));
  967.   End;
  968.  
  969. Procedure TLinkedObject.Append (const V : TObject);
  970.   Begin
  971.     TLinkedObject (Last).InsertAfter (V);
  972.   End;
  973.  
  974. Function TLinkedObject.FindNext (const Find : TObject) : TLinkedObject;
  975.   Begin
  976.     Result := self;
  977.     Repeat
  978.       if Result.Value = Find then
  979.         exit;
  980.       Result := TLinkedObject (Result.Next);
  981.     Until not Assigned (Result);
  982.   End;
  983.  
  984.  
  985.  
  986. {                                                                              }
  987. { TDoublyLinkedObject                                                          }
  988. {                                                                              }
  989. Constructor TDoublyLinkedObject.Create (const V : TObject);
  990.   Begin
  991.     inherited Create;
  992.     Value := V;
  993.   End;
  994.  
  995. Procedure TDoublyLinkedObject.InsertAfter (const V : TObject);
  996.   Begin
  997.     inherited InsertAfter (TDoublyLinkedObject.Create (V));
  998.   End;
  999.  
  1000. Procedure TDoublyLinkedObject.InsertBefore (const V : TObject);
  1001.   Begin
  1002.     inherited InsertBefore (TDoublyLinkedObject.Create (V));
  1003.   End;
  1004.  
  1005. Procedure TDoublyLinkedObject.InsertFirst (const V : TObject);
  1006.   Begin
  1007.     TDoublyLinkedObject (First).InsertBefore (V);
  1008.   End;
  1009.  
  1010. Procedure TDoublyLinkedObject.Append (const V : TObject);
  1011.   Begin
  1012.     TDoublyLinkedObject (Last).InsertAfter (V);
  1013.   End;
  1014.  
  1015. Function TDoublyLinkedObject.FindNext (const Find : TObject) : TDoublyLinkedObject;
  1016.   Begin
  1017.     Result := self;
  1018.     Repeat
  1019.       if Result.Value = Find then
  1020.         exit;
  1021.       Result := TDoublyLinkedObject (Result.Next);
  1022.     Until not Assigned (Result);
  1023.   End;
  1024.  
  1025. Function TDoublyLinkedObject.FindPrev (const Find : TObject) : TDoublyLinkedObject;
  1026.   Begin
  1027.     Result := self;
  1028.     Repeat
  1029.       if Result.Value = Find then
  1030.         exit;
  1031.       Result := TDoublyLinkedObject (Result.Prev);
  1032.     Until not Assigned (Result);
  1033.   End;
  1034.  
  1035.  
  1036.  
  1037.  
  1038.  
  1039.  
  1040. {                                                                              }
  1041. { Open array to Linked list                                                    }
  1042. {                                                                              }
  1043. Function AsLinkedIntegerList (const V : Array of Integer) : TLinkedInteger;
  1044. var I, L : TLinkedInteger;
  1045.     F    : Integer;
  1046.   Begin
  1047.     Result := nil;
  1048.     L := nil;
  1049.     For F := 0 to High (V) do
  1050.       begin
  1051.         I := TLinkedInteger.Create (V [F]);
  1052.         if not Assigned (L) then
  1053.           begin
  1054.             L := I;
  1055.             Result := I;
  1056.           end else
  1057.           begin
  1058.             L.InsertAfter (I);
  1059.             L := I;
  1060.           end;
  1061.       end;
  1062.   End;
  1063.  
  1064. Function AsLinkedInt64List (const V : Array of Int64) : TLinkedInt64;
  1065. var I, L : TLinkedInt64;
  1066.     F    : Integer;
  1067.   Begin
  1068.     Result := nil;
  1069.     L := nil;
  1070.     For F := 0 to High (V) do
  1071.       begin
  1072.         I := TLinkedInt64.Create (V [F]);
  1073.         if not Assigned (L) then
  1074.           begin
  1075.             L := I;
  1076.             Result := I;
  1077.           end else
  1078.           begin
  1079.             L.InsertAfter (I);
  1080.             L := I;
  1081.           end;
  1082.       end;
  1083.   End;
  1084.  
  1085. Function AsLinkedSingleList (const V : Array of Single) : TLinkedSingle;
  1086. var I, L : TLinkedSingle;
  1087.     F    : Integer;
  1088.   Begin
  1089.     Result := nil;
  1090.     L := nil;
  1091.     For F := 0 to High (V) do
  1092.       begin
  1093.         I := TLinkedSingle.Create (V [F]);
  1094.         if not Assigned (L) then
  1095.           begin
  1096.             L := I;
  1097.             Result := I;
  1098.           end else
  1099.           begin
  1100.             L.InsertAfter (I);
  1101.             L := I;
  1102.           end;
  1103.       end;
  1104.   End;
  1105.  
  1106. Function AsLinkedDoubleList (const V : Array of Double) : TLinkedDouble;
  1107. var I, L : TLinkedDouble;
  1108.     F    : Integer;
  1109.   Begin
  1110.     Result := nil;
  1111.     L := nil;
  1112.     For F := 0 to High (V) do
  1113.       begin
  1114.         I := TLinkedDouble.Create (V [F]);
  1115.         if not Assigned (L) then
  1116.           begin
  1117.             L := I;
  1118.             Result := I;
  1119.           end else
  1120.           begin
  1121.             L.InsertAfter (I);
  1122.             L := I;
  1123.           end;
  1124.       end;
  1125.   End;
  1126.  
  1127. Function AsLinkedExtendedList (const V : Array of Extended) : TLinkedExtended;
  1128. var I, L : TLinkedExtended;
  1129.     F    : Integer;
  1130.   Begin
  1131.     Result := nil;
  1132.     L := nil;
  1133.     For F := 0 to High (V) do
  1134.       begin
  1135.         I := TLinkedExtended.Create (V [F]);
  1136.         if not Assigned (L) then
  1137.           begin
  1138.             L := I;
  1139.             Result := I;
  1140.           end else
  1141.           begin
  1142.             L.InsertAfter (I);
  1143.             L := I;
  1144.           end;
  1145.       end;
  1146.   End;
  1147.  
  1148. Function AsLinkedStringList (const V : Array of String) : TLinkedString;
  1149. var I, L : TLinkedString;
  1150.     F    : Integer;
  1151.   Begin
  1152.     Result := nil;
  1153.     L := nil;
  1154.     For F := 0 to High (V) do
  1155.       begin
  1156.         I := TLinkedString.Create (V [F]);
  1157.         if not Assigned (L) then
  1158.           begin
  1159.             L := I;
  1160.             Result := I;
  1161.           end else
  1162.           begin
  1163.             L.InsertAfter (I);
  1164.             L := I;
  1165.           end;
  1166.       end;
  1167.   End;
  1168.  
  1169. Function AsDoublyLinkedIntegerList (const V : Array of Integer) : TDoublyLinkedInteger;
  1170. var I, L : TDoublyLinkedInteger;
  1171.     F    : Integer;
  1172.   Begin
  1173.     Result := nil;
  1174.     L := nil;
  1175.     For F := 0 to High (V) do
  1176.       begin
  1177.         I := TDoublyLinkedInteger.Create (V [F]);
  1178.         if not Assigned (L) then
  1179.           begin
  1180.             L := I;
  1181.             Result := I;
  1182.           end else
  1183.           begin
  1184.             L.InsertAfter (I);
  1185.             L := I;
  1186.           end;
  1187.       end;
  1188.   End;
  1189.  
  1190. Function AsDoublyLinkedInt64List (const V : Array of Int64) : TDoublyLinkedInt64;
  1191. var I, L : TDoublyLinkedInt64;
  1192.     F    : Integer;
  1193.   Begin
  1194.     Result := nil;
  1195.     L := nil;
  1196.     For F := 0 to High (V) do
  1197.       begin
  1198.         I := TDoublyLinkedInt64.Create (V [F]);
  1199.         if not Assigned (L) then
  1200.           begin
  1201.             L := I;
  1202.             Result := I;
  1203.           end else
  1204.           begin
  1205.             L.InsertAfter (I);
  1206.             L := I;
  1207.           end;
  1208.       end;
  1209.   End;
  1210.  
  1211. Function AsDoublyLinkedSingleList (const V : Array of Single) : TDoublyLinkedSingle;
  1212. var I, L : TDoublyLinkedSingle;
  1213.     F    : Integer;
  1214.   Begin
  1215.     Result := nil;
  1216.     L := nil;
  1217.     For F := 0 to High (V) do
  1218.       begin
  1219.         I := TDoublyLinkedSingle.Create (V [F]);
  1220.         if not Assigned (L) then
  1221.           begin
  1222.             L := I;
  1223.             Result := I;
  1224.           end else
  1225.           begin
  1226.             L.InsertAfter (I);
  1227.             L := I;
  1228.           end;
  1229.       end;
  1230.   End;
  1231.  
  1232. Function AsDoublyLinkedDoubleList (const V : Array of Double) : TDoublyLinkedDouble;
  1233. var I, L : TDoublyLinkedDouble;
  1234.     F    : Integer;
  1235.   Begin
  1236.     Result := nil;
  1237.     L := nil;
  1238.     For F := 0 to High (V) do
  1239.       begin
  1240.         I := TDoublyLinkedDouble.Create (V [F]);
  1241.         if not Assigned (L) then
  1242.           begin
  1243.             L := I;
  1244.             Result := I;
  1245.           end else
  1246.           begin
  1247.             L.InsertAfter (I);
  1248.             L := I;
  1249.           end;
  1250.       end;
  1251.   End;
  1252.  
  1253. Function AsDoublyLinkedExtendedList (const V : Array of Extended) : TDoublyLinkedExtended;
  1254. var I, L : TDoublyLinkedExtended;
  1255.     F    : Integer;
  1256.   Begin
  1257.     Result := nil;
  1258.     L := nil;
  1259.     For F := 0 to High (V) do
  1260.       begin
  1261.         I := TDoublyLinkedExtended.Create (V [F]);
  1262.         if not Assigned (L) then
  1263.           begin
  1264.             L := I;
  1265.             Result := I;
  1266.           end else
  1267.           begin
  1268.             L.InsertAfter (I);
  1269.             L := I;
  1270.           end;
  1271.       end;
  1272.   End;
  1273.  
  1274. Function AsDoublyLinkedStringList (const V : Array of String) : TDoublyLinkedString;
  1275. var I, L : TDoublyLinkedString;
  1276.     F    : Integer;
  1277.   Begin
  1278.     Result := nil;
  1279.     L := nil;
  1280.     For F := 0 to High (V) do
  1281.       begin
  1282.         I := TDoublyLinkedString.Create (V [F]);
  1283.         if not Assigned (L) then
  1284.           begin
  1285.             L := I;
  1286.             Result := I;
  1287.           end else
  1288.           begin
  1289.             L.InsertAfter (I);
  1290.             L := I;
  1291.           end;
  1292.       end;
  1293.   End;
  1294.  
  1295.  
  1296.  
  1297.  
  1298. {                                                                              }
  1299. { TDoublyLinkedList                                                            }
  1300. {                                                                              }
  1301. Destructor TDoublyLinkedList.Destroy;
  1302.   Begin
  1303.     if Assigned (FFirst) then
  1304.       FFirst.DestroyList;
  1305.     FFirst := nil;
  1306.     FLast := nil;
  1307.     inherited Destroy;
  1308.   End;
  1309.  
  1310. Function TDoublyLinkedList.Count : Integer;
  1311.   Begin
  1312.     Result := FCount;
  1313.   End;
  1314.  
  1315. Function TDoublyLinkedList.IsEmpty : Boolean;
  1316.   Begin
  1317.     Result := not Assigned (FFirst);
  1318.   End;
  1319.  
  1320. Procedure TDoublyLinkedList.Append (const Item : TDoublyLinkedItem);
  1321.   Begin
  1322.     if not Assigned (FFirst) then
  1323.       begin
  1324.         FFirst := Item;
  1325.         FLast := Item;
  1326.       end else
  1327.       begin
  1328.         FLast.InsertAfter (Item);
  1329.         FLast := Item;
  1330.       end;
  1331.     Inc (FCount);
  1332.   End;
  1333.  
  1334. Procedure TDoublyLinkedList.InsertFront (const Item : TDoublyLinkedItem);
  1335.   Begin
  1336.     if not Assigned (FFirst) then
  1337.       begin
  1338.         FFirst := Item;
  1339.         FLast := Item;
  1340.       end else
  1341.       begin
  1342.         FFirst.InsertBefore (Item);
  1343.         FFirst := Item;
  1344.       end;
  1345.     Inc (FCount);
  1346.   End;
  1347.  
  1348. Procedure TDoublyLinkedList.Remove (const Item : TDoublyLinkedItem);
  1349.   Begin
  1350.     if not Assigned (Item) then
  1351.       exit;
  1352.     if FFirst = Item then
  1353.       FFirst := Item.Next;
  1354.     if FLast = Item then
  1355.       FLast := Item.Prev;
  1356.     Item.Remove;
  1357.     Dec (FCount);
  1358.   End;
  1359.  
  1360. Function TDoublyLinkedList.RemoveFirst : TDoublyLinkedItem;
  1361.   Begin
  1362.     Result := FFirst;
  1363.     if not Assigned (Result) then
  1364.       exit;
  1365.     if Result = FLast then
  1366.       begin
  1367.         FFirst := nil;
  1368.         FLast := nil;
  1369.       end else
  1370.       begin
  1371.         Result.Remove;
  1372.         FFirst := Result.Next;
  1373.       end;
  1374.     Dec (FCount);
  1375.   End;
  1376.  
  1377. Function TDoublyLinkedList.RemoveLast : TDoublyLinkedItem;
  1378.   Begin
  1379.     Result := FLast;
  1380.     if not Assigned (Result) then
  1381.       exit;
  1382.     if Result = FFirst then
  1383.       begin
  1384.         FFirst := nil;
  1385.         FLast := nil;
  1386.       end else
  1387.       begin
  1388.         Result.Remove;
  1389.         FLast := Result.Prev;
  1390.       end;
  1391.     Dec (FCount);
  1392.   End;
  1393.  
  1394. Procedure TDoublyLinkedList.Delete (const Item : TDoublyLinkedItem);
  1395.   Begin
  1396.     Remove (Item);
  1397.     Item.Free;
  1398.   End;
  1399.  
  1400. Procedure TDoublyLinkedList.DeleteFirst;
  1401.   Begin
  1402.     RemoveFirst.Free;
  1403.   End;
  1404.  
  1405. Procedure TDoublyLinkedList.DeleteLast;
  1406.   Begin
  1407.     RemoveLast.Free;
  1408.   End;
  1409.  
  1410.  
  1411.  
  1412. end.
  1413.  
  1414.