Listing Sequence Class
MC logo
 

Listing Sequence Class

Ada Code Examples


<<Multiplicative Sequence Class Body Download Listing Sequence Class Body>>
--
-- Sequences specified by an array of items.
--
with SeqPack; use SeqPack;
package ListSeq is
   -- Type for initializing the beast.
   type SeqList is array (Integer range <>) of Integer;

   -- Pointer type for allocating arrays inside the objects.
   type SeqListPtr is access SeqList;

   -- This is the derived type.
   type ListSequence is new Sequence with record
      List: SeqListPtr;         -- List of items.
      Which: Integer;           -- Current one (subscript).
   end record;

   -- Set the sequence.
   procedure SetList(S: out ListSequence; A: SeqList);

   -- Standard procedures.
   procedure Next(S: in out ListSequence);

   -- Get the current item.
   function Value(S: ListSequence) return Integer;

private
end ListSeq;

<<Multiplicative Sequence Class Body Listing Sequence Class Body>>