DIRECTORY
Calendar USING [ Days, Months, Years, Date, ZoomLevel],
Hickory USING [ EventList, Event, Reason, EventTuple],
ViewerClasses USING [ Viewer],
RopeSets USING [ RopeSet]
;
Global Types
DayNode:
TYPE =
RECORD [
Day: Days,
Initialized: BOOLEAN ← FALSE, -- was Hickory already queried for that day?
EvList: Hickory.EventList ← NIL
];
MonthNode:
TYPE =
RECORD [
Month: Months,
Initialized: BOOLEAN ← FALSE, -- for that month?
DayNodes: ARRAY Days OF DayNode,
Viewer: ViewerClasses.Viewer ← NIL
];
YearNode:
TYPE =
RECORD [
Year: Years,
Initialized: BOOLEAN ← FALSE, -- for that year?
MonthNodes: ARRAY Months OF MonthNode,
Next: REF YearNode,
Viewer: ViewerClasses.Viewer ← NIL
];
Mode: TYPE = { Query, Browse, EnterEvent, Initial };
ProtectedData:
TYPE =
MONITORED
RECORD [
calViewer: ViewerClasses.Viewer ← NIL,
curDate: Date,
curMode: Mode,
yearTrees: REF YearNode
];
Operations
GetEventsOfDay:
PRIVATE
--INTERNAL--
PROCEDURE [ date: Date, zoomLevel: ZoomLevel]
RETURNS [ evl: Hickory.EventList];
zoomLevel is used for prefetching....
RetrieveViewer: PRIVATE -- INTERNAL-- PROCEDURE [ date: Date, zoom: ZoomLevel] RETURNS [ viewer: ViewerClasses.Viewer];
StoreViewer:
PRIVATE
-- INTERNAL--
PROCEDURE [ date: Date, zoom: ZoomLevel, viewer: ViewerClasses.Viewer];
DestroyAllViewers:
PRIVATE
--INTERNAL--
PROCEDURE;
to destroy all viewers that are cached in CalStorage.
FindEvent:
PRIVATE
--INTERNAL--
PROCEDURE [ date: Date, key: Hickory.Event]
RETURNS [ evPtr: REF Hickory.EventTuple];
return the pointer onto the event in storage. Makes a copy of tuple...
HickoryChange:
PRIVATE
--INTERNAL--
PROCEDURE [ reason: Hickory.Reason, ev: Hickory.Event, data: RopeSets.RopeSet]
RETURNS [ oldEvl, newEvl: Hickory.EventList];
here we update calendar storage and return the list of events that have indeed
changed. 'oldEvl' is the list of events with key = 'ev' that were in storge before
the change to hickory, newEvl is the list of events that now is in calStorage.
END.