PipalInstanceTable.mesa
Copyright Ó 1987, 1988 by Xerox Corporation. All rights reversed.
From Intervals, created by Bertrand Serlet, November 16, 1985 7:22:05 pm PST
Bertrand Serlet, March 15, 1988 0:31:56 am PST
DIRECTORY Pipal, PipalInt;
PipalInstanceTable: CEDAR DEFINITIONS = BEGIN
Value: TYPE = REF;
Table: TYPE = REF TableRec;
TableRec: PRIVATE TYPE = MONITORED RECORD [
rect: PipalInt.Rectangle,  -- given at creation time, it retains the bbox of all rects. Clients should not change this field.
leafBuckets: NAT, -- private field to detect when ReHashing is necessary.
data: REF TableData
];
TableData: PRIVATE TYPE = RECORD [SEQUENCE size: NAT OF LIST OF InstanceValue];
InstanceValue: PRIVATE TYPE = RECORD [trans: PipalInt.Transformation, object: Pipal.Object, value: Value];
Create: PROC [rect: PipalInt.Rectangle, logSize: NAT ← 2] RETURNS [Table];
Creates a new table with a suggested hash size of 2**logSize.
Insert: PROC [table: Table, trans: PipalInt.Transformation, object: Pipal.Object, value: Value];
Adds a new value in the table.
The corresponding interval must lie in the creation rect, otherwise an ERROR might occur.
This operation is monitored.
Does NOT check if already member of the table.
Enumerate: PROC [table: Table, action: PROC [PipalInt.Transformation, Pipal.Object, Value], rect: PipalInt.Rectangle ← PipalInt.fullRectangle];
Enumerates all values of the table that overlap a given rect.
The interval can be outside the rect of the table.
This operation is NOT monitored.
DeleteOutside: PROC [table: Table, rect: PipalInt.Rectangle ← PipalInt.emptyRectangle];
Deletes all occurences of instances that do not overlap rect in table.
The interval can be outside the rect of the table.
Table is erased when rect=PipalInt.emptyRectangle.
This operation is monitored.
END.