datastructs.RowBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jstat Show documentation
Show all versions of jstat Show documentation
Java Library for Statistical Analysis.
The newest version!
package datastructs;
import datastructs.DoubleVectorBuilder;
import datastructs.IRowBuilder;
import datastructs.IntegerVectorBuilder;
import datastructs.RowType;
import java.util.HashMap;
import java.util.Map;
public class RowBuilder {
private static Map> elementBuilder = new HashMap<>();
static
{
elementBuilder.put(RowType.Type.DOUBLE_VECTOR, new DoubleVectorBuilder());
elementBuilder.put(RowType.Type.INTEGER_VECTOR, new IntegerVectorBuilder());
}
public Row build(RowType.Type type){
return (Row) elementBuilder.get(type).create();
}
public Row build(RowType.Type type, int n){
return (Row) elementBuilder.get(type).create(n);
}
public Row build(RowType.Type type, T... vals){
return (Row) elementBuilder.get(type).create(vals);
}
}