DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400 Tapes

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 Tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ B T

⟦ff69d59e4⟧ TextFile

    Length: 4859 (0x12fb)
    Types: TextFile
    Names: »B«

Derivation

└─⟦149519bd4⟧ Bits:30000546 8mm tape, Rational 1000, !projects 93-07-13
    └─ ⟦124ff5788⟧ »DATA« 
        └─⟦this⟧ 
└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11
    └─ ⟦129cab021⟧ »DATA« 
        └─⟦this⟧ 
└─⟦f64eaa120⟧ Bits:30000752 8mm tape, Rational 1000, !projects 93 02 16
    └─ ⟦6f12a12be⟧ »DATA« 
        └─⟦this⟧ 
└─⟦2f6cfab89⟧ Bits:30000547 8mm tape, Rational 1000, !projects 94-01-04
    └─ ⟦d65440be7⟧ »DATA« 
        └─⟦this⟧ 

TextFile

with Expertsystem;
use Expertsystem;

package body Ball is

    type Ball_Structure is
        record
            Size  : Natural;
            Color : Colors;
            Place : Places;
        end record;


    package Behavior is new Classbehavior (Ball_Structure, "BALLS     ");


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


    function Color (O : Object) return Colors is
    begin
        return Behavior.Get (O).Color;
    end Color;


    function Place (O : Object) return Places is
    begin
        return Behavior.Get (O).Place;
    end Place;


    function Instances (Kind : Existences := All_Balls)
                       return Collection.Object is
        function White_Ball_Predicate (O : Object) return Boolean is
        begin
            return Behavior.Get (O).Color = White;
        end White_Ball_Predicate;
        function White_Balls is new Collection.Restrict (White_Ball_Predicate);

        function Red_Ball_Predicate (O : Object) return Boolean is
        begin
            return Behavior.Get (O).Color = Red;
        end Red_Ball_Predicate;
        function Red_Balls is new Collection.Restrict (Red_Ball_Predicate);

        function Ball_On_Heap_Predicate (O : Object) return Boolean is
        begin
            return Behavior.Get (O).Place = Is_On_Heap;
        end Ball_On_Heap_Predicate;
        function Balls_On_Heap is
           new Collection.Restrict (Ball_On_Heap_Predicate);

    begin
        case Kind is
            when All_Balls =>
                return Behavior.Instances;  
            when White_Balls =>
                return White_Balls (Behavior.Instances);
            when Red_Balls =>  
                return Red_Balls (Behavior.Instances);
            when Balls_On_Heap =>
                return Balls_On_Heap (Behavior.Instances);
            when others =>
                return Behavior.Instances;
        end case;
    end Instances;


    function Exist (With_Place : Places; In_Kind_Of_Collection : Existences)
                   return Boolean is
        function Is_Place (O : Object) return Boolean is
        begin
            return Behavior.Get (O).Place = With_Place;
        end Is_Place;  
        function Exist_Place is new Collection.Exist (Is_Place);
    begin
        return Exist_Place (Instances (Kind => In_Kind_Of_Collection));
    end Exist;

    function Exist (With_Color : String; In_Kind_Of_Collection : Existences)
                   return Boolean is
        function Is_Color (O : Object) return Boolean is
        begin
            return Ball.Colors'Image (Behavior.Get (O).Color) = With_Color;
        end Is_Color;  
        function Exist_Color is new Collection.Exist (Is_Color);
    begin
        return Exist_Color (Instances (Kind => In_Kind_Of_Collection));
    end Exist;

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


    function Exist (Between               : Natural;
                    And_Size              : Natural;
                    In_Kind_Of_Collection : Existences) return Boolean is
    begin
        [statement]
    end Exist;


    function Add (With_Size  : Natural := Default_Size;
                  With_Color : Colors  := Default_Color;
                  With_Place : Places  := Default_Place) return Object is
        A_Ball : Ball_Structure;
    begin
        A_Ball.Size  := With_Size;
        A_Ball.Color := With_Color;
        A_Ball.Place := With_Place;
        return Behavior.Allocate (Initvalue => A_Ball);
    end Add;


    procedure Change (O          : Object;
                      With_Size  : Natural;
                      With_Color : Colors;
                      With_Place : Places) is
        A_Ball : Ball_Structure;
    begin
        A_Ball       := Behavior.Get (Aref => O);
        A_Ball.Size  := With_Size;
        A_Ball.Color := With_Color;
        A_Ball.Place := With_Place;
        Behavior.Set (Aref => O, Withvalue => A_Ball);
    end Change;

    procedure Change (O : Object; With_Place : Places) is
        A_Ball : Ball_Structure;
    begin
        A_Ball       := Behavior.Get (Aref => O);
        A_Ball.Place := With_Place;
        Behavior.Set (Aref => O, Withvalue => A_Ball);
    end Change;


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


    procedure Clean is
    begin
        Behavior.Clear;
    end Clean;


end Ball;