DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦dbfa4f15b⟧ Ada Source

    Length: 9216 (0x2400)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Box, seg_011eca

Derivation

└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
    └─ ⟦cfc2e13cd⟧ »Space Info Vol 2« 
        └─⟦this⟧ 

E3 Source Code



with Class_Behavior;
with Collection;
with Instance;

with Text_Io;

package body Box is

    type Box_Structure is
        record
            Size  : Natural;
            State : States;
        end record;


    package Behavior is new Class_Behavior (Element        => Box_Structure,
                                            With_Name      => Class_Name,
                                            With_Dates     => Is_Dated,
                                            With_Date_Mode => Date_Mode);


------------------------------------------------------------------------------
    function Size (O : Object) return Natural is
    begin
        return Behavior.Get (O).Size;
    end Size;

    function State (O : Object) return States is
    begin
        return Behavior.Get (O).State;
    end State;

------------------------------------------------------------------------------
    function Instances return Collection.Object is
    begin
        return Behavior.Instances;  
    end Instances;


    function Instances (Kind : Existences := Empty_Boxes)
                       return Collection.Object is
        function Empty_Predicate (O : Object) return Boolean is
        begin
            return Behavior.Get (O).State = Is_Empty;
        end Empty_Predicate;
        function Empty is new Collection.Restrict (Empty_Predicate);
    begin
        case Kind is
            when All_Boxes =>
                return Behavior.Instances;  
            when Empty_Boxes =>
                return Empty (Behavior.Instances);
            when others =>
                return Behavior.Instances;
        end case;
    end Instances;

------------------------------------------------------------------------------
    function Exist (With_State : States; In_Kind_Of_Collection : Existences)
                   return Boolean is
        function Is_State (O : Object) return Boolean is
        begin
            return Behavior.Get (O).State = With_State;
        end Is_State;  
        function Exist_State is new Collection.Exist (Is_State);
    begin
        return Exist_State (Instances (Kind => In_Kind_Of_Collection));
    end Exist;

------------------------------------------------------------------------------
    function Exist (Greater_Than : Natural; In_Kind_Of_Collection : Existences)
                   return Boolean is
        function Is_Greater_Than (O : Object) return Boolean is
        begin
            return Behavior.Get (O).Size > Greater_Than;
        end Is_Greater_Than;  
        function Exist_Greater is new Collection.Exist (Is_Greater_Than);
    begin
        return Exist_Greater (Instances (Kind => In_Kind_Of_Collection));
    end Exist;

------------------------------------------------------------------------------
    function Find (Between               : Natural;
                   And_Size              : Natural;
                   In_Kind_Of_Collection : Existences)
                  return Instance.Reference is
        function Is_Between (O : Object) return Boolean is
        begin
            return Behavior.Get (O).Size > Between and
                      Behavior.Get (O).Size < And_Size;
        end Is_Between;  
        function Find_Between is new Collection.Find_One (Is_Between);
    begin
        -- return Find_Between (Instances (Kind => In_Kind_Of_Collection));
        return Find_Between (Behavior.Instances);
    end Find;

    function Exist (Between               : Natural;
                    And_Size              : Natural;
                    In_Kind_Of_Collection : Existences) return Boolean is
        O  : Instance.Reference;
        Ok : Boolean := False;
        -- function Is_Between (O : Object) return Boolean is
        -- begin
        --     return Behavior.Get (O).Size > Between and
        --               Behavior.Get (O).Size < And_Size;
        -- end Is_Between;
        -- function Exist_Between is new Collection.Exist (Is_Between);
    begin  
        O  := Find (Between, And_Size, In_Kind_Of_Collection);
        Ok := Instance."/=" (O, Instance.Null_Reference);
        -- Text_Io.Put_Line ("EXIST : " & Boolean'Image (Ok));
        return Ok;
        -- return Exist_Between (Instances (Kind => In_Kind_Of_Collection));
    end Exist;


------------------------------------------------------------------------------
    function Add (With_Size  : Natural := Default_Size;
                  With_State : States  := Default_State) return Object is
        A_Box : Box_Structure;
    begin
        A_Box.Size  := With_Size;
        A_Box.State := With_State;
        return Behavior.Allocate (The_Element => A_Box);
    end Add;

------------------------------------------------------------------------------
    procedure Change (O : Object; With_Size : Natural; With_State : States) is
        A_Box : Box_Structure;
    begin
        A_Box       := Behavior.Get (The_Reference => O);
        A_Box.Size  := With_Size;
        A_Box.State := With_State;
        Behavior.Set (The_Reference => O, With_Value => A_Box);
    end Change;

    procedure Change (O : Object; With_State : States) is
        A_Box : Box_Structure;
    begin
        A_Box       := Behavior.Get (The_Reference => O);
        A_Box.State := With_State;
        Behavior.Set (The_Reference => O, With_Value => A_Box);
    end Change;

------------------------------------------------------------------------------
    procedure Delete (O : Object) is
    begin
        Behavior.Dispose (The_Reference => O);
    end Delete;

------------------------------------------------------------------------------
    procedure Mask (O : Object) is
    begin
        Behavior.Mask (The_Reference => O);
    end Mask;

------------------------------------------------------------------------------
    procedure Unmask (O : Object) is
    begin
        Behavior.Unmask (The_Reference => O);
    end Unmask;

------------------------------------------------------------------------------
    procedure Clean is
    begin
        Behavior.Clear;
    end Clean;

------------------------------------------------------------------------------
    procedure Mask_All is
    begin
        Behavior.Mask_All;
    end Mask_All;

------------------------------------------------------------------------------
    procedure Unmask_All is
    begin
        Behavior.Unmask_All;
    end Unmask_All;


end Box;

E3 Meta Data

    nblk1=8
    nid=0
    hdr6=10
        [0x00] rec0=24 rec1=00 rec2=01 rec3=004
        [0x01] rec0=01 rec1=00 rec2=04 rec3=014
        [0x02] rec0=1b rec1=00 rec2=06 rec3=01e
        [0x03] rec0=16 rec1=00 rec2=08 rec3=034
        [0x04] rec0=16 rec1=00 rec2=03 rec3=032
        [0x05] rec0=18 rec1=00 rec2=07 rec3=00e
        [0x06] rec0=1c rec1=00 rec2=05 rec3=032
        [0x07] rec0=19 rec1=00 rec2=02 rec3=000
    tail 0x2170df2a682466ea73d66 0x42a00088462063c03