Permalink
Browse files

fix IntegerStats not serializable due to inner class

  • Loading branch information...
ssadedin committed Aug 13, 2018
1 parent 0e9404a commit c7a59a818f9a05d7255f01956cc48bfdb221b5a8
Showing with 15 additions and 10 deletions.
  1. +15 −10 src/main/java/graxxia/IntegerStats.java
@@ -44,15 +44,7 @@
int total = 0;
/**
*
* @param maxPercentileValue
*/
public IntegerStats(int maxPercentileValue) {
values = new int[maxPercentileValue];
Arrays.fill(values, 0);
this.setSumLogImpl(new StorelessUnivariateStatistic() {
static class SerializableStorelessUnivariateStatistic implements StorelessUnivariateStatistic, Serializable {
@Override
public double evaluate(double[] values, int begin, int length) throws MathIllegalArgumentException {
return 0;
@@ -93,7 +85,20 @@ public StorelessUnivariateStatistic copy() {
@Override
public void clear() {
}
});
};
/**
*
* @param maxPercentileValue
*/
public IntegerStats(int maxPercentileValue) {
values = new int[maxPercentileValue];
Arrays.fill(values, 0);
// This is because in benchmarking I found this statistic that I never use
// is very computationally intensive to compute. So I instead make a dummy that
// bypasses computing it.
this.setSumLogImpl(new SerializableStorelessUnivariateStatistic());
}
public IntegerStats(int maxPercentileValue, InputStream inStream) throws IOException {

0 comments on commit c7a59a8

Please sign in to comment.