Class CountByType

  • All Implemented Interfaces:
    java.io.Serializable

    public class CountByType
    extends java.lang.Object
    implements java.io.Serializable
    Counters indexed by 'type' (type is a generic string that can mean anything)
    Author:
    pcingola
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String TOTAL_TYPE  
    • Constructor Summary

      Constructors 
      Constructor Description
      CountByType()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      long addScore​(java.lang.String type, double score)
      Add score for a type
      boolean contains​(java.lang.String key)  
      long get​(java.lang.String type)
      How many counts of this type?
      java.lang.String getColorHtml​(java.lang.String type)
      Background color used for table (heatmap)
      long getCount​(java.lang.String type)
      Count for this type
      double getScore​(java.lang.String type)
      Score for this type
      long getTotalCount()  
      java.util.List<java.lang.String> getTypeList()
      List all types (alphabetically sorted) We need it as a getter for summary page (freemarker)
      boolean hasCount​(java.lang.String type)  
      boolean hasData()  
      boolean hasScore​(java.lang.String type)  
      long inc​(java.lang.String type)  
      long inc​(java.lang.String type, int increment)
      Increment counter for a given type
      boolean isEmpty()
      Is this empty
      java.util.Set<java.lang.String> keySet()  
      java.util.List<java.lang.String> keysRanked​(boolean reverse)
      List all types (sorted by count)
      java.util.List<java.lang.String> keysSorted()
      List all types (alphabetically sorted)
      long max()
      Maximum count
      long min()
      Minimum count
      double percent​(java.lang.String type)
      Percentage by type
      java.util.Map<java.lang.String,​java.lang.Integer> ranks​(boolean reverse)
      A map: key -> rank(counts)
      void remove​(java.lang.String type)
      Remove this entry type
      void setScore​(java.lang.String type, double score)  
      long sum()
      Sum all counts.
      java.lang.String toString()  
      java.lang.String toString​(boolean showScores)  
      java.lang.String toString​(java.lang.String type)  
      java.lang.String toStringLine()  
      java.lang.String toStringSort()  
      java.lang.String toStringTop​(int n)  
      • Methods inherited from class java.lang.Object

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

      • CountByType

        public CountByType()
    • Method Detail

      • addScore

        public long addScore​(java.lang.String type,
                             double score)
        Add score for a type
      • contains

        public boolean contains​(java.lang.String key)
      • get

        public long get​(java.lang.String type)
        How many counts of this type?
      • getColorHtml

        public java.lang.String getColorHtml​(java.lang.String type)
        Background color used for table (heatmap)
        Returns:
        An html coded color
      • getCount

        public long getCount​(java.lang.String type)
        Count for this type
      • getScore

        public double getScore​(java.lang.String type)
        Score for this type
      • getTotalCount

        public long getTotalCount()
      • getTypeList

        public java.util.List<java.lang.String> getTypeList()
        List all types (alphabetically sorted) We need it as a getter for summary page (freemarker)
      • hasCount

        public boolean hasCount​(java.lang.String type)
      • hasData

        public boolean hasData()
      • hasScore

        public boolean hasScore​(java.lang.String type)
      • inc

        public long inc​(java.lang.String type)
      • inc

        public long inc​(java.lang.String type,
                        int increment)
        Increment counter for a given type
      • isEmpty

        public boolean isEmpty()
        Is this empty
      • keySet

        public java.util.Set<java.lang.String> keySet()
      • keysRanked

        public java.util.List<java.lang.String> keysRanked​(boolean reverse)
        List all types (sorted by count)
      • keysSorted

        public java.util.List<java.lang.String> keysSorted()
        List all types (alphabetically sorted)
      • max

        public long max()
        Maximum count
      • min

        public long min()
        Minimum count
      • percent

        public double percent​(java.lang.String type)
        Percentage by type
      • ranks

        public java.util.Map<java.lang.String,​java.lang.Integer> ranks​(boolean reverse)
        A map: key -> rank(counts)
      • remove

        public void remove​(java.lang.String type)
        Remove this entry type
      • setScore

        public void setScore​(java.lang.String type,
                             double score)
      • sum

        public long sum()
        Sum all counts.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • toString

        public java.lang.String toString​(boolean showScores)
      • toString

        public java.lang.String toString​(java.lang.String type)
      • toStringLine

        public java.lang.String toStringLine()
      • toStringSort

        public java.lang.String toStringSort()
      • toStringTop

        public java.lang.String toStringTop​(int n)