com.datastax.data.exploration.biz.stat.histogram.TimeHistogram Maven / Gradle / Ivy
package com.datastax.data.exploration.biz.stat.histogram;
import com.datastax.data.exploration.biz.datatable.column.TimeColumn;
import java.util.Date;
import java.util.stream.Collectors;
public class TimeHistogram extends HistogramStat {
public TimeHistogram(TimeColumn 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();
}
}