Skip to content

Commit 17a6110

Browse files
committed
Added text on SimpleHistogram
1 parent ad36634 commit 17a6110

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

docs/manual.adoc

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -829,3 +829,37 @@ public class Histogram extends PrecisionHistogram
829829
----
830830

831831
When an instance of Histogram is created, the maximum number of allowed buckets must be specified. The merging algorithm can also be provided, with the default being the MEAN policy.
832+
833+
==== SimpleHistogram
834+
835+
As with the Histogram class above, SimpleHistogram keeps the number of assigned buckets to a minimum. However, it does this by pre-creating the buckets when it is created, i.e., the number of required buckets must be provided at the start. A width is the assigned for each bucket, and whenever a value if given to the histogram class it is placed into the bucket whose width it falls within.
836+
837+
----
838+
public class SimpleHistogram extends PrecisionHistogram
839+
{
840+
public SimpleHistogram (double min, double max, long nbuckets);
841+
public SimpleHistogram (double min, double max, double w);
842+
843+
public void setValue (double value) throws IllegalArgumentException;
844+
845+
public void reset ();
846+
847+
public double sizeByName (double name) throws IllegalArgumentException;
848+
849+
public double width ();
850+
851+
public void print ();
852+
853+
public boolean saveState (String fileName) throws IOException;
854+
public boolean saveState (DataOutputStream oFile) throws IOException;
855+
856+
public boolean restoreState (String fileName) throws FileNotFoundException, IOException;
857+
public boolean restoreState (DataInputStream iFile) throws IOException;
858+
};
859+
----
860+
861+
When the class is instantiated, the range of values it will receive must be provided. Then, either the width of each bucket or the actual number of buckets can be given. If the width is
862+
provided, then the histogram automatically calculates the number of buckets, otherwise it calculates the width for each bucket by equally dividing the range between each bucket.
863+
The values of a bucket can be obtained from the sizeByName method.
864+
865+
The width of each bucket is provided by the width method.

0 commit comments

Comments
 (0)