package gr.iti.mklab.simmo.core.cluster;

import org.apache.commons.lang3.tuple.Pair;
import org.bson.types.ObjectId;
import org.mongodb.morphia.annotations.Entity;
import org.mongodb.morphia.annotations.Id;
import org.mongodb.morphia.annotations.Reference;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * A Cluster class
 *
 * @author kandreadou
 * @version 1.0.0
 * @since March 26, 2015
 */
@Entity
public class Cluster {

    @Id
    protected String id = new ObjectId().toString();

    @Reference
    protected List<Clusterable> members = new ArrayList<>();

    protected int size;

    protected Date startDate;
    
    protected Date endDate;
    
	protected Clusterable centroid;
	
    protected List<Map<String, String>> centroids = new ArrayList<Map<String, String>>();
    
    public List<Map<String, String>> getCentroids() {
		return centroids;
	}

	public void setCentroids(List<Map<String, String>> centroids) {
		this.centroids = centroids;
	}

	public void addCentroid(Map<String, String> centroid) {
		this.centroids.add(centroid);
	}
	
	public Clusterable getCentroid() {
		return centroid;
	}
    
	public void setCentroid(Clusterable centroid) {
		this.centroid = centroid;
	}
    
    public Cluster() {
    }

    public void addMember(Clusterable c) {
        members.add(c);
    }

    public void removeMember(Clusterable c) {
        members.remove(c);
    }

    public int getSize() {
        return size;
    }

    public Date getStartDate() {
		return startDate;
	}

	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}

	public Date getEndDate() {
		return endDate;
	}

	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}

	public void setSize(int size) {
        this.size = size;
    }

    public List<Clusterable> getMembers() {
        return members;
    }

    public void setMembers(List<Clusterable> members){
        this.members = members;
    }

    public String getId() {
        return id;
    }
    
    public void setId(String id) {
        this.id = id;
    }
}

@@ -39,52 +39,8 @@
 r;%0A%0A
-import org.apache.commons.lang3.tuple.Pair;%0A
 impo
@@ -263,34 +263,8 @@
 te;%0A
-import java.util.HashMap;%0A
 impo
@@ -699,20 +699,246 @@
 roid;%0A%09%0A
-    
+%09protected Map%3CString, Double%3E avgDistances;%0A%09%0A    public Map%3CString, Double%3E getAvgDistance() %7B%0A%09%09return avgDistances;%0A%09%7D%0A%0A%09public void setAvgDistances(Map%3CString, Double%3E avgDistances) %7B%0A%09%09this.avgDistances = avgDistances;%0A%09%7D%0A%0A%09
 protecte

Fix cluster