All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.datastax.data.exploration.biz.stat.histogram.DateTimeHistogram Maven / Gradle / Ivy

package com.datastax.data.exploration.biz.stat.histogram;

import com.datastax.data.exploration.biz.datatable.column.DateTimeColumn;

import java.util.Date;
import java.util.stream.Collectors;

public class DateTimeHistogram extends HistogramStat {

    public DateTimeHistogram(DateTimeColumn 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();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy