Class Histogram

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Histogram.Bucket  
    • Constructor Summary

      Constructors 
      Constructor Description
      Histogram()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.util.List<Histogram.Bucket> cluster​(java.util.List<StatisticsEntry> entries)
      Cluster entries into buckets.
      protected java.util.Comparator<? super StatisticsEntry> comparator()
      Determine how entries are being sorted from top to bottom.
      java.util.List<java.lang.String> formatReport​(java.util.List<StatisticsEntry> entries)
      Return a list of report lines.
      protected java.lang.String label​(StatisticsEntry entry)
      Determine how entries are being labelled in the histogram.
      protected int maxDrawRange()
      Determine how many block characters are maximally used to draw the distribution.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Histogram

        public Histogram()
    • Method Detail

      • formatReport

        public java.util.List<java.lang.String> formatReport​(java.util.List<StatisticsEntry> entries)
        Description copied from interface: StatisticsReportFormat
        Return a list of report lines. Often, one line will represent one entry but that must not necessarily be the case.
        Specified by:
        formatReport in interface StatisticsReportFormat
        Returns:
        All report lines. No trailing `CR` or `LF` characters are needed.
        See Also:
        StatisticsEntry
      • maxDrawRange

        protected int maxDrawRange()
        Determine how many block characters are maximally used to draw the distribution. The more you have the further the histogram extends to the right.

        Can be overridden.

        Returns:
        A positive number. Default is 80.
      • comparator

        protected java.util.Comparator<? super StatisticsEntry> comparator()
        Determine how entries are being sorted from top to bottom.

        Can be overridden.

        Returns:
        A comparator instance.
      • label

        protected java.lang.String label​(StatisticsEntry entry)
        Determine how entries are being labelled in the histogram.

        Can be overridden.

        Parameters:
        entry -
        Returns:
        A non-null string
      • cluster

        protected java.util.List<Histogram.Bucket> cluster​(java.util.List<StatisticsEntry> entries)
        Cluster entries into buckets.

        Override if entries should be aggregated into buckets to display in histogram.

        Parameters:
        entries - An already sorted list of entries
        Returns:
        A sorted list of buckets