<> <> <> <> <> <<>> DIRECTORY RedBlackTree; Schedule: CEDAR DEFINITIONS ~ BEGIN <> ps: TYPE = REAL; -- picosecond (1e-12 s) <> History: TYPE = LIST OF HistoryPt; --the event data representation. An History is time ordered. HistoryPt: TYPE = RECORD [t: ps, v: REAL]; CreateHistory: PROC [t: ps, v: REAL] RETURNS [newHistory: History]; <> KillHistory: PROC [history: History]; <> AddToHistory: PROC [oldHistory: History, t: ps, v: REAL] RETURNS [newHistory: History]; <> ForgetBeginings: PROC [oldHistory: History, t: ps] RETURNS [newHistory: History]; <> FirstTimeOfHistory: PROC [history: History] RETURNS [t: ps]; <> NextTimeOfHistory: PROC [history: History, t: ps] RETURNS [tnext: ps _ -1]; <> LastTimeOfHistory: PROC [history: History] RETURNS [t: ps]; <> LastValueOfHistory: PROC [history: History] RETURNS [v: REAL]; <> VFromHistory: PROC [history: History, t: ps] RETURNS [v: REAL]; <> EnumerateHistory: PROC [history: History, from, to: ps, action: HistoryProc] RETURNS [invalidEnumeration: BOOL _ FALSE]; <> HistoryProc: TYPE = PROC [t: ps, v: REAL] RETURNS [quit: BOOLEAN _ FALSE]; Schedule: PROC [hList: LIST OF History] RETURNS [lt: LIST OF ps]; <> <> Agenda: TYPE = REF AgendaRec; AgendaRec: PRIVATE TYPE = MONITORED RECORD [ execute: ExecuteProc, --the proc to call for each event of the list <> table: RedBlackTree.Table, --the tree of events to proceed nbOfEvents: INT _ 0, --statistical purposes data: REF ANY --whatever you want, I swear I won't touch it. ]; Event: TYPE = RECORD [ t: ps, ref: REF ANY ]; ExecuteProc: TYPE = PROC [ref: REF ANY, t: ps, data: REF ANY]; CreateAgenda: PROC [execute: ExecuteProc, data: REF ANY] RETURNS [newAgenda: Agenda]; <> KillAgenda: PROC [agenda: Agenda]; <> InsertInAgenda: PROC [agenda: Agenda, ref: REF ANY, t: ps]; <> ExecuteAgenda: PROC [agenda: Agenda] RETURNS [lastTime: ps]; <> END.