com.datastax.data.exploration.biz.stat.histogram.DateHistogram Maven / Gradle / Ivy
The newest version!
package com.datastax.data.exploration.biz.stat.histogram;
import com.datastax.data.exploration.biz.datatable.column.DateColumn;
import java.util.Date;
import java.util.stream.Collectors;
public class DateHistogram extends HistogramStat {
public DateHistogram(DateColumn column) {
super(column);
this.max = column.max().getTime();
this.min = column.min().getTime();
this.list = column.getNotNullValues().stream().map(Date::getTime).collect(Collectors.toList());
}
@Override
int count(double start, double end, boolean last) {
if (last)
return (int) list.stream().filter(v -> (v >= start && v <= end)).count();
return (int) list.stream().filter(v -> (v >= start && v < end)).count();
}
}