io.virtdata.templates.CSVBindings Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of virtdata-lib-curves4 Show documentation
Show all versions of virtdata-lib-curves4 Show documentation
Statistical sampling library for use in virtualdataset libraries, based on apache commons math 4
package io.virtdata.templates;
import io.virtdata.api.Binder;
import io.virtdata.core.Bindings;
public class CSVBindings implements Binder {
private Bindings bindings;
private int bufferlen=0;
public CSVBindings(Bindings bindings) {
this.bindings = bindings;
}
@Override
public String bind(long value) {
Object[] all = bindings.getAll(value);
StringBuilder sb = new StringBuilder();
for (Object o : all) {
sb.append(o.toString());
sb.append(",");
}
sb.setLength(sb.length()-1);
if (sb.length()>bufferlen) {
bufferlen=sb.length()+5;
}
return sb.toString();
}
}