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

fuzzycsv.AbstractAggregator.groovy Maven / Gradle / Ivy

Go to download

A groovy/java tabular Data (from CSV,SQL,JSON) processing library that supports fuzzy column matching,tranformations/merging/querying etc

There is a newer version: 1.9.1-groovy4
Show newest version
package fuzzycsv

import groovy.transform.CompileStatic

import static fuzzycsv.FuzzyCSVTable.tbl


@CompileStatic
abstract class AbstractAggregator implements Aggregator {

    FuzzyCSVTable data
    String columnName


    List getData(List columns) {

        def requiredData
        if (columns == null || columns.isEmpty()) {
            requiredData = data.csv
        } else {
            requiredData = FuzzyCSV.select(columns, data.csv, Mode.STRICT)
        }
        def newData = requiredData[1..-1]
        return newData
    }

    void setData(List data) {
        this.data = tbl(data)
    }


    @Override
    Aggregator az(String name) {
        columnName = name; this
    }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy