Class LongFrequency

java.lang.Object
org.hipparchus.stat.Frequency<Long>
org.hipparchus.stat.LongFrequency
All Implemented Interfaces:
Serializable

public class LongFrequency extends Frequency<Long>
Maintains a frequency distribution of Long values.

Accepts byte, short, int, long primitive or Integer and Long values.

Integer values (byte, short, int, long, Integer, Long) are not distinguished by type, i.e. addValue(Long.valueOf(2)), addValue(2), addValue(2L) all have the same effect (similarly for arguments to getCount() etc.).

NOTE: byte and short values will be implicitly converted to int values by the compiler, thus there are no explicit overloaded methods for these primitive types.

The values are ordered using the default (natural order), unless a Comparator is supplied in the constructor.

See Also:
  • Constructor Details

    • LongFrequency

      public LongFrequency()
      Default constructor.
    • LongFrequency

      public LongFrequency(Comparator<? super Long> comparator)
      Constructor allowing values Comparator to be specified.
      Parameters:
      comparator - Comparator used to order values
  • Method Details

    • addValue

      public void addValue(int v)
      Adds 1 to the frequency count for v.
      Parameters:
      v - the value to add.
    • incrementValue

      public void incrementValue(int v, long increment)
      Increments the frequency count for v.
      Parameters:
      v - the value to add.
      increment - the amount by which the value should be incremented
    • getCount

      public long getCount(int v)
      Returns the number of values equal to v.
      Parameters:
      v - the value to lookup.
      Returns:
      the frequency of v.
    • getPct

      public double getPct(int v)
      Returns the percentage of values that are equal to v (as a proportion between 0 and 1).

      Returns Double.NaN if no values have been added.

      Parameters:
      v - the value to lookup
      Returns:
      the proportion of values equal to v
    • getCumFreq

      public long getCumFreq(int v)
      Returns the cumulative frequency of values less than or equal to v.
      Parameters:
      v - the value to lookup.
      Returns:
      the proportion of values equal to v
    • getCumPct

      public double getCumPct(int v)
      Returns the cumulative percentage of values less than or equal to v (as a proportion between 0 and 1).

      Returns Double.NaN if no values have been added.

      Parameters:
      v - the value to lookup
      Returns:
      the proportion of values less than or equal to v