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

⟦e13323c44⟧ TextFile

    Length: 33719 (0x83b7)
    Types: TextFile
    Names: »B«

Derivation

└─⟦149519bd4⟧ Bits:30000546 8mm tape, Rational 1000, !projects 93-07-13
    └─ ⟦124ff5788⟧ »DATA« 
        └─⟦this⟧ 
└─⟦f64eaa120⟧ Bits:30000752 8mm tape, Rational 1000, !projects 93 02 16
    └─ ⟦6f12a12be⟧ »DATA« 
        └─⟦this⟧ 

TextFile

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;