********************************************************************
* NOTE: This file is generated automatically from the event
* definition file Hash.evt.
********************************************************************
MODULE HashAlgClass ;
<*NOWARN*> IMPORT Rd, IntList, ZeusClass, Fmt, Algorithm, HashFmt;
<*NOWARN*> IMPORT Wr, ZeusPanel, FormsVBT, VBT, Text, ZeusUtil;
<* PRAGMA LL *>
Fix any FormsVBT errors; don't handle exceptions for them.
<* FATAL FormsVBT.Error, FormsVBT.Unimplemented *>
REVEAL
T = Public BRANDED OBJECT
OVERRIDES
<* LL = VBT.mu *>
init := HashDefaultInit;
snapshot := HashDefaultSnapshot;
restore := HashDefaultRestore;
updateEventCounts := HashDefaultUpdateCts;
feReportFind := ReportFind;
feStopReportFind := StopReportFind;
END;
PROCEDURE HashDefaultInit (v: T): Algorithm.T =
<* LL = VBT.mu *>
PROCEDURE Attach (id: TEXT; proc: FormsVBT.Proc) =
BEGIN
FormsVBT.AttachProc(v.eventData, id, proc, v);
END Attach;
BEGIN
v.eventData := ZeusPanel.NewForm("HashEventData.fv");
Attach("stopatCodeEvents", HashDoIt);
Attach("waitatCodeEvents", HashDoIt);
Attach("eventCounts", HashRefreshCts);
Attach("stopAtSetup", HashDoIt);
Attach("waitAtSetup", HashDoIt);
Attach("stopAtInsert", HashDoIt);
Attach("waitAtInsert", HashDoIt);
Attach("stopAtFind", HashDoIt);
Attach("waitAtFind", HashDoIt);
Attach("stopAtDelete", HashDoIt);
Attach("waitAtDelete", HashDoIt);
Attach("stopAtCompare", HashDoIt);
Attach("waitAtCompare", HashDoIt);
Attach("stopAtCheckDeletable", HashDoIt);
Attach("waitAtCheckDeletable", HashDoIt);
Attach("stopAtCheckHashPosition", HashDoIt);
Attach("waitAtCheckHashPosition", HashDoIt);
Attach("stopAtAddToBucket", HashDoIt);
Attach("waitAtAddToBucket", HashDoIt);
Attach("stopAtDeleteFromBucket", HashDoIt);
Attach("waitAtDeleteFromBucket", HashDoIt);
FromFV (v.eventData, v); (* Get FV and internal data in sync *)
RETURN Algorithm.T.init(v);
END HashDefaultInit;
PROCEDURE HashDoIt ( fv : FormsVBT.T;
e : TEXT;
arg: REFANY;
<*UNUSED*> t : VBT.TimeStamp) =
<* LL = VBT.mu *>
BEGIN
IF Text.Equal(e, "stopatCodeEvents") THEN
NARROW(arg, T).stopatCodeEvents :=
FormsVBT.GetBoolean(fv, "stopatCodeEvents");
END;
IF Text.Equal(e, "waitatCodeEvents") THEN
NARROW(arg, T).waitatCodeEvents :=
FormsVBT.GetInteger(fv, "waitatCodeEvents");
END;
IF Text.Equal(e, "stopAtSetup") THEN
NARROW(arg, T).eventDataRec.stopAtSetup :=
FormsVBT.GetBoolean(fv, "stopAtSetup");
END;
IF Text.Equal(e, "waitAtSetup") THEN
NARROW(arg, T).eventDataRec.waitAtSetup :=
FormsVBT.GetInteger(fv, "waitAtSetup");
END;
IF Text.Equal(e, "stopAtInsert") THEN
NARROW(arg, T).eventDataRec.stopAtInsert :=
FormsVBT.GetBoolean(fv, "stopAtInsert");
END;
IF Text.Equal(e, "waitAtInsert") THEN
NARROW(arg, T).eventDataRec.waitAtInsert :=
FormsVBT.GetInteger(fv, "waitAtInsert");
END;
IF Text.Equal(e, "stopAtFind") THEN
NARROW(arg, T).eventDataRec.stopAtFind :=
FormsVBT.GetBoolean(fv, "stopAtFind");
END;
IF Text.Equal(e, "waitAtFind") THEN
NARROW(arg, T).eventDataRec.waitAtFind :=
FormsVBT.GetInteger(fv, "waitAtFind");
END;
IF Text.Equal(e, "stopAtDelete") THEN
NARROW(arg, T).eventDataRec.stopAtDelete :=
FormsVBT.GetBoolean(fv, "stopAtDelete");
END;
IF Text.Equal(e, "waitAtDelete") THEN
NARROW(arg, T).eventDataRec.waitAtDelete :=
FormsVBT.GetInteger(fv, "waitAtDelete");
END;
IF Text.Equal(e, "stopAtCompare") THEN
NARROW(arg, T).eventDataRec.stopAtCompare :=
FormsVBT.GetBoolean(fv, "stopAtCompare");
END;
IF Text.Equal(e, "waitAtCompare") THEN
NARROW(arg, T).eventDataRec.waitAtCompare :=
FormsVBT.GetInteger(fv, "waitAtCompare");
END;
IF Text.Equal(e, "stopAtCheckDeletable") THEN
NARROW(arg, T).eventDataRec.stopAtCheckDeletable :=
FormsVBT.GetBoolean(fv, "stopAtCheckDeletable");
END;
IF Text.Equal(e, "waitAtCheckDeletable") THEN
NARROW(arg, T).eventDataRec.waitAtCheckDeletable :=
FormsVBT.GetInteger(fv, "waitAtCheckDeletable");
END;
IF Text.Equal(e, "stopAtCheckHashPosition") THEN
NARROW(arg, T).eventDataRec.stopAtCheckHashPosition :=
FormsVBT.GetBoolean(fv, "stopAtCheckHashPosition");
END;
IF Text.Equal(e, "waitAtCheckHashPosition") THEN
NARROW(arg, T).eventDataRec.waitAtCheckHashPosition :=
FormsVBT.GetInteger(fv, "waitAtCheckHashPosition");
END;
IF Text.Equal(e, "stopAtAddToBucket") THEN
NARROW(arg, T).eventDataRec.stopAtAddToBucket :=
FormsVBT.GetBoolean(fv, "stopAtAddToBucket");
END;
IF Text.Equal(e, "waitAtAddToBucket") THEN
NARROW(arg, T).eventDataRec.waitAtAddToBucket :=
FormsVBT.GetInteger(fv, "waitAtAddToBucket");
END;
IF Text.Equal(e, "stopAtDeleteFromBucket") THEN
NARROW(arg, T).eventDataRec.stopAtDeleteFromBucket :=
FormsVBT.GetBoolean(fv, "stopAtDeleteFromBucket");
END;
IF Text.Equal(e, "waitAtDeleteFromBucket") THEN
NARROW(arg, T).eventDataRec.waitAtDeleteFromBucket :=
FormsVBT.GetInteger(fv, "waitAtDeleteFromBucket");
END;
END HashDoIt;
PROCEDURE HashRefreshCts (
<*UNUSED*> fv : FormsVBT.T;
<*UNUSED*> e : TEXT;
arg : REFANY;
<*UNUSED*> t : VBT.TimeStamp) =
<* LL = VBT.mu *>
BEGIN
NARROW(arg, T).updateEventCounts(FALSE);
END HashRefreshCts;
PROCEDURE FromFV (fv : FormsVBT.T; alg: T) =
<* LL = VBT.mu *>
BEGIN
alg.stopatCodeEvents :=
FormsVBT.GetBoolean(fv, "stopatCodeEvents");
alg.waitatCodeEvents :=
FormsVBT.GetInteger(fv, "waitatCodeEvents");
alg.eventDataRec.stopAtSetup :=
FormsVBT.GetBoolean(fv, "stopAtSetup");
alg.eventDataRec.waitAtSetup :=
FormsVBT.GetInteger(fv, "waitAtSetup");
alg.eventDataRec.stopAtInsert :=
FormsVBT.GetBoolean(fv, "stopAtInsert");
alg.eventDataRec.waitAtInsert :=
FormsVBT.GetInteger(fv, "waitAtInsert");
alg.eventDataRec.stopAtFind :=
FormsVBT.GetBoolean(fv, "stopAtFind");
alg.eventDataRec.waitAtFind :=
FormsVBT.GetInteger(fv, "waitAtFind");
alg.eventDataRec.stopAtDelete :=
FormsVBT.GetBoolean(fv, "stopAtDelete");
alg.eventDataRec.waitAtDelete :=
FormsVBT.GetInteger(fv, "waitAtDelete");
alg.eventDataRec.stopAtCompare :=
FormsVBT.GetBoolean(fv, "stopAtCompare");
alg.eventDataRec.waitAtCompare :=
FormsVBT.GetInteger(fv, "waitAtCompare");
alg.eventDataRec.stopAtCheckDeletable :=
FormsVBT.GetBoolean(fv, "stopAtCheckDeletable");
alg.eventDataRec.waitAtCheckDeletable :=
FormsVBT.GetInteger(fv, "waitAtCheckDeletable");
alg.eventDataRec.stopAtCheckHashPosition :=
FormsVBT.GetBoolean(fv, "stopAtCheckHashPosition");
alg.eventDataRec.waitAtCheckHashPosition :=
FormsVBT.GetInteger(fv, "waitAtCheckHashPosition");
alg.eventDataRec.stopAtAddToBucket :=
FormsVBT.GetBoolean(fv, "stopAtAddToBucket");
alg.eventDataRec.waitAtAddToBucket :=
FormsVBT.GetInteger(fv, "waitAtAddToBucket");
alg.eventDataRec.stopAtDeleteFromBucket :=
FormsVBT.GetBoolean(fv, "stopAtDeleteFromBucket");
alg.eventDataRec.waitAtDeleteFromBucket :=
FormsVBT.GetInteger(fv, "waitAtDeleteFromBucket");
END FromFV;
<*UNUSED*>
PROCEDURE ToFV (fv : FormsVBT.T; alg: T) =
<* LL = VBT.mu *>
BEGIN
FormsVBT.PutBoolean(fv, "stopatCodeEvents", alg.stopatCodeEvents);
FormsVBT.PutInteger(fv, "waitatCodeEvents", alg.waitatCodeEvents);
FormsVBT.PutBoolean(fv, "stopAtSetup",
alg.eventDataRec.stopAtSetup);
FormsVBT.PutInteger(fv, "waitAtSetup",
alg.eventDataRec.waitAtSetup);
FormsVBT.PutBoolean(fv, "stopAtInsert",
alg.eventDataRec.stopAtInsert);
FormsVBT.PutInteger(fv, "waitAtInsert",
alg.eventDataRec.waitAtInsert);
FormsVBT.PutBoolean(fv, "stopAtFind",
alg.eventDataRec.stopAtFind);
FormsVBT.PutInteger(fv, "waitAtFind",
alg.eventDataRec.waitAtFind);
FormsVBT.PutBoolean(fv, "stopAtDelete",
alg.eventDataRec.stopAtDelete);
FormsVBT.PutInteger(fv, "waitAtDelete",
alg.eventDataRec.waitAtDelete);
FormsVBT.PutBoolean(fv, "stopAtCompare",
alg.eventDataRec.stopAtCompare);
FormsVBT.PutInteger(fv, "waitAtCompare",
alg.eventDataRec.waitAtCompare);
FormsVBT.PutBoolean(fv, "stopAtCheckDeletable",
alg.eventDataRec.stopAtCheckDeletable);
FormsVBT.PutInteger(fv, "waitAtCheckDeletable",
alg.eventDataRec.waitAtCheckDeletable);
FormsVBT.PutBoolean(fv, "stopAtCheckHashPosition",
alg.eventDataRec.stopAtCheckHashPosition);
FormsVBT.PutInteger(fv, "waitAtCheckHashPosition",
alg.eventDataRec.waitAtCheckHashPosition);
FormsVBT.PutBoolean(fv, "stopAtAddToBucket",
alg.eventDataRec.stopAtAddToBucket);
FormsVBT.PutInteger(fv, "waitAtAddToBucket",
alg.eventDataRec.waitAtAddToBucket);
FormsVBT.PutBoolean(fv, "stopAtDeleteFromBucket",
alg.eventDataRec.stopAtDeleteFromBucket);
FormsVBT.PutInteger(fv, "waitAtDeleteFromBucket",
alg.eventDataRec.waitAtDeleteFromBucket);
CountsToFV (fv, alg);
END ToFV;
PROCEDURE CountsToFV (fv : FormsVBT.T; alg: T) =
<* LL = VBT.mu *>
BEGIN
FormsVBT.PutText(fv, "ctOfSetup",
Fmt.Int(alg.eventDataRec.ctOfSetup));
FormsVBT.PutText(fv, "ctOfInsert",
Fmt.Int(alg.eventDataRec.ctOfInsert));
FormsVBT.PutText(fv, "ctOfFind",
Fmt.Int(alg.eventDataRec.ctOfFind));
FormsVBT.PutText(fv, "ctOfDelete",
Fmt.Int(alg.eventDataRec.ctOfDelete));
FormsVBT.PutText(fv, "ctOfCompare",
Fmt.Int(alg.eventDataRec.ctOfCompare));
FormsVBT.PutText(fv, "ctOfCheckDeletable",
Fmt.Int(alg.eventDataRec.ctOfCheckDeletable));
FormsVBT.PutText(fv, "ctOfCheckHashPosition",
Fmt.Int(alg.eventDataRec.ctOfCheckHashPosition));
FormsVBT.PutText(fv, "ctOfAddToBucket",
Fmt.Int(alg.eventDataRec.ctOfAddToBucket));
FormsVBT.PutText(fv, "ctOfDeleteFromBucket",
Fmt.Int(alg.eventDataRec.ctOfDeleteFromBucket));
END CountsToFV;
PROCEDURE HashDefaultUpdateCts ( v: T; reset: BOOLEAN) =
<* LL = VBT.mu *>
BEGIN
IF reset THEN
v.eventDataRec.ctOfSetup := 0;
v.eventDataRec.ctOfInsert := 0;
v.eventDataRec.ctOfFind := 0;
v.eventDataRec.ctOfDelete := 0;
v.eventDataRec.ctOfCompare := 0;
v.eventDataRec.ctOfCheckDeletable := 0;
v.eventDataRec.ctOfCheckHashPosition := 0;
v.eventDataRec.ctOfAddToBucket := 0;
v.eventDataRec.ctOfDeleteFromBucket := 0;
END;
CountsToFV (v.eventData, v);
END HashDefaultUpdateCts;
PROCEDURE HashDefaultSnapshot (v: T; wr: Wr.T)
RAISES {ZeusClass.Error} =
<* LL = VBT.mu *>
BEGIN
TRY
Wr.PutChar(wr, '(')
EXCEPT
ELSE
RAISE ZeusClass.Error(
"HashAlgClass.HashDefaultSnapshot write error");
END;
IF v.eventData = NIL THEN
RAISE ZeusClass.Error(
"HashAlgClass.HashDefaultSnapshot: " &
"eventData not set!");
END;
TRY
v.eventData.snapshot(wr)
EXCEPT
FormsVBT.Error (msg) =>
RAISE ZeusClass.Error(
"HashAlgClass.HashDefaultSnapshot FV error: "
& msg);
ELSE
RAISE ZeusClass.Error(
"HashAlgClass.HashDefaultSnapshot error");
END;
Algorithm.T.snapshot(v, wr);
TRY
Wr.PutChar(wr, ')')
EXCEPT
ELSE
RAISE ZeusClass.Error(
"HashAlgClass.HashDefaultSnapshot write error");
END;
END HashDefaultSnapshot;
PROCEDURE HashDefaultRestore (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(
"HashAlgClass.HashDefaultRestore read error");
END;
IF v.eventData = NIL THEN
RAISE ZeusClass.Error(
"HashAlgClass.HashDefaultRestore: " &
"eventData not set!");
END;
TRY
v.eventData.restore(rd);
v.updateEventCounts(FALSE);
FromFV(v.eventData, v);
EXCEPT
ELSE
RAISE ZeusClass.Error(
"HashAlgClass.HashDefaultRestore error");
END;
Algorithm.T.restore(v, rd);
IF NOT ZeusUtil.EatChar(rd, ')') THEN
RAISE ZeusClass.Error(
"HashAlgClass.HashDefaultRestore read error");
END;
END HashDefaultRestore;
PROCEDURE ReportFind (self: T
; <*UNUSED*> item: TEXT
) =
<* LL = VBT.mu *>
BEGIN
self.evtHandled := FALSE;
END ReportFind;
PROCEDURE StopReportFind (self: T
) =
<* LL = VBT.mu *>
BEGIN
self.evtHandled := FALSE;
END StopReportFind;
BEGIN
END HashAlgClass.