<> <> <> <> <> DIRECTORY Intervals USING [empty, Interval, Table, universe]; D2Intervals: CEDAR DEFINITIONS = BEGIN Interval: TYPE = Intervals.Interval; Rect: TYPE = RECORD [x, y: Interval]; <> <> Table: TYPE = REF TableRec; TableRec: TYPE = MONITORED RECORD [ range: Rect, -- given at creation time, it retains the range of all rects. Clients should not change this field. size: NAT, -- maintained by all operations. Clients should not change this field. valueRect: ValueRectProc, -- user-given function to access the rectangle corresponding to a value. Should be fast to compute. Clients should not change this field. userData: REF, -- user field. effectiveRange: PRIVATE Rect, -- effective range of current values. Use EffectiveRange to read that field (that may not be correct) leafBuckets: PRIVATE NAT, -- private field to detect when ReHashing is necessary. data: PRIVATE REF TableData ]; TableData: PRIVATE TYPE = RECORD [c: SEQUENCE hashSize: NAT OF Intervals.Table]; Value: TYPE = REF; ValueRectProc: TYPE = PROC [Table, Value] RETURNS [Rect]; Create: PROC [range: Rect, valueRect: ValueRectProc, userData: REF _ NIL, logHashSize: NAT _ 2] RETURNS [Table]; <> Insert: PROC [table: Table, value: Value]; <> <> <> <> Delete: PROC [table: Table, value: Value]; <> <> <> Enumerate: PROC [table: Table, action: PROC [Table, Value] RETURNS [BOOLEAN _ FALSE], rect: Rect _ universe] RETURNS [BOOLEAN]; <> <> <> <> <> Erase: PROC [table: Table]; <> <> <<>> universe: Rect = [Intervals.universe, Intervals.universe]; empty: Rect = [Intervals.empty, Intervals.empty]; EffectiveRange: PROC [table: Table] RETURNS [Rect]; <> <<>> Union: PROC [rect1, rect2: Rect] RETURNS [Rect]; <> Overlap: PROC [rect1, rect2: Rect] RETURNS [BOOL]; <> END.