MODULE; IMPORT AlgorithmClass, FormsVBT, Rd, Wr, ZeusClass, ZeusUtil; <* PRAGMA LL *> REVEAL T = AlgorithmClass.T BRANDED OBJECT OVERRIDES run := DefaultRun; init := DefaultInit; snapshot := DefaultSnapshot; restore := DefaultRestore; updateEventCounts := DefaultUpdateCts; END; EXCEPTION FatalError; <*FATAL FatalError*> PROCEDURE Algorithm DefaultRun (<*UNUSED*> v: T) = <* LL = {} *> BEGIN RAISE FatalError END DefaultRun; PROCEDUREDefaultInit (v: T): T = <* LL = VBT.mu *> BEGIN v.evtMu := NEW(MUTEX); v.reactivity(FALSE); RETURN v END DefaultInit; PROCEDUREDefaultSnapshot (v: T; wr: Wr.T) RAISES {ZeusClass.Error} = <* LL = VBT.mu *> BEGIN TRY Wr.PutText(wr, "(") EXCEPT ELSE RAISE ZeusClass.Error("Algorithm.DefaultSnapshot write error") END; IF v.data # NIL THEN TYPECASE v.data OF | FormsVBT.T (fv) => TRY fv.snapshot(wr); EXCEPT FormsVBT.Error (msg) => RAISE ZeusClass.Error( "Algorithm.DefaultSnapshot FV error: " & msg); ELSE RAISE ZeusClass.Error("Algorithm.DefaultSnapshot error"); END; ELSE END; END; ZeusClass.T.snapshot(v, wr); TRY Wr.PutText(wr, ")") EXCEPT ELSE RAISE ZeusClass.Error("Algorithm.DefaultSnapshot write error") END; END DefaultSnapshot; PROCEDUREDefaultRestore (v: T; rd: Rd.T) RAISES {ZeusClass.Error} = <* LL = VBT.mu *> BEGIN IF rd = NIL THEN RETURN END; IF NOT ZeusUtil.EatChar(rd, '(') THEN RAISE ZeusClass.Error("Algorithm.DefaultRestore read error") END; IF v.data # NIL THEN TRY TYPECASE v.data OF | FormsVBT.T (fv) => fv.restore(rd); ELSE END; EXCEPT ELSE RAISE ZeusClass.Error("Algorithm.DefaultRestore error"); END; END; ZeusClass.T.restore(v, rd); IF NOT ZeusUtil.EatChar(rd, ')') THEN RAISE ZeusClass.Error("Algorithm.DefaultRestore read error") END; END DefaultRestore; PROCEDUREDefaultUpdateCts (<*UNUSED*> v: T; <*UNUSED*> reset: BOOLEAN) = <* LL = VBT.mu *> BEGIN END DefaultUpdateCts; BEGIN END Algorithm.