|
|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 Tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: B T
Length: 3973 (0xf85)
Types: TextFile
Names: »B«
└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11
└─⟦129cab021⟧ »DATA«
└─⟦this⟧
└─⟦2f6cfab89⟧ Bits:30000547 8mm tape, Rational 1000, !projects 94-01-04
└─⟦d65440be7⟧ »DATA«
└─⟦this⟧
package body Arbre is
type Noeud is
record
Nom : Ptr_String;
Valeur : Item;
Gauche, Droit : Pnoeud := null;
end record;
procedure Creer (A : in out Object; Nom : Ptr_String; E : in Item) is
begin
A.Racine := new Noeud'(new String'(Nom.all), E, null, null);
A.Iterateur := A.Racine;
end Creer;
procedure Ajouter (A : in out Object;
Nom : Ptr_String;
E : in Item;
Ok : in out Boolean) is
Sortir : Boolean := False;
begin
Ok := False;
if A.Racine /= null then
while (not Sortir) loop
if A.Iterateur.Nom.all < Nom.all then
if A.Iterateur.Droit /= null then
A.Iterateur := A.Iterateur.Droit;
else
A.Iterateur.Droit :=
new Noeud'(new String'(Nom.all), E, null, null);
Sortir := True;
Ok := True;
end if;
else
if A.Iterateur.Nom.all = Nom.all then
Sortir := True;
A.Iterateur.Valeur := E;
else
if A.Iterateur.Gauche /= null then
A.Iterateur := A.Iterateur.Gauche;
else
A.Iterateur.Gauche :=
new Noeud'(new String'(Nom.all), E, null, null);
Sortir := True;
Ok := True;
end if;
end if;
end if;
end loop;
else
Creer (A, Nom, E);
Ok := True;
end if;
A.Iterateur := A.Racine;
end Ajouter;
procedure Lire (A : in out Object;
Nom : Ptr_String;
E : out Item;
Ok : in out Boolean) is
Sortir : Boolean := False;
begin
Ok := False;
while (not Sortir) loop
if A.Iterateur.Nom.all < Nom.all then
if A.Iterateur.Droit /= null then
A.Iterateur := A.Iterateur.Droit;
else
Sortir := True;
end if;
else
if A.Iterateur.Nom.all = Nom.all then
Sortir := True;
Ok := True;
E := A.Iterateur.Valeur;
else
if A.Iterateur.Gauche /= null then
A.Iterateur := A.Iterateur.Gauche;
else
Sortir := True;
end if;
end if;
end if;
end loop;
A.Iterateur := A.Racine;
end Lire;
procedure Modifier (A : in out Object;
Nom : Ptr_String;
E : Item;
Ok : in out Boolean) is
Sortir : Boolean := False;
begin
Ok := False;
while (not Sortir) loop
if A.Iterateur.Nom.all < Nom.all then
if A.Iterateur.Droit /= null then
A.Iterateur := A.Iterateur.Droit;
else
Sortir := True;
end if;
else
if A.Iterateur.Nom.all = Nom.all then
Sortir := True;
Ok := True;
A.Iterateur.Valeur := E;
else
if A.Iterateur.Gauche /= null then
A.Iterateur := A.Iterateur.Gauche;
else
Sortir := True;
end if;
end if;
end if;
end loop;
A.Iterateur := A.Racine;
end Modifier;
end Arbre;