|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - download
Length: 8192 (0x2000) Types: Ada Source Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Set_Of_Connections, seg_0421b0
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000 └─ ⟦cfc2e13cd⟧ »Space Info Vol 2« └─⟦this⟧
with Binary_Trees_Pkg, Bounded_String, Text_Io; use Bounded_String; package body Set_Of_Connections is Lower : constant Integer := -1; Equal : constant Integer := 0; Upper : constant Integer := 1; -- ---------------------------------------------------- -- Definition des fonctions pour le paquetage generique -- ---------------------------------------------------- function Compare (A, B : Connection) return Integer is begin if Image (A.Source) = Image (B.Source) and Image (A.Destination) = Image (B.Destination) and Image (A.Qualification) = Image (B.Qualification) then return Equal; else if Image (A.Source) < Image (B.Source) then return Lower; else return Upper; end if; end if; end Compare; procedure Write (A : Connection) is begin Text_Io.Put_Line ("Source ->" & Image (A.Source) & " / Destination ->" & Image (A.Destination) & " / Qualification ->" & Image (A.Qualification) & " / State ->" & Lock'Image (A.State)); end Write; procedure Show is new Connections_Tree.Visit (Write); -- --------------------------------------- -- Definition des fontions de Set_of_Connections -- --------------------------------------- function Make_Connection (Scr_Item, Dst_Item, Qualif : String; Connection_State : Lock) return Connection is Tmp_Connection : Connection; begin Bounded_String.Free (Tmp_Connection.Source); Bounded_String.Free (Tmp_Connection.Destination); Bounded_String.Free (Tmp_Connection.Qualification); Bounded_String.Copy (Tmp_Connection.Source, Scr_Item); Bounded_String.Copy (Tmp_Connection.Destination, Dst_Item); Bounded_String.Copy (Tmp_Connection.Qualification, Qualif); Tmp_Connection.State := Connection_State; return Tmp_Connection; end Make_Connection; procedure Create (Set : in out Object) is begin Set.Root := Connections_Tree.Create; end Create; procedure Destroy (Set : in out Object) is begin Connections_Tree.Destroy (Set.Root); end Destroy; procedure Add_New (Src_Item, Dst_Item, Qualif : String; Connection_State : Lock; Set : in out Object) is Tmp_Connection : Connection; begin Tmp_Connection := Make_Connection (Src_Item, Dst_Item, Qualif, Connection_State); Connections_Tree.Insert (Tmp_Connection, Set.Root); exception when Connections_Tree.Duplicate_Value => raise Duplicate_Value; end Add_New; procedure Search_For (Src_Item, Qualif : String; Result_Connection : out Connection; Result : out Boolean; Set : Object) is Found_Connection : Connection; Set_Iter : Connections_Tree.Iterator; begin Result := False; Set_Iter := Connections_Tree.Make_Iter (Set.Root); while Connections_Tree.More (Set_Iter) loop Connections_Tree.Next (Set_Iter, Found_Connection); if Image (Found_Connection.Source) = Src_Item and Image (Found_Connection.Qualification) = Qualif then Result_Connection := Found_Connection; Result := True; end if; end loop; end Search_For; procedure Modify_State (Src_Item, Qualif : String; Connection_State : Lock; Set : in out Object) is Tmp_Connection, Result_Connection : Connection; Result : Boolean; begin Search_For (Src_Item, Qualif, Tmp_Connection, Result, Set); if Result then Tmp_Connection.State := Connection_State; Connections_Tree.Replace_If_Found (Tmp_Connection, Set.Root, Result, Result_Connection); end if; end Modify_State; function Exist (Src_Item, Qualif : String; Set : Object) return Boolean is Tmp_Connection : Connection; Result : Boolean; begin Search_For (Src_Item, Qualif, Tmp_Connection, Result, Set); return Result; end Exist; function What_State (Src_Item, Qualif : String; Set : Object) return Lock is Tmp_Connection : Connection; Result : Boolean; begin Search_For (Src_Item, Qualif, Tmp_Connection, Result, Set); if Result then return Tmp_Connection.State; else return No_State; end if; end What_State; function What_Destination (Src_Item, Qualif : String; Set : Object) return String is Tmp_Connection : Connection; Result : Boolean; begin Search_For (Src_Item, Qualif, Tmp_Connection, Result, Set); return Image (Tmp_Connection.Destination); end What_Destination; procedure List (Src_Item : String; Set : Object) is Found_Connection : Connection; Set_Iter : Connections_Tree.Iterator; begin Set_Iter := Connections_Tree.Make_Iter (Set.Root); while Connections_Tree.More (Set_Iter) loop Connections_Tree.Next (Set_Iter, Found_Connection); if Image (Found_Connection.Source) = Src_Item then Text_Io.Put_Line (Image (Found_Connection.Destination) & "," & Image (Found_Connection.Qualification) & "/ State ->" & Lock'Image (Found_Connection.State)); end if; end loop; end List; procedure Dump (Set : Object) is begin Show (Set.Root, Connections_Tree.Inorder); end Dump; end Set_Of_Connections;
nblk1=7 nid=0 hdr6=e [0x00] rec0=20 rec1=00 rec2=01 rec3=064 [0x01] rec0=17 rec1=00 rec2=02 rec3=056 [0x02] rec0=20 rec1=00 rec2=03 rec3=03c [0x03] rec0=19 rec1=00 rec2=04 rec3=028 [0x04] rec0=1e rec1=00 rec2=05 rec3=02c [0x05] rec0=19 rec1=00 rec2=06 rec3=028 [0x06] rec0=06 rec1=00 rec2=07 rec3=001 tail 0x21742e0e486295adfdc29 0x42a00088462060003