com.datastax.data.exploration.biz.stat.histogram.DecimalHistogram Maven / Gradle / Ivy
The newest version!
package com.datastax.data.exploration.biz.stat.histogram;
import com.datastax.data.exploration.biz.datatable.column.DecimalColumn;
import java.math.BigDecimal;
public class DecimalHistogram extends HistogramStat {
public DecimalHistogram(DecimalColumn column) {
super(column);
this.max = column.getStat().max();
this.min = column.getStat().min();
this.list = column.getNotNullValues();
}
@Override
int count(double start, double end, boolean last) {
if (last)
return (int) list.stream().filter(v -> (v.doubleValue() >= start && v.doubleValue() <= end)).count();
return (int) list.stream().filter(v -> (v.doubleValue() >= start && v.doubleValue() < end)).count();
}
}