********************************************************************
* NOTE: This file is generated automatically from the event * definition file Maxflow.evt. ********************************************************************<* PRAGMA LL *> MODULEevent handling methods:; <*NOWARN*> IMPORT TextPort, Rd, ZeusClass, Filter, R2, TextEditVBT; <*NOWARN*> IMPORT Fmt, MFGraph, ZFmt, Wr, ZeusPanel, FormsVBT, VBT; <*NOWARN*> IMPORT View, MaxflowViewClass, MFAlgs, MFViews; <*NOWARN*> IMPORT GraphVBT, RefList, MFFmt; <* FATAL FormsVBT.Error, FormsVBT.Unimplemented *> REVEAL T = Public BRANDED OBJECT fv: FormsVBT.T := NIL; te: TextEditVBT.T := NIL; OVERRIDES init := TViewInit; install := TViewInstall; delete := TViewDelete; snapshot := TViewSnapshot; restore := TViewRestore; config := TViewConfig; reactivity := TViewReactivity; startrun := TViewStartrun; endrun := TViewEndrun; oeSetup := Setup; oeHighlightPath := HighlightPath; oeIncFlow := IncFlow; oeDecFlow := DecFlow; oeShowEdge := ShowEdge; oeRemoveHighlight := RemoveHighlight; oeFinalResult := FinalResult; ueAddVBTVertex := AddVBTVertex; ueAddVBTEdge := AddVBTEdge; END; PROCEDURE MaxflowTranscriptView TViewInit (view: T): T = <* LL = VBT.mu *> BEGIN TViewZTrace (view, "init"); RETURN MaxflowViewClass.T.init (view, NIL); END TViewInit; PROCEDUREClear (<* UNUSED *> fv : FormsVBT.T; <* UNUSED *> name: TEXT; cl : REFANY; <* UNUSED *> time: VBT.TimeStamp) = BEGIN TextPort.SetText(NARROW(cl, T).te.tp, "") END Clear; PROCEDURETViewInstall (view: T) = <* LL = VBT.mu *> BEGIN view.fv := ZeusPanel.NewForm("MaxflowTranscriptView.fv"); view.te := FormsVBT.GetVBT(view.fv, "transcript"); TViewZTrace (view, "install"); FormsVBT.AttachProc(view.fv, "clear", Clear, view); EVAL Filter.Replace (view, view.fv); MaxflowViewClass.T.install (view); END TViewInstall; PROCEDURETViewDelete (view: T) = <* LL = VBT.mu *> BEGIN TViewZTrace (view, "delete"); MaxflowViewClass.T.delete (view); END TViewDelete; PROCEDURETViewSnapshot (view: T; wr: Wr.T) RAISES {ZeusClass.Error} = <* LL = VBT.mu *> BEGIN TViewZTrace (view, "snapshot"); MaxflowViewClass.T.snapshot (view, wr); END TViewSnapshot; PROCEDURETViewRestore (view: T; rd: Rd.T) RAISES {ZeusClass.Error} = <* LL = VBT.mu *> BEGIN TViewZTrace (view, "restore"); MaxflowViewClass.T.restore (view, rd); END TViewRestore; PROCEDURETViewConfig ( view: T; state: ZeusClass.StateChange; o: ZeusClass.T) = <* LL = VBT.mu *> BEGIN TViewZTrace (view, "config"); MaxflowViewClass.T.config (view, state, o); END TViewConfig; PROCEDURETViewReactivity (view: T; <*UNUSED*> on: BOOLEAN) = <* LL = VBT.mu *> BEGIN TViewZTrace(view, "reactivity"); MaxflowViewClass.T.reactivity (view, TRUE); END TViewReactivity; PROCEDURETViewStartrun (view: T) = <* LL = {} *> BEGIN TViewZTrace (view, "startrun"); MaxflowViewClass.T.startrun (view); END TViewStartrun; PROCEDURETViewEndrun (view: T) = <* LL = {} *> BEGIN TViewZTrace (view, "endrun"); MaxflowViewClass.T.endrun (view); END TViewEndrun;PROCEDURESetup (view: T; g: MFGraph.T; source: MFGraph.Vertex; sink: MFGraph.Vertex) = <* LL = {} *> BEGIN LOCK VBT.mu DO IF FormsVBT.GetBoolean(view.fv, "alg") THEN IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN TViewTrace (view, "Setup ...") ELSE TViewTrace (view, "Setup " & MFAlgs.NullText(g) & " " & MFFmt.Ref(source) & " " & MFFmt.Ref(sink) ) END END END END Setup; PROCEDUREHighlightPath (view: T; path: RefList.T; maxCapacity: REAL) = <* LL = {} *> BEGIN LOCK VBT.mu DO IF FormsVBT.GetBoolean(view.fv, "alg") THEN IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN TViewTrace (view, "HighlightPath ...") ELSE TViewTrace (view, "HighlightPath " & MFFmt.Ref(path) & " " & Fmt.Real(maxCapacity) ) END END END END HighlightPath; PROCEDUREIncFlow (view: T; edge: MFGraph.Edge; flow: REAL; number: CARDINAL; maxCapacity: REAL; capa: REAL) = <* LL = {} *> BEGIN LOCK VBT.mu DO IF FormsVBT.GetBoolean(view.fv, "alg") THEN IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN TViewTrace (view, "IncFlow ...") ELSE TViewTrace (view, "IncFlow " & MFViews.PrintEdge(edge) & " " & Fmt.Real(flow) & " " & Fmt.Int(number) & " " & Fmt.Real(maxCapacity) & " " & Fmt.Real(capa) ) END END END END IncFlow; PROCEDUREDecFlow (view: T; edge: MFGraph.Edge; oldflow: REAL; newflow: REAL; number: CARDINAL; maxCapacity: REAL; capa: REAL) = <* LL = {} *> BEGIN LOCK VBT.mu DO IF FormsVBT.GetBoolean(view.fv, "alg") THEN IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN TViewTrace (view, "DecFlow ...") ELSE TViewTrace (view, "DecFlow " & MFViews.PrintEdge(edge) & " " & Fmt.Real(oldflow) & " " & Fmt.Real(newflow) & " " & Fmt.Int(number) & " " & Fmt.Real(maxCapacity) & " " & Fmt.Real(capa) ) END END END END DecFlow; PROCEDUREShowEdge (view: T; number, typeOfEdge: CARDINAL) = <* LL = {} *> BEGIN LOCK VBT.mu DO IF FormsVBT.GetBoolean(view.fv, "alg") THEN IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN TViewTrace (view, "ShowEdge ...") ELSE TViewTrace (view, "ShowEdge " & Fmt.Int(number) & " " & Fmt.Int(typeOfEdge) ) END END END END ShowEdge; PROCEDURERemoveHighlight (view: T; sinkvertex: MFGraph.Vertex) = <* LL = {} *> BEGIN LOCK VBT.mu DO IF FormsVBT.GetBoolean(view.fv, "alg") THEN IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN TViewTrace (view, "RemoveHighlight ...") ELSE TViewTrace (view, "RemoveHighlight " & MFFmt.Ref(sinkvertex) ) END END END END RemoveHighlight; PROCEDUREFinalResult (view: T; b: BOOLEAN) = <* LL = {} *> BEGIN LOCK VBT.mu DO IF FormsVBT.GetBoolean(view.fv, "alg") THEN IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN TViewTrace (view, "FinalResult ...") ELSE TViewTrace (view, "FinalResult " & Fmt.Bool(b) ) END END END END FinalResult; PROCEDUREAddVBTVertex (view: T; v: MFAlgs.MFVertex; pos: R2.T; label: TEXT) = <* LL = VBT.mu *> BEGIN IF FormsVBT.GetBoolean(view.fv, "alg") THEN IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN TViewTrace (view, "AddVBTVertex ...") ELSE TViewTrace (view, "AddVBTVertex " & MFFmt.Ref(v) & " " & R2.ToText(pos) & " " & MFAlgs.PrintText(label) ) END END END AddVBTVertex; PROCEDUREAddVBTEdge (view: T; e: MFAlgs.MFEdge) = <* LL = VBT.mu *> BEGIN IF FormsVBT.GetBoolean(view.fv, "alg") THEN IF NOT FormsVBT.GetBoolean(view.fv, "args") THEN TViewTrace (view, "AddVBTEdge ...") ELSE TViewTrace (view, "AddVBTEdge " & MFFmt.Ref(e) ) END END END AddVBTEdge; PROCEDURETViewZTrace (view: T; t: TEXT) = BEGIN IF view.fv # NIL THEN IF FormsVBT.GetBoolean(view.fv, "zeus") THEN TextPort.PutText(view.te.tp, "**zeus: " & t & "\n"); TextPort.Normalize(view.te.tp, LAST(INTEGER)) END END END TViewZTrace; PROCEDURETViewTrace (view: T; t: TEXT) = BEGIN TextPort.PutText(view.te.tp, "--event: " & t & "\n"); TextPort.Normalize(view.te.tp, LAST(INTEGER)) END TViewTrace; PROCEDURETViewNew (): View.T = BEGIN RETURN NEW(T).init() END TViewNew; BEGIN ZeusPanel.RegisterView (TViewNew, "Maxflow Transcript View", "Maxflow"); END MaxflowTranscriptView.