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

datastructs.RowBuilder Maven / Gradle / Ivy

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);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy