<> <> <> <> <> <> <> <, where their bounds are specified at creation time. Again, all counters are allocated, so keep bounds reasonable.>> DIRECTORY IO, Rope, ViewerClasses; Histograms: CEDAR DEFINITIONS = { ROPE: TYPE = Rope.ROPE; Histogram: TYPE = REF HistogramRep; HistogramRep: TYPE; Create1D: PROC --makes a 1D histogram [ factor: REAL _ 1.0, --center x = (I+0.5)*factor + offset offset: REAL _ -0.5] RETURNS [Histogram]; <> Create2D: PROC [ iMin, iMax, jMin, jMax: INT, --bounds are inclusive on both ends iFactor, jFactor: REAL _ 1.0, --center x = (I+0.5)*iFactor + iOffset iOffset, jOffset: REAL _ 0.0] --center y = (J+0.5)*jFactor + jOffset RETURNS [Histogram]; Increment: PROC [h: Histogram, i: NAT] = INLINE {Change[h, i, 1]}; <> Decrement: PROC [h: Histogram, i: NAT] = INLINE {Change[h, i, -1]}; <> Change: PROC [h: Histogram, who: NAT, howMuch: INTEGER]; <> IncrementTransformed: PROC [h: Histogram, xmin, xmax, x: REAL]; <> ChangeTransformed: PROC [h: Histogram, x: REAL, y: REAL _ 0.0, delta: INTEGER _ 1]; <> ClearAll: PROC [h: Histogram]; <> Stats1D: PROC [h: Histogram] RETURNS [sum0: INT, sum1, sum2, avg, stdDev, xmin, xmax: REAL]; < pairs, each saying that there are n counts in the bin centered on x.>> <> <> <> <> <> <> <> <xmax { sum0=0>> Stats2D: PROC [h: Histogram] RETURNS [sum0: INT, sumx, sumy: REAL]; WriteTo: PROC [h: Histogram, to: IO.STREAM]; <> Show: PROC [ h: Histogram, viewerInit: ViewerClasses.ViewerRec _ [], format: ROPE _ NIL, --NIL means "%d" width: NAT _ 0, --max number of chars produced when formatting updatePeriod: REAL _ -1.0, --If > 0, every updatePeriod seconds the viewer is repainted if it's out of date. If updatePeriod=0, the viewer is painted every time something changes. If updatePeriod<0, the viewer is never automatically repainted. paint: BOOL _ TRUE] RETURNS [ViewerClasses.Viewer]; <> Error: ERROR [msg: ROPE]; }.