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

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

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy