text
stringlengths
0
234
end if;
end loop;
if not Found then
Temp_Major_Pointer := new Relationship_Entry_Type;
Temp_Major_Pointer.Single := Single_Instance;
Temp_Major_Pointer.Completion_List := null;
Temp_Major_Pointer.Previous := null;
Temp_Major_Pointer.Next := The_Relationship_List;
if The_Relationship_List /= null then
The_Relationship_List.Previous := Temp_Major_Pointer;
end if;
The_Relationship_List := Temp_Major_Pointer;
end if;
Temp_Minor_Pointer := new Relationship_Pair_Type;
Temp_Minor_Pointer.Multiple := Multiple_Instance;
Temp_Minor_Pointer.Associative := Associative_Instance;
Temp_Minor_Pointer.Previous := null;
Temp_Minor_Pointer.Next := Temp_Major_Pointer.Completion_List;
if Temp_Major_Pointer.Completion_List /= null then
Temp_Major_Pointer.Completion_List.Previous := Temp_Minor_Pointer;
end if;
Temp_Major_Pointer.Completion_List := Temp_Minor_Pointer;
end Do_Link;
-----------------------------------------------------------------------
procedure Do_Unlink (
Left_Instance : in Root_Object.Object_Access;
Right_Instance : in Root_Object.Object_Access) is
Temp_Minor_Pointer : Relationship_Pair_Access_Type;
Temp_Major_Pointer : Relationship_Entry_Access_Type;
Delete_List : Boolean := False;
begin
Temp_Major_Pointer := The_Relationship_List;
Major_Loop:
while Temp_Major_Pointer /= null loop
if Temp_Major_Pointer.Single = Left_Instance then
Temp_Minor_Pointer := Temp_Major_Pointer.Completion_List;
Minor_Loop:
while Temp_Minor_Pointer /= null loop
if Temp_Minor_Pointer.Multiple = Right_Instance then
if Temp_Minor_Pointer.Previous = null then
--
-- first instance in list
--
Temp_Major_Pointer.Completion_List := Temp_Minor_Pointer.Next;
--
-- it's also the last and only instance in list
-- So we're going to delete the whole relationship instance
-- (but not just yet)
--
Delete_List := (Temp_Minor_Pointer.Next = null);
end if;
if Temp_Minor_Pointer.Next /= null then
--
-- there are more instances following in the list
--
Temp_Minor_Pointer.Next.Previous := Temp_Minor_Pointer.Previous;
end if;
if Temp_Minor_Pointer.Previous /= null then
--
-- there are more instances previous in the list
--
Temp_Minor_Pointer.Previous.Next := Temp_Minor_Pointer.Next;
end if;
Remove_Pair (Temp_Minor_Pointer);
exit Major_Loop;
end if;
Temp_Minor_Pointer := Temp_Minor_Pointer.Next;
end loop Minor_Loop;
end if;
Temp_Major_Pointer := Temp_Major_Pointer.Next;
end loop Major_Loop;
--
-- if needed, now delete the list