DEFINITION Items;  (* Stephan Junker *)


(* Items implements a double chained list in which the elements have a
 * unique identification, hence called itemId. You can add, search or
 * search and delete an item.
 * Type ItemDesc may be extended for additional item data.
 *)


TYPE
  Item*     = POINTER TO ItemDesc;
  ItemDesc* = RECORD(DCL.Element)
                itemId- : LONGINT;
              END;
  List*     = POINTER TO ListDesc;
  ListDesc* = RECORD(DCL.ListDesc)

                PROCEDURE(l : List) Add*(i : Item; itemId : LONGINT);
                  (* adds an item with id itemId to list l. *)


                PROCEDURE(l : List) Find*(itemId : LONGINT; VAR i : Item) : BOOLEAN;
                  (* tries to find an item in list l with id itemId.
                     Returns true if found *)


                PROCEDURE(l : List) FindAndDelete*(itemId : LONGINT);
                  (* deletes the item with id itemId in list l if found.
                     Memory is disposed! *)


              END;


END Items.