public class Median extends Percentile implements java.io.Serializable
Percentile
for a description of the algorithm used.
Note that this implementation is not synchronized. If
multiple threads access an instance of this class concurrently, and at least
one of the threads invokes the increment()
or
clear()
method, it must be synchronized externally.
Percentile.EstimationType
Modifier and Type | Field and Description |
---|---|
private static double |
FIXED_QUANTILE_50
Fixed quantile.
|
private static long |
serialVersionUID
Serializable version identifier
|
Modifier | Constructor and Description |
---|---|
|
Median()
Default constructor.
|
|
Median(Median original)
Copy constructor, creates a new
Median identical
to the original |
private |
Median(Percentile.EstimationType estimationType,
NaNStrategy nanStrategy,
KthSelector kthSelector)
|
Modifier and Type | Method and Description |
---|---|
Median |
withEstimationType(Percentile.EstimationType newEstimationType)
Build a new instance similar to the current one except for the
estimation type . |
Median |
withKthSelector(KthSelector newKthSelector)
Build a new instance similar to the current one except for the
kthSelector instance specifically set. |
Median |
withNaNStrategy(NaNStrategy newNaNStrategy)
Build a new instance similar to the current one except for the
NaN handling strategy. |
copy, copy, evaluate, evaluate, evaluate, evaluate, getEstimationType, getKthSelector, getNaNStrategy, getPivotingStrategy, getQuantile, getWorkArray, medianOf3, setData, setData, setQuantile
evaluate, evaluate, getData, getDataRef, test, test, test, test
private static final long serialVersionUID
private static final double FIXED_QUANTILE_50
public Median()
public Median(Median original) throws NullArgumentException
Median
identical
to the original
original
- the Median
instance to copyNullArgumentException
- if original is nullprivate Median(Percentile.EstimationType estimationType, NaNStrategy nanStrategy, KthSelector kthSelector) throws MathIllegalArgumentException
estimationType
- one of the percentile estimation types
nanStrategy
- one of NaNStrategy
to handle with NaNskthSelector
- KthSelector
to use for pivoting during searchMathIllegalArgumentException
- if p is not within (0,100]NullArgumentException
- if type or NaNStrategy passed is nullpublic Median withEstimationType(Percentile.EstimationType newEstimationType)
estimation type
.
This method is intended to be used as part of a fluent-type builder pattern. Building finely tune instances should be done as follows:
Percentile customized = new Percentile(quantile). withEstimationType(estimationType). withNaNStrategy(nanStrategy). withKthSelector(kthSelector);
If any of the withXxx
method is omitted, the default value for
the corresponding customization parameter will be used.
withEstimationType
in class Percentile
newEstimationType
- estimation type for the new instancepublic Median withNaNStrategy(NaNStrategy newNaNStrategy)
NaN handling
strategy.
This method is intended to be used as part of a fluent-type builder pattern. Building finely tune instances should be done as follows:
Percentile customized = new Percentile(quantile). withEstimationType(estimationType). withNaNStrategy(nanStrategy). withKthSelector(kthSelector);
If any of the withXxx
method is omitted, the default value for
the corresponding customization parameter will be used.
withNaNStrategy
in class Percentile
newNaNStrategy
- NaN strategy for the new instancepublic Median withKthSelector(KthSelector newKthSelector)
kthSelector
instance specifically set.
This method is intended to be used as part of a fluent-type builder pattern. Building finely tune instances should be done as follows:
Percentile customized = new Percentile(quantile). withEstimationType(estimationType). withNaNStrategy(nanStrategy). withKthSelector(newKthSelector);
If any of the withXxx
method is omitted, the default value for
the corresponding customization parameter will be used.
withKthSelector
in class Percentile
newKthSelector
- KthSelector for the new instance