Computational Sequence Class Body
MC logo
 

Computational Sequence Class Body

Ada Code Examples


<<Computational Sequence Class Download Additive Sequence Class>>
--
-- Computational counter.  Both additive (increase by a const each time)
-- and multiplicative (increase by a factor.
--
with Gnat.Io; use Gnat.Io;
with CompCount; use CompCount;
package body compcount is
   -- Init.
   procedure Init(S: in out ComputationalSequence'class;
                  Start, Step: Integer) is
   begin
      S.Val := Start;
      S.Inc := Step;
   end Init;

   -- Get the current item.
   function Value(S: ComputationalSequence) return Integer is
   begin
     return S.Val;
   end Value;
end Compcount;
<<Computational Sequence Class Additive Sequence Class>>