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

⟦7b131eca0⟧ Ada Source

    Length: 68608 (0x10c00)
    Types: Ada Source
    Notes: 03_class, FILE, Long Ada Source, R1k_Segment, e3_tag, package body Iterator, package body Tuple_Collection, seg_0115b0, seg_0117d3

Derivation

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

E3 Source Code



with Collection;
with Instance;
with Tuple;
with Unbounded_Array;

package body Tuple_Collection is


    package Unbounded_Tuple_Collection is
       new Unbounded_Array (Element => Tuple.Object,
                            Content => Tuple_Collection.Object);


    package Utc  renames Unbounded_Tuple_Collection;
    package Coll renames Collection;



------------------------------------------------------------------------------
    function Null_Object return Tuple_Collection.Object is
        A_Tuple_Collection : Tuple_Collection.Object (1 .. 0);
    begin
        return A_Tuple_Collection;
    end Null_Object;


------------------------------------------------------------------------------
    function Add (In_Tuple_Collection : Tuple_Collection.Object;
                  The_Tuple : Tuple.Object) return Tuple_Collection.Object is
    begin
        return In_Tuple_Collection & The_Tuple;
    end Add;


------------------------------------------------------------------------------
    function Cardinality  
                (Of_Tuple_Collection : Tuple_Collection.Object)
                return Natural is
    begin
        return Of_Tuple_Collection'Last - Of_Tuple_Collection'First + 1;
    end Cardinality;


------------------------------------------------------------------------------
    function Is_Null (The_Tuple_Collection : Tuple_Collection.Object)
                     return Boolean is
    begin
        return Cardinality (The_Tuple_Collection) = 0;
    end Is_Null;


------------------------------------------------------------------------------
    function Is_Not_Null (The_Tuple_Collection : Tuple_Collection.Object)
                         return Boolean is
    begin
        return Cardinality (The_Tuple_Collection) /= 0;
    end Is_Not_Null;


------------------------------------------------------------------------------
    procedure Clear (The_Tuple_Collection : in out Tuple_Collection.Object) is
        Result : Utc.Object;
    begin
        Result := Utc.Create (The_Tuple_Collection);
        Utc.Free (Result);
        The_Tuple_Collection := Utc.Get (Result);
    end Clear;


------------------------------------------------------------------------------
    function Get (In_Tuple_Collection : Tuple_Collection.Object;
                  The_Item            : Positive) return Tuple.Object is
        A_Tuple : Tuple.Object;
    begin  
        if Is_Not_Null (In_Tuple_Collection) and then
           (The_Item >= In_Tuple_Collection'First and
            The_Item <= In_Tuple_Collection'Last) then
            A_Tuple := In_Tuple_Collection (The_Item);
        end if;  
        return A_Tuple;
    end Get;


------------------------------------------------------------------------------
    function First (Of_Tuple_Collection : Tuple_Collection.Object)
                   return Tuple.Object is
        A_Tuple : Tuple.Object;
    begin
        if Is_Not_Null (Of_Tuple_Collection) then
            A_Tuple := Of_Tuple_Collection (Of_Tuple_Collection'First);
        end if;
        return A_Tuple;
    end First;



------------------------------------------------------------------------------
    function Get (The_Tuple_Collection : Tuple_Collection.Object;
                  From_Pos             : Positive;
                  To_Pos               : Positive)  
                 return Tuple_Collection.Object is
        A_Tuple_Collection : Tuple_Collection.Object
                                (1 .. Cardinality (The_Tuple_Collection));
        From_Limit         : Natural;
        To_Limit           : Natural;
    begin
        if To_Pos > The_Tuple_Collection'Last then
            To_Limit := The_Tuple_Collection'Last;
        else
            To_Limit := To_Pos;
        end if;
        if From_Pos < The_Tuple_Collection'First then
            From_Limit := The_Tuple_Collection'First;
        else
            From_Limit := From_Pos;
        end if;
        for I in From_Limit .. To_Limit loop
            A_Tuple_Collection (I - From_Limit + 1) := The_Tuple_Collection (I);
        end loop;
        return A_Tuple_Collection (1 .. To_Limit - From_Limit + 1);
    end Get;



------------------------------------------------------------------------------
    procedure For_All (The_Tuple_Collection : Tuple_Collection.Object) is
        procedure Action_Tuple is new Tuple.For_All (Action);
    begin
        for I in The_Tuple_Collection'First .. The_Tuple_Collection'Last loop
            Action_Tuple (The_Tuple_Collection (I));
        end loop;
    end For_All;


------------------------------------------------------------------------------
    function The_Most (Of_Tuple_Collection : Tuple_Collection.Object)
                      return Tuple.Object is
        Most_Tuple : Tuple.Object;
    begin       if Is_Not_Null (Of_Tuple_Collection) then
            Most_Tuple := First (Of_Tuple_Collection);
            for I in Of_Tuple_Collection'First + 1 ..
                        Of_Tuple_Collection'Last loop
                if not Predicate (Most_Tuple, Of_Tuple_Collection (I)) then
                    Most_Tuple := Of_Tuple_Collection (I);
                end if;
            end loop;
        end if;
        return Most_Tuple;
    end The_Most;


------------------------------------------------------------------------------
    function Find_One (In_Tuple_Collection : Tuple_Collection.Object)
                      return Tuple.Object is
        A_Tuple : Tuple.Object;
    begin
        if Is_Not_Null (In_Tuple_Collection) then
            for I in In_Tuple_Collection'First .. In_Tuple_Collection'Last loop
                if Predicate (In_Tuple_Collection (I)) then
                    A_Tuple := In_Tuple_Collection (I);
                    exit;
                end if;
            end loop;
        end if;
        return A_Tuple;
    end Find_One;



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

    function Join_1 return Tuple_Collection.Object is
        Result : Utc.Object;
        R1     : Instance.Reference;
        function Res1 is new Collection.Restrict (Restrict_1);
    begin  
        for I in Res1 (Collection_1)'First .. Res1 (Collection_1)'Last loop
            R1 := Coll.Get (In_Collection => Res1 (Collection_1),
                            The_Position  => I);
            if Match (R1) then
                declare
                    A_Tuple : Tuple.Object;
                begin
                    A_Tuple := Tuple.Object_To_Tuple (R1);
                    Result  := Utc."&" (Result, A_Tuple);
                end;
                if (With_Quantity /= Instance.Any) and then
                   (Utc.Length (Result) >= With_Quantity) then
                    exit;
                end if;
            end if;
        end loop;
        declare
            A_Tuple_Collection : constant Tuple_Collection.Object :=
               Utc.Get (Result);
        begin
            Utc.Free (Result);
            return A_Tuple_Collection;
        end;
    end Join_1;



    function Join_2 return Tuple_Collection.Object is
        R1, R2 : Instance.Reference;
        Result : Utc.Object;
        function Res1 is new Collection.Restrict (Restrict_1);
        function Res2 is new Collection.Restrict (Restrict_2);
    begin
        for I in Res1 (Collection_1)'First .. Res1 (Collection_1)'Last loop
            R1 := Coll.Get (Res1 (Collection_1), I);
            for J in Res2 (Collection_2)'First .. Res2 (Collection_2)'Last loop
                R2 := Coll.Get (Res2 (Collection_2), J);
                if Match (R1, R2) then
                    declare
                        A_Tuple : Tuple.Object;
                    begin
                        Tuple.Merge (A_Tuple, 2, R1, R2);
                        Result := Utc."&" (Result, A_Tuple);
                    end;
                    if (With_Quantity /= Instance.Any) and then
                       (Utc.Length (Result) >= With_Quantity) then
                        exit;
                    end if;
                end if;
            end loop;
        end loop;
        declare
            A_Tuple_Collection : constant Tuple_Collection.Object :=
               Utc.Get (Result);
        begin
            Utc.Free (Result);
            return A_Tuple_Collection;
        end;
    end Join_2;


    function Join_3 return Tuple_Collection.Object is
        R1, R2, R3 : Instance.Reference;
        Result     : Utc.Object;
        function Res1 is new Collection.Restrict (Restrict_1);
        function Res2 is new Collection.Restrict (Restrict_2);
        function Res3 is new Collection.Restrict (Restrict_3);
    begin
        for I in Res1 (Collection_1)'First .. Res1 (Collection_1)'Last loop
            R1 := Coll.Get (Res1 (Collection_1), The_Position => I);
            for J in Res2 (Collection_2)'First .. Res2 (Collection_2)'Last loop
                R2 := Coll.Get (Res2 (Collection_2), The_Position => J);
                for K in Res3 (Collection_3)'First ..
                            Res3 (Collection_3)'Last loop
                    R3 := Coll.Get (Res3 (Collection_3), The_Position => K);
                    if Match (R1, R2, R3) then
                        declare
                            A_Tuple : Tuple.Object;
                        begin
                            Tuple.Merge (A_Tuple, 3, R1, R2, R3);
                            Result := Utc."&" (Result, A_Tuple);
                        end;
                        if (With_Quantity /= Instance.Any) and then
                           (Utc.Length (Result) >= With_Quantity) then
                            exit;
                        end if;
                    end if;
                end loop;
            end loop;
        end loop;
        declare
            A_Tuple_Collection : constant Tuple_Collection.Object :=
               Utc.Get (Result);
        begin
            Utc.Free (Result);
            return A_Tuple_Collection;
        end;
    end Join_3;


    function Join_4 return Tuple_Collection.Object is
        R1, R2, R3, R4 : Instance.Reference;
        Result         : Utc.Object;
        function Res1 is new Collection.Restrict (Restrict_1);
        function Res2 is new Collection.Restrict (Restrict_2);
        function Res3 is new Collection.Restrict (Restrict_3);
        function Res4 is new Collection.Restrict (Restrict_4);
    begin
        for I in Res1 (Collection_1)'First .. Res1 (Collection_1)'Last loop
            R1 := Coll.Get (Res1 (Collection_1), The_Position => I);
            for J in Res2 (Collection_2)'First .. Res2 (Collection_2)'Last loop
                R2 := Coll.Get (Res2 (Collection_2), J);
                for K in Res3 (Collection_3)'First ..
                            Res3 (Collection_3)'Last loop
                    R3 := Coll.Get (Res3 (Collection_3), K);
                    for L in Res4 (Collection_4)'First ..
                                Res4 (Collection_4)'Last loop
                        R4 := Coll.Get (Res4 (Collection_4), L);
                        if Match (R1, R2, R3, R4) then
                            declare
                                A_Tuple : Tuple.Object;
                            begin
                                Tuple.Merge (A_Tuple, 4, R1, R2, R3, R4);
                                Result := Utc."&" (Result, A_Tuple);
                            end;
                            if (With_Quantity /= Instance.Any) and then
                               (Utc.Length (Result) >= With_Quantity) then
                                exit;
                            end if;
                        end if;
                    end loop;
                end loop;
            end loop;
        end loop;
        declare
            A_Tuple_Collection : constant Tuple_Collection.Object :=
               Utc.Get (Result);
        begin
            Utc.Free (Result);
            return A_Tuple_Collection;
        end;
    end Join_4;


    function Join_5 return Tuple_Collection.Object is
        R1, R2, R3, R4, R5 : Instance.Reference;
        Result             : Utc.Object;
        function Res1 is new Collection.Restrict (Restrict_1);
        function Res2 is new Collection.Restrict (Restrict_2);
        function Res3 is new Collection.Restrict (Restrict_3);
        function Res4 is new Collection.Restrict (Restrict_4);
        function Res5 is new Collection.Restrict (Restrict_5);
    begin
        for I in Res1 (Collection_1)'First .. Res1 (Collection_1)'Last loop
            R1 := Coll.Get (Res1 (Collection_1), The_Position => I);
            for J in Res2 (Collection_2)'First .. Res2 (Collection_2)'Last loop
                R2 := Coll.Get (Res2 (Collection_2), J);
                for K in Res3 (Collection_3)'First ..
                            Res3 (Collection_3)'Last loop
                    R3 := Coll.Get (Res3 (Collection_3), K);
                    for L in Res4 (Collection_4)'First ..
                                Res4 (Collection_4)'Last loop
                        R4 := Coll.Get (Res4 (Collection_4), L);
                        for M in Res5 (Collection_5)'First ..
                                    Res5 (Collection_5)'Last loop
                            R5 := Coll.Get (Res5 (Collection_5), M);
                            if Match (R1, R2, R3, R4, R5) then
                                declare
                                    A_Tuple : Tuple.Object;
                                begin
                                    Tuple.Merge (A_Tuple, 5, R1,
                                                 R2, R3, R4, R5);
                                    Result := Utc."&" (Result, A_Tuple);
                                end;
                                if (With_Quantity /= Instance.Any) and then
                                   (Utc.Length (Result) >= With_Quantity) then
                                    exit;
                                end if;
                            end if;
                        end loop;
                    end loop;
                end loop;
            end loop;
        end loop;
        declare
            A_Tuple_Collection : constant Tuple_Collection.Object :=
               Utc.Get (Result);
        begin
            Utc.Free (Result);
            return A_Tuple_Collection;
        end;
    end Join_5;


    function Join_6 return Tuple_Collection.Object is
        R1, R2, R3, R4, R5, R6 : Instance.Reference;
        Result                 : Utc.Object;
        function Res1 is new Collection.Restrict (Restrict_1);
        function Res2 is new Collection.Restrict (Restrict_2);
        function Res3 is new Collection.Restrict (Restrict_3);
        function Res4 is new Collection.Restrict (Restrict_4);
        function Res5 is new Collection.Restrict (Restrict_5);
        function Res6 is new Collection.Restrict (Restrict_6);
    begin
        for I in Res1 (Collection_1)'First .. Res1 (Collection_1)'Last loop
            R1 := Coll.Get (Res1 (Collection_1), The_Position => I);
            for J in Res2 (Collection_2)'First .. Res2 (Collection_2)'Last loop
                R2 := Coll.Get (Res2 (Collection_2), J);
                for K in Res3 (Collection_3)'First ..
                            Res3 (Collection_3)'Last loop
                    R3 := Coll.Get (Res3 (Collection_3), K);
                    for L in Res4 (Collection_4)'First ..
                                Res4 (Collection_4)'Last loop
                        R4 := Coll.Get (Res4 (Collection_4), L);
                        for M in Res5 (Collection_5)'First ..
                                    Res5 (Collection_5)'Last loop
                            R5 := Coll.Get (Res5 (Collection_5), M);
                            for N in Res6 (Collection_6)'First ..
                                        Res6 (Collection_6)'Last loop
                                R6 := Coll.Get (Res6 (Collection_6), N);
                                if Match (R1, R2, R3, R4, R5, R6) then
                                    declare
                                        A_Tuple : Tuple.Object;
                                    begin
                                        Tuple.Merge (A_Tuple, 6, R1, R2,
                                                     R3, R4, R5, R6);
                                        Result := Utc."&" (Result, A_Tuple);
                                    end;
                                    if (With_Quantity /= Instance.Any) and then
                                       (Utc.Length (Result) >=
                                        With_Quantity) then
                                        exit;
                                    end if;
                                end if;
                            end loop;
                        end loop;
                    end loop;
                end loop;
            end loop;
        end loop;
        declare
            A_Tuple_Collection : constant Tuple_Collection.Object :=
               Utc.Get (Result);
        begin
            Utc.Free (Result);
            return A_Tuple_Collection;
        end;
    end Join_6;


    function Join_7 return Tuple_Collection.Object is
        R1, R2, R3, R4, R5, R6, R7 : Instance.Reference;
        Result                     : Utc.Object;
        function Res1 is new Collection.Restrict (Restrict_1);
        function Res2 is new Collection.Restrict (Restrict_2);
        function Res3 is new Collection.Restrict (Restrict_3);
        function Res4 is new Collection.Restrict (Restrict_4);
        function Res5 is new Collection.Restrict (Restrict_5);
        function Res6 is new Collection.Restrict (Restrict_6);
        function Res7 is new Collection.Restrict (Restrict_7);
    begin
        for I in Res1 (Collection_1)'First .. Res1 (Collection_1)'Last loop
            R1 := Coll.Get (Res1 (Collection_1), The_Position => I);
            for J in Res2 (Collection_2)'First .. Res2 (Collection_2)'Last loop
                R2 := Coll.Get (Res2 (Collection_2), J);
                for K in Res3 (Collection_3)'First ..
                            Res3 (Collection_3)'Last loop
                    R3 := Coll.Get (Res3 (Collection_3), K);
                    for L in Res4 (Collection_4)'First ..
                                Res4 (Collection_4)'Last loop
                        R4 := Coll.Get (Res4 (Collection_4), L);
                        for M in Res5 (Collection_5)'First ..
                                    Res5 (Collection_5)'Last loop
                            R5 := Coll.Get (Res5 (Collection_5), M);
                            for N in Res6 (Collection_6)'First ..
                                        Res6 (Collection_6)'Last loop
                                R6 := Coll.Get (Res6 (Collection_6), N);
                                for P in Res7 (Collection_7)'First ..
                                            Res7 (Collection_7)'Last loop
                                    R7 := Coll.Get (Res7 (Collection_7), P);
                                    if Match (R1, R2, R3, R4, R5, R6, R7) then
                                        declare
                                            A_Tuple : Tuple.Object;
                                        begin
                                            Tuple.Merge (A_Tuple, 7, R1, R2,
                                                         R3, R4, R5, R6, R7);
                                            Result := Utc."&" (Result, A_Tuple);
                                        end;
                                        if (With_Quantity /=
                                            Instance.Any) and then
                                           (Utc.Length (Result) >=
                                            With_Quantity) then
                                            exit;
                                        end if;
                                    end if;
                                end loop;
                            end loop;
                        end loop;
                    end loop;
                end loop;
            end loop;
        end loop;
        declare
            A_Tuple_Collection : constant Tuple_Collection.Object :=
               Utc.Get (Result);
        begin
            Utc.Free (Result);
            return A_Tuple_Collection;
        end;
    end Join_7;


    function Join_8 return Tuple_Collection.Object is
        R1, R2, R3, R4, R5, R6, R7, R8 : Instance.Reference;
        Result                         : Utc.Object;
        function Res1 is new Collection.Restrict (Restrict_1);
        function Res2 is new Collection.Restrict (Restrict_2);
        function Res3 is new Collection.Restrict (Restrict_3);
        function Res4 is new Collection.Restrict (Restrict_4);
        function Res5 is new Collection.Restrict (Restrict_5);
        function Res6 is new Collection.Restrict (Restrict_6);
        function Res7 is new Collection.Restrict (Restrict_7);
        function Res8 is new Collection.Restrict (Restrict_8);
    begin
        for I in Res1 (Collection_1)'First .. Res1 (Collection_1)'Last loop
            R1 := Coll.Get (Res1 (Collection_1), The_Position => I);
            for J in Res2 (Collection_2)'First .. Res2 (Collection_2)'Last loop
                R2 := Coll.Get (Res2 (Collection_2), J);
                for K in Res3 (Collection_3)'First ..
                            Res3 (Collection_3)'Last loop
                    R3 := Coll.Get (Res3 (Collection_3), K);
                    for L in Res4 (Collection_4)'First ..
                                Res4 (Collection_4)'Last loop
                        R4 := Coll.Get (Res4 (Collection_4), L);
                        for M in Res5 (Collection_5)'First ..
                                    Res5 (Collection_5)'Last loop
                            R5 := Coll.Get (Res5 (Collection_5), M);
                            for N in Res6 (Collection_6)'First ..
                                        Res6 (Collection_6)'Last loop
                                R6 := Coll.Get (Res6 (Collection_6), N);
                                for P in Res7 (Collection_7)'First ..
                                            Res7 (Collection_7)'Last loop
                                    R7 := Coll.Get (Res7 (Collection_7), P);
                                    for Q in Res8 (Collection_8)'First ..
                                                Res8 (Collection_8)'Last loop
                                        R8 := Coll.Get (Res8 (Collection_8), Q);
                                        if Match (R1, R2, R3, R4, R5,
                                                  R6, R7, R8) then
                                            declare
                A_Tuple : Tuple.Object;
                                            begin
                Tuple.Merge (A_Tuple, 8, R1, R2, R3, R4, R5, R6, R7, R8);
                Result := Utc."&" (Result, A_Tuple);
                                            end;
                                            if (With_Quantity /=
                                                Instance.Any) and then
                                               (Utc.Length (Result) >=
                                                With_Quantity) then
                exit;
                                            end if;
                                        end if;
                                    end loop;
                                end loop;
                            end loop;
                        end loop;
                    end loop;
                end loop;
            end loop;
        end loop;
        declare
            A_Tuple_Collection : constant Tuple_Collection.Object :=
               Utc.Get (Result);
        begin
            Utc.Free (Result);
            return A_Tuple_Collection;
        end;
    end Join_8;


    function Join_9 return Tuple_Collection.Object is
        R1, R2, R3, R4, R5, R6, R7, R8, R9 : Instance.Reference;
        Result                             : Utc.Object;
        function Res1 is new Collection.Restrict (Restrict_1);
        function Res2 is new Collection.Restrict (Restrict_2);
        function Res3 is new Collection.Restrict (Restrict_3);
        function Res4 is new Collection.Restrict (Restrict_4);
        function Res5 is new Collection.Restrict (Restrict_5);
        function Res6 is new Collection.Restrict (Restrict_6);
        function Res7 is new Collection.Restrict (Restrict_7);
        function Res8 is new Collection.Restrict (Restrict_8);
        function Res9 is new Collection.Restrict (Restrict_9);
    begin
        for I in Res1 (Collection_1)'First .. Res1 (Collection_1)'Last loop
            R1 := Coll.Get (Res1 (Collection_1), The_Position => I);
            for J in Res2 (Collection_2)'First .. Res2 (Collection_2)'Last loop
                R2 := Coll.Get (Res2 (Collection_2), J);
                for K in Res3 (Collection_3)'First ..
                            Res3 (Collection_3)'Last loop
                    R3 := Coll.Get (Res3 (Collection_3), K);
                    for L in Res4 (Collection_4)'First ..
                                Res4 (Collection_4)'Last loop
                        R4 := Coll.Get (Res4 (Collection_4), L);
                        for M in Res5 (Collection_5)'First ..
                                    Res5 (Collection_5)'Last loop
                            R5 := Coll.Get (Res5 (Collection_5), M);
                            for N in Res6 (Collection_6)'First ..
                                        Res6 (Collection_6)'Last loop
                                R6 := Coll.Get (Res6 (Collection_6), N);
                                for P in Res7 (Collection_7)'First ..
                                            Res7 (Collection_7)'Last loop
                                    R7 := Coll.Get (Res7 (Collection_7), P);
                                    for Q in Res8 (Collection_8)'First ..
                                                Res8 (Collection_8)'Last loop
                                        R8 := Coll.Get (Res8 (Collection_8), Q);
                                        for R in Res9 (Collection_9)'First ..
                                                    Res9 (Collection_9)'
                                                       Last loop
                                            R9 := Coll.Get
                                                     (Res9 (Collection_9), R);
                                            if Match (R1, R2, R3, R4, R5,
                                                      R6, R7, R8, R9) then
                declare
                    A_Tuple : Tuple.Object;
                begin
                    Tuple.Merge (A_Tuple, 9, R1, R2, R3,
                                 R4, R5, R6, R7, R8, R9);
                    Result := Utc."&" (Result, A_Tuple);
                end;
                if (With_Quantity /= Instance.Any) and then
                   (Utc.Length (Result) >= With_Quantity) then
                    exit;
                end if;
                                            end if;
                                        end loop;
                                    end loop;
                                end loop;
                            end loop;
                        end loop;
                    end loop;
                end loop;
            end loop;
        end loop;
        declare
            A_Tuple_Collection : constant Tuple_Collection.Object :=
               Utc.Get (Result);
        begin
            Utc.Free (Result);
            return A_Tuple_Collection;
        end;
    end Join_9;


    function Join_10 return Tuple_Collection.Object is
        R1, R2, R3, R4, R5, R6, R7, R8, R9, R10 : Instance.Reference;
        Result : Utc.Object;
        function Res1  is new Collection.Restrict (Restrict_1);
        function Res2  is new Collection.Restrict (Restrict_2);
        function Res3  is new Collection.Restrict (Restrict_3);
        function Res4  is new Collection.Restrict (Restrict_4);
        function Res5  is new Collection.Restrict (Restrict_5);
        function Res6  is new Collection.Restrict (Restrict_6);
        function Res7  is new Collection.Restrict (Restrict_7);
        function Res8  is new Collection.Restrict (Restrict_8);
        function Res9  is new Collection.Restrict (Restrict_9);
        function Res10 is new Collection.Restrict (Restrict_10);
    begin
        for I in Res1 (Collection_1)'First .. Res1 (Collection_1)'Last loop
            R1 := Coll.Get (Res1 (Collection_1), The_Position => I);
            for J in Res2 (Collection_2)'First .. Res2 (Collection_2)'Last loop
                R2 := Coll.Get (Res2 (Collection_2), J);
                for K in Res3 (Collection_3)'First ..
                            Res3 (Collection_3)'Last loop
                    R3 := Coll.Get (Res3 (Collection_3), K);
                    for L in Res4 (Collection_4)'First ..
                                Res4 (Collection_4)'Last loop
                        R4 := Coll.Get (Res4 (Collection_4), L);
                        for M in Res5 (Collection_5)'First ..
                                    Res5 (Collection_5)'Last loop
                            R5 := Coll.Get (Res5 (Collection_5), M);
                            for N in Res6 (Collection_6)'First ..
                                        Res6 (Collection_6)'Last loop
                                R6 := Coll.Get (Res6 (Collection_6), N);
                                for P in Res7 (Collection_7)'First ..
                                            Res7 (Collection_7)'Last loop
                                    R7 := Coll.Get (Res7 (Collection_7), P);
                                    for Q in Res8 (Collection_8)'First ..
                                                Res8 (Collection_8)'Last loop
                                        R8 := Coll.Get (Res8 (Collection_8), Q);
                                        for R in Res9 (Collection_9)'First ..
                                                    Res9 (Collection_9)'
                                                       Last loop
                                            R9 := Coll.Get
                                                     (Res9 (Collection_9), R);
                                            for S in
                                               Res10 (Collection_10)'First ..
                                                  Res10 (Collection_10)'
                                                     Last loop
                R10 := Coll.Get (Res10 (Collection_10), S);
                if Match (R1, R2, R3, R4, R5, R6, R7, R8, R9, R10) then
                    declare
                        A_Tuple : Tuple.Object;
                    begin
                        Tuple.Merge (A_Tuple, 10, R1, R2, R3, R4,
                                     R5, R6, R7, R8, R9, R10);
                        Result := Utc."&" (Result, A_Tuple);
                    end;
                    if (With_Quantity /= Instance.Any) and then
                       (Utc.Length (Result) >= With_Quantity) then
                        exit;
                    end if;
                end if;
                                            end loop;
                                        end loop;
                                    end loop;
                                end loop;
                            end loop;
                        end loop;
                    end loop;
                end loop;
            end loop;
        end loop;
        declare
            A_Tuple_Collection : constant Tuple_Collection.Object :=
               Utc.Get (Result);
        begin
            Utc.Free (Result);
            return A_Tuple_Collection;
        end;
    end Join_10;


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

    package body Iterator is
        function Open (The_Tuple_Collection : Tuple_Collection.Object)
                      return Iterator is
        begin
            if Is_Null (The_Tuple_Collection) then
                return 0;
            else
                return Iterator (The_Tuple_Collection'First);
            end if;
        end Open;


        function Get (Of_Tuple_Collection : Tuple_Collection.Object;
                      With_Iterator       : Iterator) return Tuple.Object is
        begin
            if With_Iterator > Iterator (Of_Tuple_Collection'Last) or
               With_Iterator < Iterator (Of_Tuple_Collection'First) then
                raise Illegal_Access;
            else  
                return Of_Tuple_Collection (Positive (With_Iterator));
            end if;
        exception
            when Constraint_Error =>
                raise Illegal_Access;
        end Get;


        function Next (Of_Tuple_Collection : Tuple_Collection.Object;
                       The_Iterator        : Iterator) return Iterator is
            Index : Positive;
        begin
            Index := Positive (The_Iterator) + 1;
            if Index < Of_Tuple_Collection'First or
               Index > Of_Tuple_Collection'Last then
                return 0;
            else
                return Iterator (Index);
            end if;
        exception
            when Constraint_Error =>
                raise Illegal_Access;
        end Next;


        function At_End (Of_Tuple_Collection : Tuple_Collection.Object;
                         With_Iterator       : Iterator) return Boolean is
        begin
            return With_Iterator = 0;
        end At_End;
    end Iterator;


end Tuple_Collection;

E3 Meta Data

    nblk1=42
    nid=3b
    hdr6=50
        [0x00] rec0=23 rec1=00 rec2=01 rec3=000
        [0x01] rec0=1b rec1=00 rec2=07 rec3=026
        [0x02] rec0=19 rec1=00 rec2=18 rec3=04e
        [0x03] rec0=1b rec1=00 rec2=23 rec3=00e
        [0x04] rec0=00 rec1=00 rec2=2d rec3=014
        [0x05] rec0=1b rec1=00 rec2=1e rec3=002
        [0x06] rec0=17 rec1=00 rec2=21 rec3=00e
        [0x07] rec0=1b rec1=00 rec2=1b rec3=01e
        [0x08] rec0=1c rec1=00 rec2=22 rec3=022
        [0x09] rec0=1b rec1=00 rec2=3e rec3=00e
        [0x0a] rec0=11 rec1=00 rec2=2f rec3=042
        [0x0b] rec0=19 rec1=00 rec2=40 rec3=04c
        [0x0c] rec0=11 rec1=00 rec2=04 rec3=038
        [0x0d] rec0=1b rec1=00 rec2=14 rec3=018
        [0x0e] rec0=0d rec1=00 rec2=20 rec3=00e
        [0x0f] rec0=16 rec1=00 rec2=0e rec3=006
        [0x10] rec0=10 rec1=00 rec2=0b rec3=00e
        [0x11] rec0=0f rec1=00 rec2=11 rec3=02a
        [0x12] rec0=12 rec1=00 rec2=24 rec3=018
        [0x13] rec0=18 rec1=00 rec2=39 rec3=08e
        [0x14] rec0=01 rec1=00 rec2=06 rec3=016
        [0x15] rec0=0f rec1=00 rec2=25 rec3=038
        [0x16] rec0=0f rec1=00 rec2=12 rec3=01a
        [0x17] rec0=1a rec1=00 rec2=3d rec3=048
        [0x18] rec0=10 rec1=00 rec2=42 rec3=070
        [0x19] rec0=02 rec1=00 rec2=17 rec3=044
        [0x1a] rec0=0f rec1=00 rec2=28 rec3=014
        [0x1b] rec0=16 rec1=00 rec2=0a rec3=02c
        [0x1c] rec0=14 rec1=00 rec2=26 rec3=088
        [0x1d] rec0=0c rec1=00 rec2=19 rec3=00a
        [0x1e] rec0=0d rec1=00 rec2=1d rec3=074
        [0x1f] rec0=17 rec1=00 rec2=1f rec3=00a
        [0x20] rec0=16 rec1=00 rec2=15 rec3=07a
        [0x21] rec0=11 rec1=00 rec2=3a rec3=004
        [0x22] rec0=00 rec1=00 rec2=16 rec3=086
        [0x23] rec0=0e rec1=00 rec2=03 rec3=072
        [0x24] rec0=14 rec1=00 rec2=10 rec3=010
        [0x25] rec0=18 rec1=00 rec2=13 rec3=022
        [0x26] rec0=1b rec1=00 rec2=0c rec3=044
        [0x27] rec0=15 rec1=00 rec2=08 rec3=000
        [0x28] rec0=15 rec1=00 rec2=08 rec3=000
        [0x29] rec0=0e rec1=00 rec2=03 rec3=072
        [0x2a] rec0=13 rec1=00 rec2=10 rec3=038
        [0x2b] rec0=15 rec1=00 rec2=13 rec3=022
        [0x2c] rec0=1b rec1=00 rec2=0c rec3=044
        [0x2d] rec0=15 rec1=00 rec2=08 rec3=000
        [0x2e] rec0=15 rec1=00 rec2=08 rec3=000
        [0x2f] rec0=10 rec1=00 rec2=03 rec3=040
        [0x30] rec0=0e rec1=00 rec2=0d rec3=076
        [0x31] rec0=1b rec1=00 rec2=13 rec3=022
        [0x32] rec0=1b rec1=00 rec2=0c rec3=044
        [0x33] rec0=15 rec1=00 rec2=08 rec3=000
        [0x34] rec0=0e rec1=00 rec2=0d rec3=076
        [0x35] rec0=1b rec1=00 rec2=13 rec3=022
        [0x36] rec0=1b rec1=00 rec2=0c rec3=044
        [0x37] rec0=15 rec1=00 rec2=08 rec3=000
        [0x38] rec0=00 rec1=00 rec2=01 rec3=000
        [0x39] rec0=00 rec1=00 rec2=10 rec3=001
        [0x3a] rec0=91 rec1=90 rec2=00 rec3=000
        [0x3b] rec0=00 rec1=0c rec2=80 rec3=000
        [0x3c] rec0=00 rec1=00 rec2=00 rec3=000
        [0x3d] rec0=00 rec1=00 rec2=00 rec3=000
        [0x3e] rec0=00 rec1=00 rec2=00 rec3=000
        [0x3f] rec0=00 rec1=00 rec2=00 rec3=000
        [0x40] rec0=00 rec1=00 rec2=00 rec3=000
        [0x41] rec0=00 rec1=00 rec2=00 rec3=000
    tail 0x2170cf62a82334c197db2 0x42a00088462063c03
Free Block Chain:
  0x3b: 0000  00 3f 00 06 80 03 74 5f 33 03 20 20 20 20 20 20  ┆ ?    t_3       ┆
  0x3f: 0000  00 09 00 06 80 03 20 20 20 03 6f 6c 6c 65 63 74  ┆          ollect┆
  0x9: 0000  00 0f 00 0d 80 0a 6e 2e 52 65 73 74 72 69 63 74  ┆      n.Restrict┆
  0xf: 0000  00 3c 00 7a 80 35 6e 63 74 69 6f 6e 20 52 65 73  ┆ < z 5nction Res┆
  0x3c: 0000  00 29 03 fc 80 34 20 20 20 20 20 20 20 20 20 20  ┆ )   4          ┆
  0x29: 0000  00 2a 03 fc 80 35 6e 63 74 69 6f 6e 20 52 65 73  ┆ *   5nction Res┆
  0x2a: 0000  00 27 00 08 80 05 74 69 74 79 20 05 79 20 08 5f  ┆ '    tity  y  _┆
  0x27: 0000  00 1c 03 fc 80 35 20 20 20 20 20 20 20 20 20 20  ┆     5          ┆
  0x1c: 0000  00 05 03 fc 80 2f 6f 6c 6c 2e 67 65 74 28 72 65  ┆     /oll.get(re┆
  0x5: 0000  00 0d 03 fc 80 0c 74 69 6f 6e 5f 35 29 2c 20 4d  ┆      tion_5), M┆
  0xd: 0000  00 02 03 fc 80 4a 20 20 20 20 20 20 20 66 6f 72  ┆     J       for┆
  0x2: 0000  00 1a 03 fc 80 38 20 20 20 20 20 20 20 20 20 20  ┆     8          ┆
  0x1a: 0000  00 35 03 e0 80 29 20 20 20 20 20 20 20 20 20 20  ┆ 5   )          ┆
  0x35: 0000  00 2c 03 fc 80 22 20 20 20 20 20 20 20 20 20 20  ┆ ,   "          ┆
  0x2c: 0000  00 30 00 22 80 0e 20 20 20 20 20 20 20 20 20 65  ┆ 0 "           e┆
  0x30: 0000  00 32 00 23 80 20 3d 20 43 67 65 74 20 28 52 65  ┆ 2 #  = Cget (Re┆
  0x32: 0000  00 33 00 18 80 15 69 6e 20 31 20 2e 2e 20 43 61  ┆ 3    in 1 .. Ca┆
  0x33: 0000  00 2e 00 3d 80 03 69 66 3b 03 00 28 20 20 20 20  ┆ . =  if;  (    ┆
  0x2e: 0000  00 2b 00 22 80 13 20 20 20 20 20 20 20 20 20 20  ┆ + "            ┆
  0x2b: 0000  00 37 00 0c 80 09 20 20 20 20 20 20 20 20 20 09  ┆ 7              ┆
  0x37: 0000  00 36 03 fc 80 12 46 6f 72 5f 51 75 61 6e 74 69  ┆ 6    For_Quanti┆
  0x36: 0000  00 34 00 07 80 04 20 3e 3d 20 04 20 20 20 20 20  ┆ 4     >=       ┆
  0x34: 0000  00 38 00 2e 80 1e 43 67 65 74 20 28 52 65 73 35  ┆ 8 .  Cget (Res5┆
  0x38: 0000  00 31 00 40 80 30 20 20 20 20 20 20 20 20 20 20  ┆ 1 @ 0          ┆
  0x31: 0000  00 41 00 07 80 04 20 20 20 20 04 20 20 28 55 74  ┆ A           (Ut┆
  0x41: 0000  00 00 00 66 80 15 20 20 20 69 66 20 4d 61 74 63  ┆   f     if Matc┆