text stringlengths 0 234 |
|---|
elsif Class = M1_Side then |
M2_Single_M1_Multiple.Navigate ( |
From => From, |
Class => Class, |
To => To); |
end if; |
end if; |
end Navigate; |
--------------------------------------------------------------------- |
-- associative correlated navigation |
procedure Navigate ( |
From : in Root_Object.Object_Access; |
Also : in Root_Object.Object_Access; |
Class : in Ada.Tags.Tag; |
To : out Root_Object.Object_Access) is |
-- |
-- navigate from two singles to a single |
-- valid for: |
-- M1 and M2 -> A |
-- M1 and M2 -> A |
Temp_Associative_One, Temp_Associative_Two : Root_Object.Object_Access := null; |
Assoc_Set_One : Root_Object.Object_List.List_Header_Access_Type := Root_Object.Object_List.Initialise; |
Assoc_Set_Two : Root_Object.Object_List.List_Header_Access_Type := Root_Object.Object_List.Initialise; |
Matched, Inner_Matched : Boolean := FALSE; |
begin |
-- Reset the output pointer to null so that if we don't find anything |
-- useful, the caller can check for it. |
To := null; |
if ((( From.all'tag = M1_Side) and then |
( Also.all'Tag = M2_Side)) |
or else (( From.all'tag = M2_Side) and then |
( Also.all'Tag = M1_Side))) |
then |
-- Navigate from single instance of first object |
-- returns a set. |
Navigate ( |
From => Also, |
Class => Class, |
To => Assoc_Set_One); |
-- Navigate from single instance of second object |
-- returns a set. |
Navigate ( |
From => From, |
Class => Class, |
To => Assoc_Set_Two); |
-- Compare results of the two sets from the above navigations. |
-- A nice simple find operation on a set would be appropriate here, but |
-- there isn't one available, so do it the hard way. |
-- Outer loop |
declare |
use type Root_Object.Object_List.Node_Access_Type; |
Temp_Entry : Root_Object.Object_List.Node_Access_Type; |
Matched : boolean := FALSE; |
begin |
-- Grab the first entry of the set |
Temp_Entry := Root_Object.Object_List.First_Entry_Of(Assoc_Set_One); |
-- While the set is not empty and the entry does not match the |
-- assoc instance already found, burn rubber |
while (not Matched) and (Temp_Entry /= null) loop |
Temp_Associative_One := Temp_Entry.Item; |
-- Compare this entry against the other set. |
-- Inner loop |
declare |
use type Root_Object.Object_List.Node_Access_Type; |
Inner_Temp_Entry : Root_Object.Object_List.Node_Access_Type; |
begin |
-- Grab the first entry of the set |
Inner_Temp_Entry := Root_Object.Object_List.First_Entry_Of(Assoc_Set_Two); |
-- While the set is not empty and the entry does not match the |
-- assoc instance already found, smoke 'em |
while (not matched) and (Inner_Temp_Entry /= null) loop |
Temp_Associative_Two := Inner_Temp_Entry.Item; |
-- If M-M:M associative was ever implemented, |
-- it would be easy to add the matched instance into a set for |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.