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

⟦d8bb629f5⟧ Ada Source

    Length: 10240 (0x2800)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Pilotes_Et_Avions, procedure Aeroport_Lru, seg_011f9c

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 Context;
with Engine_Lru;
with Instance;
with Text_Io;
with Tuple;
with Tuple_Collection;


with Pilote, Avion, Permis;

procedure Aeroport_Lru is

    package Pilotes_Et_Avions is
        procedure Recherche_Des_Pilotes;
    end Pilotes_Et_Avions;


    package body Pilotes_Et_Avions is

-----------------------------------------------------------------------------
--          REGLES
-----------------------------------------------------------------------------

--  Regle 1 : recherche pilote de plus de 35 ans pilotant un B747
-------------------------------------------------------------------------
        function Match_1 (P : Pilote.Object; Pe : Permis.Object)
                         return Boolean is
        begin
            return Pilote.L_Age (P) >= 35 and then
                      not Pilote.Flag_Traite (P) and then
                      (Permis.La_Licence (Pe) = Pilote.La_Licence (P) and
                       Permis.Le_Nom (Pe) = "B747                          ");
        end Match_1;

        function Rule_1 is
           new Tuple_Collection.Join_2 (Collection_1 => Pilote.Les_Pilotes,
                                        Collection_2 => Permis.Les_Permis,
                                        Match        => Match_1);

        function Pilote_35_B747_C return Tuple_Collection.Object is
        begin
            return Rule_1;
        end Pilote_35_B747_C;


        procedure Pilote_35_B747_A (Mg : Tuple.Object) is
            P : Pilote.Object;
        begin
            Tuple.Split (The_Tuple => Mg, In_Ref1 => P);
            Pilote.Modifier (P, True);
            Text_Io.Put_Line ("PILOTES_35_747 : " & Pilote.Le_Nom (P));
        end Pilote_35_B747_A;


--  Regle 2 : recherche tous les pilotes pilotant un B747
-------------------------------------------------------------------------
        function Match_2 (P : Pilote.Object; Pe : Permis.Object)
                         return Boolean is
        begin
            return not Pilote.Flag_Traite (P) and then
                      (Permis.La_Licence (Pe) = Pilote.La_Licence (P) and
                       Permis.Le_Nom (Pe) = "B747                          ");
        end Match_2;

        function Rule_2 is
           new Tuple_Collection.Join_2 (Collection_1 => Pilote.Les_Pilotes,
                                        Collection_2 => Permis.Les_Permis,
                                        Match        => Match_2);

        function Pilotes_747_C return Tuple_Collection.Object is
        begin
            return Rule_2;
        end Pilotes_747_C;

        procedure Pilotes_747_A (Mg : Tuple.Object) is
            P  : Pilote.Object;  
            Pe : Permis.Object;
        begin  
            Tuple.Split (The_Tuple => Mg, In_Ref1 => P, In_Ref2 => Pe);
            Pilote.Modifier (P, True);
            Text_Io.Put_Line ("PILOTES_747 : " & Pilote.Le_Nom (P) &
                              " avec le permis " & Permis.La_Licence (Pe));
        end Pilotes_747_A;



-----------------------------------------------------------------------------
--          FAITS
-----------------------------------------------------------------------------

        procedure Creer_Faits is
        begin
            Pilote.Effacer_Faits;
            Avion.Effacer_Faits;
            Permis.Effacer_Faits;
            Pilote.Creer_Faits;
            Avion.Creer_Faits;
            Permis.Creer_Faits;
        end Creer_Faits;


-----------------------------------------------------------------------------
--          MOTEUR D'INFERENCE
-----------------------------------------------------------------------------

        package Recherche_Pilote_1 is
           new Engine_Lru (Context_Name => "Pilote_1",
                           -- Resolution   => Context.Lru,
                           Used_Rules   => 1,
                           Name_1       => "Pilotes_35_747",
                           Condition_1  => Pilote_35_B747_C,
                           Action_1     => Pilote_35_B747_A);

        package Recherche_Pilote_2 is
           new Engine_Lru (Context_Name => "Pilote_2",
                           -- Resolution   => Context.Lru,
                           Used_Rules   => 1,
                           Name_1       => "Pilotes_747",
                           Condition_1  => Pilotes_747_C,
                           Action_1     => Pilotes_747_A);



-----------------------------------------------------------------------------
--
-----------------------------------------------------------------------------

        procedure Recherche_Des_Pilotes is
            Result : Boolean;
        begin
            Text_Io.Put_Line
               ("-------------------------------------------------");
            Creer_Faits;
            --Rulemanager.Mask (Context => "Pilote_1  ", Rule => 1);
            Result := Recherche_Pilote_1.Inference (Instance.Any);
            --Rulemanager.Unmask (Context => "Pilote_1  ", Rule => 1);
            Creer_Faits;
            Result := Recherche_Pilote_2.Inference (Instance.Any);
            Text_Io.Put_Line
               ("-------------------------------------------------");
        end Recherche_Des_Pilotes;


    end Pilotes_Et_Avions;



begin


    -- Debugger.Resetdebug (Debugger.Text);
    -- Debugger.Setdebugon (Debugger.Completly);
    -- Debugger.Refreshdebug;
    -- Debugger.Setdebugoff (Debugger.Conditionevalued);

    Pilotes_Et_Avions.Recherche_Des_Pilotes;

end Aeroport_Lru;


E3 Meta Data

    nblk1=9
    nid=6
    hdr6=10
        [0x00] rec0=21 rec1=00 rec2=01 rec3=048
        [0x01] rec0=00 rec1=00 rec2=08 rec3=004
        [0x02] rec0=1a rec1=00 rec2=03 rec3=020
        [0x03] rec0=01 rec1=00 rec2=07 rec3=00e
        [0x04] rec0=17 rec1=00 rec2=02 rec3=04c
        [0x05] rec0=1c rec1=00 rec2=09 rec3=078
        [0x06] rec0=19 rec1=00 rec2=04 rec3=03a
        [0x07] rec0=19 rec1=00 rec2=05 rec3=000
        [0x08] rec0=00 rec1=07 rec2=a0 rec3=000
    tail 0x2170df97c82484f6e509c 0x42a00088462063c03
Free Block Chain:
  0x6: 0000  00 00 02 9d 80 20 6c 6f 74 65 5f 31 2e 49 6e 66  ┆      lote_1.Inf┆