fuzzycsv.AbstractAggregator.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fuzzy-csv Show documentation
Show all versions of fuzzy-csv Show documentation
A groovy/java tabular Data (from CSV,SQL,JSON) processing library that supports fuzzy column matching,tranformations/merging/querying etc
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
}
}