-- Copyright (c) 1995/6 John Beidler -- Computing Sciences Dept. -- Univ. of Scranton, Scranton, PA 18510 -- -- (717) 941-7446 voice -- (717) 941-4250 FAX -- beidler@cs.uofs.edu -- -- For use by non-profit educational institutions only. -- This software is GUARANTEED. Please report any errors. All -- corrections will be made as soon as possible (normally within -- one working day). ------------------------------------------------------------------ package List_Polymorphic_Cntl.Advanced is type EQ_Type is access function (L, R: Holder_Class_Ptr) return boolean; function Size (List: List_Type) return integer; ------------------------------------------------------------------ -- Pre Cond : None -- Post Cond: returns the number of objects in the list -- Exception: None ------------------------------------------------------------------ procedure Insert (Object : in out Place_Holder'Class; Position: in positive; List : in List_Type); --------------------------------------------------------------------- -- Pre Cond : 1 <= Position <= Size (List) -- Post Cond : List'=(a ,...,a ,Object,a ,...,a ) -- 1 position-1 position n -- Exceptions: constraint_error -- NOTE: Swap used to exchange value of Holder_Class_Ptr --------------------------------------------------------------------- generic type Extended_Type is new Place_Holder with private; procedure g_Remove (List : in List_Type; Position: in positive; Object : in out Extended_Type); procedure Remove (List : in List_Type; Position: in positive; Object : in out Holder_Class_Ptr); --------------------------------------------------------------------- -- Pre Cond : 1 <= Position <= Size (List) -- Post Cond : List'=(a ,...,a ,a ,...,a ) -- 1 position-1 position+1 n -- Object' = List(position) -- Exceptions: constraint_error -- NOTE: Swap used to exchange value of Holder_Class_Ptr --------------------------------------------------------------------- generic type Extended_Type is new Place_Holder with private; function g_Peek (List : List_Type; Index: positive) return Extended_Type; function Peek (List : List_Type; Index: positive) return Holder_Class_Ptr; ------------------------------------------------------------------ -- Pre Cond : List /= {}, 1 <= Index <= #(List) -- Post Cond: Returns List(Index) -- Exception: List_Underflow or constraint_error ------------------------------------------------------------------ procedure Poke (List : in out List_Type; Index : in positive; Object: in Place_Holder'Class); ---------------------------------------------------------------- -- Pre Cond : 1 <= Index <= #(List) -- Post Cond: List(Index)' = Object -- Exception: constraint_error -- NOTE: Swap used to exchange value of Holder_Class_Ptr ------------------------------------------------------------------ end List_Polymorphic_Cntl.Advanced;