|
|
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: 9216 (0x2400)
Types: Ada Source
Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Rule_Instance, seg_04a32c, seg_04a9ef, seg_04b45d, separate Generic_Rule_Base
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
└─⟦cfc2e13cd⟧ »Space Info Vol 2«
└─⟦this⟧
separate (Generic_Rule_Base)
package body Rule_Instance is
procedure Swap (The_Facts : in out Fact_Collection; Index : Positive) is
Tmp_Fact : Fact_Name;
begin
Tmp_Fact := The_Facts (Index);
The_Facts (Index) := The_Facts (Index + 1);
The_Facts (Index + 1) := Tmp_Fact;
end Swap;
function Sort (The_Facts : Fact_Collection) return Fact_Collection is
Result : Fact_Collection (1 .. The_Facts'Length) := The_Facts;
use Recency;
begin
for I in Result'First .. (Result'Last - 1) loop
for J in Result'First .. (Result'Last - I) loop
if Get_Date (Result (J)) < Get_Date (Result (J + 1)) then
Swap (Result, J);
end if;
end loop;
end loop;
return Result;
end Sort;
function Is_Earlier (Left, Right : Fact_Collection) return Boolean is
Max_Index : Positive;
Sorted_Left : Fact_Collection (1 .. Left'Length);
Sorted_Right : Fact_Collection (1 .. Right'Length);
use Recency;
begin
if Left'Length > Right'Length then
Max_Index := Right'Length;
else
Max_Index := Left'Length;
end if;
Sorted_Left := Sort (Left);
Sorted_Right := Sort (Right);
for I in 1 .. Max_Index loop
if Get_Date (Sorted_Left (I)) < Get_Date (Sorted_Right (I)) then
return True;
elsif Get_Date (Sorted_Left (I)) > Get_Date (Sorted_Right (I)) then
return False;
else
null;
end if;
end loop;
return Left'Length < Right'Length;
end Is_Earlier;
function Is_Later (Left, Right : Fact_Collection) return Boolean is
Max_Index : Positive;
Sorted_Left : Fact_Collection (1 .. Left'Length);
Sorted_Right : Fact_Collection (1 .. Right'Length);
use Recency;
begin
if Left'Length > Right'Length then
Max_Index := Right'Length;
else
Max_Index := Left'Length;
end if;
Sorted_Left := Sort (Left);
Sorted_Right := Sort (Right);
for I in 1 .. Max_Index loop
if Get_Date (Sorted_Left (I)) < Get_Date (Sorted_Right (I)) then
return False;
elsif Get_Date (Sorted_Left (I)) > Get_Date (Sorted_Right (I)) then
return True;
else
null;
end if;
end loop;
return Left'Length > Right'Length;
end Is_Later;
function "<" (Left, Right : Object) return Boolean is
Left_Facts : constant Fact_Collection := Get_Facts (Left);
Right_Facts : constant Fact_Collection := Get_Facts (Right);
use Recency;
begin
return Is_Earlier (Left_Facts, Right_Facts)
or else
(not Is_Later (Left_Facts, Right_Facts) and then
((The_Rules (Left.The_Rule).The_Date >
The_Rules (Right.The_Rule).The_Date)
or else
((The_Rules (Left.The_Rule).The_Date =
The_Rules (Right.The_Rule).The_Date) and then
(Left.Size < Right.Size))));
end "<";
function Make (The_Rule_Id : Rule_Id; The_Fact_Collection : Fact_Collection)
return Object is
The_Size : Natural := The_Fact_Collection'Last -
The_Fact_Collection'First + 1;
begin
return (Premiss_Size (The_Size), Rule_Id (The_Rule_Id),
Fact_Collection (The_Fact_Collection));
end Make;
function Get_Rule (From : Object) return Rule_Id is
begin
return From.The_Rule;
end Get_Rule;
function Get_Facts (From : Object) return Fact_Collection is
begin
return From.The_Facts;
end Get_Facts;
procedure Put (The_Instance : Object; Where : Output_Stream.Object) is
use Output_Stream;
begin
Put_Line ("Rule_instance'(", Where);
Indent_Right (Where);
Put ("The_Rule =>", Where);
Put (The_Instance.The_Rule, Where);
Put_Line (',', Where);
Put_Line ("The_facts =>", Where);
Indent_Right (Where);
Fact_Put (The_Instance.The_Facts (1 .. The_Instance.Size), Where);
Indent_Left (Where);
Indent_Left (Where);
Put_Line (")", Where);
end Put;
end Rule_Instance;
nblk1=8
nid=0
hdr6=10
[0x00] rec0=1f rec1=00 rec2=01 rec3=03c
[0x01] rec0=01 rec1=00 rec2=08 rec3=01e
[0x02] rec0=1c rec1=00 rec2=02 rec3=054
[0x03] rec0=00 rec1=00 rec2=07 rec3=00c
[0x04] rec0=20 rec1=00 rec2=03 rec3=018
[0x05] rec0=00 rec1=00 rec2=06 rec3=004
[0x06] rec0=1f rec1=00 rec2=04 rec3=03e
[0x07] rec0=1b rec1=00 rec2=05 rec3=000
tail 0x2174ea236866e7c67ede0 0x42a00088462063c03