|
|
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 - metrics - download
Length: 6144 (0x1800)
Types: Ada Source
Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Tree_A, seg_0488f4
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
└─⟦5a81ac88f⟧ »Space Info Vol 1«
└─⟦this⟧
package body Tree_A is
type Node;
type Branch is access Node;
type Node is
record
Value : Element;
Left, Right : Branch;
end record;
Root_Node, Current_Node : Branch;
Free_Nodes : Branch := null;
Aux_Node : Branch;
function New_Node return Branch is
Result : Branch;
begin
if Free_Nodes = null then
Result := new Node;
else
Result := Free_Nodes;
Free_Nodes := Free_Nodes.Right;
end if;
Result.Right := null;
Result.Left := null;
return Result;
end New_Node;
procedure Insert_Node (The_Node : in out Branch; X : in Element) is
begin
if The_Node = null then
The_Node := New_Node;
The_Node.Value := X;
elsif X < The_Node.Value then
Insert_Node (The_Node.Left, X);
elsif X > The_Node.Value then
Insert_Node (The_Node.Right, X);
end if;
end Insert_Node;
procedure Insert (X : in Element) is
begin
if Root_Node = null then
Root_Node := New_Node;
Root_Node.Value := X;
else
Insert_Node (Root_Node, X);
end if;
end Insert;
function Find_Node (The_Node : in Branch; X : in Element) return Boolean is
begin
if The_Node = null then
return False;
elsif X < The_Node.Value then
return Find_Node (The_Node.Left, X);
elsif X > The_Node.Value then
return Find_Node (The_Node.Right, X);
else
Current_Node := The_Node;
return True;
end if;
end Find_Node;
function Find (X : in Element) return Boolean is
begin
return Find_Node (Root_Node, X);
end Find;
procedure Set_Current_Element (X : in Element) is
begin
Current_Node.Value := X;
end Set_Current_Element;
procedure Go_First is
begin
Current_Node := Root_Node;
while Current_Node.Left /= null loop
Current_Node := Current_Node.Left;
end loop;
end Go_First;
function Get_Current_Element return Element is
begin
if Current_Node /= null then
return Current_Node.Value;
end if;
end Get_Current_Element;
procedure Go_Left is
begin
if Current_Node /= null then
Current_Node := Current_Node.Left;
end if;
end Go_Left;
procedure Go_Right is
begin
if Current_Node /= null then
Current_Node := Current_Node.Right;
end if;
end Go_Right;
procedure Go_Root is
begin
Current_Node := Root_Node;
end Go_Root;
function At_End return Boolean is
begin
return Current_Node = null;
end At_End;
begin
for I in 1 .. Nb_Preallocation_Node loop
Aux_Node := New_Node;
Aux_Node.Right := Free_Nodes;
Free_Nodes := Aux_Node;
end loop;
end Tree_A;
nblk1=5
nid=0
hdr6=a
[0x00] rec0=27 rec1=00 rec2=01 rec3=010
[0x01] rec0=00 rec1=00 rec2=05 rec3=004
[0x02] rec0=23 rec1=00 rec2=02 rec3=01a
[0x03] rec0=2a rec1=00 rec2=03 rec3=01e
[0x04] rec0=09 rec1=00 rec2=04 rec3=000
tail 0x21545d4c0865a3dfff7d9 0x42a00088462060003