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

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

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


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

import java.util.List;

public abstract class HistogramStat {

    double max;
    double min;
    List list;

    HistogramStat(C column) {
        //
    }

    public List stage() {
        return count(new Stage(min, max).split());
    }

    public List stage(int group) {
        return count(new Stage(min, max).split(group));
    }

    private List count(List data) {
        for (int i = 0; i < data.size(); i++) {
            count(data.get(i), (i == data.size() - 1));
        }
        return data;
    }

    private void count(Object[] objects, boolean last) {
        if (objects[0] instanceof Integer) {
            objects[2] = count((int)objects[0], (int)objects[1], last);
        } else if (objects[0] instanceof Long) {
            objects[2] = count((long)objects[0], (long)objects[1], last);
        } else if (objects[0] instanceof Double) {
            objects[2] = count((double)objects[0], (double)objects[1], last);
        }
    }

    abstract int count(double start, double end, boolean last);

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy