/**
 * Created by bing on 4/20/17.
 */
public class KMeans {

    private DistanceFunction df;
    private MeanFunction mf;
    private CentroidGenerator cg;
    private double[][] data;
    private double[][] centroids;
    private int k;

    /**
     * The constructor of KMeans class
     * @param k the k value
     * @param data the input data set
     * @param df the distance function
     * @param cg the centroid generator function
     * @param mf the mean function
     */
    public KMeans(int k,double[][] data,DistanceFunction df,CentroidGenerator cg,MeanFunction mf){
        this.k = k;
        this.data = data;
        this.df = df;
        this.mf = mf;
        this.cg = cg;
        try {
            centroids = cg.generate(k,data);
        } catch (EmptyDataSetException e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    /**
     * The constructor of KMeans class with standard mean function
     * @param k the k value
     * @param data the input data set
     * @param df the distance function
     * @param cg the centroid generator function
     */
    public KMeans(int k,double[][] data, DistanceFunction df, CentroidGenerator cg){
        this(k,data,df,cg,new StandardMeanFunction());
    }

    /**
     * The short constructor of KMeans class with standard mean function, Euclidean distance function, and random centroid generator.
     * @param k the k value
     * @param data the input data set
     */
    public KMeans(int k, double[][] data){
        this(k,data,new Euclidean(), new RandomCentroidGenerator());
    }

}

@@ -1589,10 +1589,538 @@
 %0A    %7D%0A%0A
+    /**%0A     * Change distance function%0A     * @param df the distance function%0A     */%0A    public void setDistanceFunction(DistanceFunction df)%7B%0A        this.df = df;%0A    %7D%0A%0A    /**%0A     * Change mean function%0A     * @param mf the mean function%0A     */%0A    public void setMeanFunction(MeanFunction mf)%7B%0A        this.mf = mf;%0A    %7D%0A%0A    /**%0A     * Change centroid generator function%0A     * @param cg the centroid generator function%0A     */%0A    public void setCentroidGenerator(CentroidGenerator cg)%7B%0A        this.cg = cg;%0A    %7D%0A%0A
 %7D%0A

add setters Changes to be committed: modified: src/main/java/KMeans.java