V
- The type of the comparable objectspublic class ComparableDistribution<V extends java.lang.Comparable<V>> extends Distribution<V>
Constructor | Description |
---|---|
ComparableDistribution(CountMap<V> counts) |
Default constructor
|
Modifier and Type | Method | Description |
---|---|---|
java.util.stream.Stream<org.apache.commons.lang3.tuple.ImmutablePair<V,java.lang.Integer>> |
allCounts() |
Get a map from object to count for all objects
|
java.util.stream.Stream<org.apache.commons.lang3.tuple.ImmutablePair<V,java.lang.Double>> |
allProportions() |
Got a map from object to proportion (of total count) for each object
|
static <W extends java.lang.Comparable<W>> |
constantDistribution(W w) |
Creates a constant distribution - ia distribution containing a single object
|
int |
countGreaterThan(V v) |
Returns the count of objects greater than the given object
|
int |
countGreaterThanEqual(V v) |
Returns the count of objects greater than or equal to the given object
|
int |
countLessThan(V v) |
Returns the count of objects less than the given object
|
int |
countLessThanEqual(V v) |
Returns the count of objects less than or equal the given object
|
ComparableDistribution<V> |
limitTo(V lower,
V upper) |
Create a new distribution only containing objects between lower and upper
|
V |
max() |
Gets the maximum object
|
V |
min() |
Gets the minimum object
|
double |
proportionGreaterThan(V v) |
Returns the proportion of objects greater than the given object
|
double |
proportionGreaterThanEqual(V v) |
Returns the proportion of objects greater than or equal to the given object
|
double |
proportionLessThan(V v) |
Returns the proportion of objects less than the given object
|
double |
proportionLessThanEqual(V v) |
Returns the proportion of objects less than or equal to the given object
|
getCount, getProportion, getTotal, sample
public V min()
public V max()
public ComparableDistribution<V> limitTo(V lower, V upper)
lower
- The lower objectupper
- The upper objectpublic java.util.stream.Stream<org.apache.commons.lang3.tuple.ImmutablePair<V,java.lang.Integer>> allCounts()
allCounts
in class Distribution<V extends java.lang.Comparable<V>>
public java.util.stream.Stream<org.apache.commons.lang3.tuple.ImmutablePair<V,java.lang.Double>> allProportions()
allProportions
in class Distribution<V extends java.lang.Comparable<V>>
public int countLessThan(V v)
v
- The given objectpublic double proportionLessThan(V v)
v
- The given objectpublic int countLessThanEqual(V v)
v
- The given objectpublic double proportionLessThanEqual(V v)
v
- The given objectpublic int countGreaterThan(V v)
v
- The given objectpublic double proportionGreaterThan(V v)
v
- The given objectpublic int countGreaterThanEqual(V v)
v
- The given objectpublic double proportionGreaterThanEqual(V v)
v
- The given objectpublic static <W extends java.lang.Comparable<W>> ComparableDistribution<W> constantDistribution(W w)
W
- Type of the objectw
- The object