[
https://issues.apache.org/jira/browse/STATISTICS-71?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17739392#comment-17739392
]
Gilles Sadowski commented on STATISTICS-71:
-------------------------------------------
{quote}[...] I included this signature is to possibly support [...]
{quote}
The fist step is to define the _minimal_ interface that would the support the
main functionality.
{quote}[...] I feel we might actually need 3 interfaces [...]
{quote}
Let's focus on the most useful functionality (i.e. handling the "double" type).
{quote}I feel its better to have Storeless as part of the interface name to
make it clear that it is a storeless implementation, [...]
{quote}
The point is that an _interface_ is *not* an implementation. The string
"storeless" cannot impose anything on an implementation. It's the
implementation that can "mark" itself.
{code:java}
public interface Storeless {}
{code}
{code:java}
class StorelessMean implements DoubleStatistics, Storeless {
// ... implementation "knows" that is storeless.
}
{code}
However we could have instead
{code:java}
public interface DoubleStatistics extends DoubleSupplier {
boolean isStoreless();
// ... "combine" ...
}
{code}
The latter would make the marker interface unnecessary, and also impose to
every implementation the behaviour of signalling whether it is storeless.
{quote}[...] cannot do certain things like compute rolling statistics for
instance.
{quote}
How could one expect a "rolling" functionality with the current definition of
the interface?
{quote}[...] kinds of combinations we want to restrict [...]
{quote}
{code:java}
Min a = new Min();
Max b = new Max();
// ...
a.combine(b); // ???
{code}
> Implementation of Univariate Statistics
> ---------------------------------------
>
> Key: STATISTICS-71
> URL: https://issues.apache.org/jira/browse/STATISTICS-71
> Project: Commons Statistics
> Issue Type: Task
> Components: descriptive
> Reporter: Anirudh Joshi
> Priority: Minor
> Labels: gsoc, gsoc2023
>
> Jira ticket to track the implementation of the Univariate statistics required
> for the updated SummaryStatistics API.
> The implementation would be "storeless". It should be used for calculating
> statistics that can be computed in one pass through the data without storing
> the sample values.
> Currently I have the definition of API as (this might evolve as I continue
> working)
> {code:java}
> public interface DoubleStorelessUnivariateStatistic extends DoubleSupplier {
> DoubleStorelessUnivariateStatistic add(double v);
> long getCount();
> void combine(DoubleStorelessUnivariateStatistic other);
> } {code}
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)