|
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: 11264 (0x2c00) Types: Ada Source Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Generic_String_Sort_Array, seg_0492ff, seg_049309, seg_049474
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000 └─ ⟦5a81ac88f⟧ »Space Info Vol 1« └─⟦this⟧ └─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000 └─ ⟦cfc2e13cd⟧ »Space Info Vol 2« └─⟦this⟧
package body Generic_String_Sort_Array is procedure Put (Collection : in out Object; Item : in Element; Ok : out Boolean) is Index : Element_Index := 1; Temporary_Array : Unconstraint_Array (1 .. Collection.Object.Inner'Last + 1); begin if Is_Full (Collection) then Ok := False; elsif Is_Empty (Collection) then Ok := True; Collection.Object := (Length => 1, Inner => (others => Item)); else while Index in Collection.Object.Inner'Range and then Get_Key (Collection.Object.Inner (Index)) < Get_Key (Item) loop Index := Index + 1; end loop; if Index not in Collection.Object.Inner'Range then Ok := True; Temporary_Array := Collection.Object.Inner & Item; Collection.Object := (Length => Collection.Object.Length + 1, Inner => Temporary_Array); elsif Get_Key (Collection.Object.Inner (Index)) /= Get_Key (Item) then Ok := True; Temporary_Array := Collection.Object.Inner (1 .. Index - 1) & Item & Collection.Object.Inner (Index .. Collection.Object.Inner'Last); Collection.Object := (Length => Collection.Object.Length + 1, Inner => Temporary_Array); else Ok := False; end if; end if; end Put; procedure Put (Collection : in out Object; Item : in Element) is The_Index : Element_Index := Index (Collection, Get_Key (Item)); Ok : Boolean; begin if The_Index = 0 then Put (Collection, Item, Ok); else Collection.Object.Inner (The_Index) := Item; end if; end Put; procedure Get (Collection : in Object; Item : out Element; Key : in String; Ok : out Boolean) is Low, Mid, High : Element_Index; Item_Ok : Boolean := False; begin if Is_Empty (Collection) then Ok := False; Item := Null_Element; else Low := 1; High := Collection.Object.Inner'Last; while Low <= High and not Item_Ok loop Mid := (Low + High) / 2; if Get_Key (Collection.Object.Inner (Mid)) < Key then Low := Mid + 1; elsif Get_Key (Collection.Object.Inner (Mid)) > Key then High := Mid - 1; else Item_Ok := True; end if; end loop; if Item_Ok then Ok := True; Item := Collection.Object.Inner (Mid); else Ok := False; Item := Null_Element; end if; end if; end Get; procedure Get (Collection : in Object; Item : out Element; Key : in Element_Index; Ok : out Boolean) is begin if Key not in Collection.Object.Inner'Range then Ok := False; Item := Null_Element; else Ok := True; Item := Collection.Object.Inner (Key); end if; end Get; procedure Show (Collection : in Object) is An_Iterator : Iterator; begin Init (Collection, An_Iterator); while not Done (An_Iterator) loop Show_Element (Value (An_Iterator)); Next (An_Iterator); end loop; end Show; function Is_Full (Collection : in Object) return Boolean is begin return Collection.Object.Length = Max_Element_Number - 1; end Is_Full; function Is_Empty (Collection : in Object) return Boolean is begin return Collection.Object.Length = 0; end Is_Empty; function Index (Collection : in Object; Key : in String) return Element_Index is Low, Mid, High : Element_Index; Item_Ok : Boolean := False; Index : Element_Index := 0; begin if not Is_Empty (Collection) then Low := 1; High := Collection.Object.Inner'Last; while Low <= High and not Item_Ok loop Mid := (Low + High) / 2; if Get_Key (Collection.Object.Inner (Mid)) < Key then Low := Mid + 1; elsif Get_Key (Collection.Object.Inner (Mid)) > Key then High := Mid - 1; else Item_Ok := True; end if; end loop; if Item_Ok then Index := Mid; end if; end if; return Index; end Index; function Belong (Collection : in Object; Key : in String) return Boolean is begin return Index (Collection, Key) /= 0; end Belong; function Number_Of (Collection : in Object) return Element_Index is begin return Collection.Object.Length; end Number_Of; procedure Init (Collection : in Object; An_Iterator : in out Iterator) is begin if Is_Empty (Collection) then An_Iterator.Collection := Null_Object; An_Iterator.Index := 0; else An_Iterator.Collection := Collection; An_Iterator.Index := 1; end if; end Init; function Done (An_Iterator : in Iterator) return Boolean is begin if Is_Empty (An_Iterator.Collection) then return True; else return An_Iterator.Index = An_Iterator.Collection.Object.Length + 1; end if; end Done; function Value (An_Iterator : in Iterator) return Element is begin if An_Iterator.Index > 0 and not Done (An_Iterator) then return An_Iterator.Collection.Object.Inner (An_Iterator.Index); else return Null_Element; end if; end Value; procedure Next (An_Iterator : in out Iterator) is begin if not Done (An_Iterator) then An_Iterator.Index := An_Iterator.Index + 1; end if; end Next; end Generic_String_Sort_Array;
nblk1=a nid=7 hdr6=10 [0x00] rec0=19 rec1=00 rec2=01 rec3=026 [0x01] rec0=16 rec1=00 rec2=03 rec3=046 [0x02] rec0=1f rec1=00 rec2=02 rec3=01a [0x03] rec0=25 rec1=00 rec2=04 rec3=034 [0x04] rec0=20 rec1=00 rec2=05 rec3=022 [0x05] rec0=02 rec1=00 rec2=09 rec3=01a [0x06] rec0=24 rec1=00 rec2=0a rec3=048 [0x07] rec0=1e rec1=00 rec2=08 rec3=000 [0x08] rec0=18 rec1=00 rec2=02 rec3=000 [0x09] rec0=2d rec1=0c rec2=14 rec3=6c4 tail 0x2174d9b26865b70b32966 0x42a00088462060003 Free Block Chain: 0x7: 0000 00 06 03 2a 80 3b 6e 64 65 78 20 3a 20 45 6c 65 ┆ * ;ndex : Ele┆ 0x6: 0000 00 00 03 fc 80 41 20 20 20 20 20 20 20 20 20 77 ┆ A w┆