package vishnu.testvis.dendro; import java.awt.*; import vishnu.testvis.object.*; import java.util.Vector; public class ClusterObj { Cluster cluster; Point position; int radius; boolean inSubCluster; private boolean orderStatus; private boolean keywordStatus; private String[] freqWords; DocObj[] _docs; // list of DocObj ref String _label; // (top 3-5? related words) DataManager _data; public ClusterObj(Cluster c, Point P, int r, DataManager data) { cluster = c; position = P; radius = r; inSubCluster = false; _data = data; orderStatus = false; keywordStatus = false; } public void setPosition(Point p) { position = p; } public void setOrderStatus(boolean b) { orderStatus = b; } public boolean getOrderStatus() { return orderStatus; } public void setFreqWords(String[] str) { freqWords = str; keywordStatus = true; } public String[] getFreqWords() { return freqWords; } public boolean getKeywordStatus() { return keywordStatus; } public void setIsSubset(boolean b) { inSubCluster = b; } public boolean getIsSubset() { return inSubCluster; } public boolean inCircle(int x, int y) { double dist_sqr = (x-position.x)*(x-position.x) + (y-position.y)*(y-position.y); return (dist_sqr <= (4*radius*radius)) ? true : false; } public void setDocObjs(DocObj[] docArray) { _docs = docArray; } public int getX() { return position.x; } public int getY() { return position.y; } public int getRad() { return radius; } public ClusterObj(DocObj[] d, String t, DataManager dm) { _docs=d; _label=t; _data = dm; } public int getDocsSize(){return _docs.length;} public String getLabel(){return _label;} public String getLabel1(){return getDocsSize() + " documents found";} public String getLabel2(){return getLabel();} public String getInfo(){ return getDocsSize() + " documents found\n" + getLabel(); } /** * This returns a list of list of documents. The inner list of documents represents * which documents have the corresponding related word * pre: _docs can't be null * @return a vector (same length as the related words) of * vectors (arbitrary length) * */ public Vector getHitDocFreq() { int s = _data.getWordCount(); Vector rwVec = new Vector(s); for(int i=0;i 0 ) ((Vector) rwVec.elementAt(i)).addElement(_docs[j]); } } return rwVec; } public int getDocSize() { return cluster._items; } public String formatDocs() { int l = getDocsSize(); String s = " "+ l +" documents found\n"; for(int i=0;i