/*
 * 
 * Copyright (c) Siemens AG 2008 
 *           (c) Universität Paderborn 2008 
 * Licensed under EUPL 1.1. 
 * Created on May 2, 2005
 */
package vkc.clusterer;

import java.util.HashSet;

/**
 * Klasse stellt ein Cluster dar
 */
public class ClusteringItem {
    private boolean			planeHierarchy = false;
    
    private int 			recursivDocCounts = 0; // Anzahl alller im Cluster selbst und in den Subclsutern enthaltenen Dokumente 

    private Integer 		clusterID 	= null; // ClusterId im Dendogram
    private Integer 		heapID 		= null; // ClusterID im IndexedHeap
    private Integer			parentID    = null; // ParnetID im Dendogram

    private HashSet			subCluster 	= new HashSet(); // IDs der Kinder im Dendogram
    private HashSet			documentIds = new HashSet(); //VKCDocument-Ids der enthalten Dokumente
    private HashSet			recursivDocumentIds = new HashSet(); //VKCDocument-Ids der enthalten Dokumente
    private HashSet			documents	= new HashSet();
    private HashSet			terms		= new HashSet();
    
    private String 			name		= null;
    private String			description = "";
    
    public ClusteringItem() {
        super();
    }

    /**
     * @return Returns the documentIds.
     */
    public HashSet getDocumentIds() {
        return documentIds;
    }
    
    /**
     * @param documentIds The documentIds to set.
     */
    public void addDocumentId(Integer documentId) {
        this.documentIds.add(documentId);
    }
    
    /**
     * @return Returns the number of Subclusters of a Cluster.
     */
    public int getNumSubCluster() {
        return subCluster.size();
    }
    
    /**
     * @param Get the number of documents in a Cluster.
     */
    public int getSize(){
        return documentIds.size();
    }
    
    /**
     * @return Returns the subCluster.
     */
    public HashSet getSubCluster() {
        return subCluster;
    }
    
    /**
     * @param subCluster The subCluster to set.
     */
    public void addSubCluster(Integer subCluster) {
        this.subCluster.add(subCluster);
    }

    /**
     * @return Returns the clusterID.
     */
    public Integer getClusterID() {
        return clusterID;
    }
    
    /**
     * @param clusterID The clusterID to set.
     */
    public void setClusterID(Integer clusterID) {
        this.clusterID = clusterID;
    }

    public boolean isSingleDocumentWithoutSubcluster() {
        return subCluster.size() == 0 && documentIds.size() == 1;
    }

    public boolean isMultipleDocumentWithoutSubcluster() {
        return subCluster.size() == 0 && documentIds.size() > 1;
    }

    public boolean isSingleDocumentWithSubcluster() {
        return subCluster.size() > 0 && documentIds.size() == 1;
    }

    public boolean isMultipleDocumentWithSubcluster() {
        return subCluster.size() > 0 && documentIds.size() > 1;
    }

    /**
     * @return Returns the parentID.
     */
    public Integer getParentID() {
        return parentID;
    }
    
    /**
     * @param parentID The parentID to set.
     */
    public void setParentID(Integer parentID) {
        this.parentID = parentID;
    }
    
    /**
     * @return Returns the recursivDocCounts.
     */
    public int getRecursivDocCounts() {
        return recursivDocCounts;
    }
    
    /**
     * @param recursivDocCounts The recursivDocCounts to set.
     */
    public void setRecursivDocCounts(int recursivDocCounts) {
        this.recursivDocCounts = recursivDocCounts;
    }
    
    /**
     * @return Returns the documents.
     */
    public HashSet getDocuments() {
        return documents;
    }
    
    /**
     * @param documents The documents to set.
     */
    public void setDocuments(HashSet documents) {
        this.documents = documents;
    }
    
    /**
     * @return Returns the name.
     */
    public String getName() {
        return name;
    }
    
    /**
     * @param name The name to set.
     */
    public void setName(String name) {
        this.name = name;
    }
    
    /**
     * @return Returns the heapID.
     */
    public Integer getHeapID() {
        return heapID;
    }
    
    /**
     * @param heapID The heapID to set.
     */
    public void setHeapID(Integer heapID) {
        this.heapID = heapID;
    }
    
    /**
     * @return Returns the terms.
     */
    public HashSet getTerms() {
        return terms;
    }
    
    /**
     * @return Returns the recursivDocumentIds.
     */
    public HashSet getRecursivDocumentIds() {
        return recursivDocumentIds;
    }
    
    /**
     * @param recursivDocumentIds The recursivDocumentIds to set.
     */
    public void setRecursivDocumentIds(HashSet recursivDocumentIds) {
        this.recursivDocumentIds = recursivDocumentIds;
    }

    public String getDescription() {
        return description;
    }
    
    public void setDescription(String description) {
        this.description = description;
    }

    public boolean isPlaneHierarchy() {
        return planeHierarchy;
    }
    
    public void setPlaneHierarchy(boolean planeHierarchy) {
        this.planeHierarchy = planeHierarchy;
    }
}