|
|||||||||||||||||||
| 30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| Cluster.java | - | 0% | 0% | 0% |
|
||||||||||||||
| 1 |
package baseCode.algorithm.learning.unsupervised.cluster;
|
|
| 2 |
|
|
| 3 |
import java.util.Collection;
|
|
| 4 |
import java.util.Vector;
|
|
| 5 |
|
|
| 6 |
import baseCode.common.Distanceable;
|
|
| 7 |
|
|
| 8 |
/**
|
|
| 9 |
* <hr>
|
|
| 10 |
* <p>
|
|
| 11 |
* Copyright (c) 2004 Columbia University
|
|
| 12 |
*
|
|
| 13 |
* @author pavlidis
|
|
| 14 |
* @version $Id: Cluster.java,v 1.3 2004/08/11 22:53:43 pavlidis Exp $
|
|
| 15 |
*/
|
|
| 16 |
public class Cluster extends Distanceable { |
|
| 17 |
|
|
| 18 |
protected Distancer distAlg;
|
|
| 19 |
protected Collection items;
|
|
| 20 |
|
|
| 21 | 0 |
public Cluster() {}
|
| 22 |
|
|
| 23 | 0 |
public Cluster(Object item, Distancer distAlg) {
|
| 24 | 0 |
this.distAlg = distAlg;
|
| 25 | 0 |
Vector v = new Vector();
|
| 26 | 0 |
v.add(item); |
| 27 | 0 |
this.items = v;
|
| 28 |
} |
|
| 29 |
|
|
| 30 | 0 |
public Cluster( Collection items, Distancer distAlg ) {
|
| 31 | 0 |
this.distAlg = distAlg;
|
| 32 | 0 |
this.items = items;
|
| 33 |
} |
|
| 34 |
|
|
| 35 | 0 |
public void addItem(Cluster item ) { |
| 36 |
|
|
| 37 |
} |
|
| 38 |
|
|
| 39 |
/**
|
|
| 40 |
*
|
|
| 41 |
* @return true if this cluster is made up of multiple distanceables, or multiple ones.
|
|
| 42 |
*/
|
|
| 43 | 0 |
public boolean isCompound() { |
| 44 | 0 |
return items != null && items.size() > 1; |
| 45 |
} |
|
| 46 |
|
|
| 47 |
|
|
| 48 |
/*
|
|
| 49 |
* (non-Javadoc)
|
|
| 50 |
*
|
|
| 51 |
* @see baseCode.common.Distanceable#distanceTo(baseCode.common.Distanceable)
|
|
| 52 |
*/
|
|
| 53 | 0 |
public double distanceTo( Distanceable a ) { |
| 54 | 0 |
return this.distAlg.distance( this, a ); |
| 55 |
} |
|
| 56 |
|
|
| 57 |
/*
|
|
| 58 |
* (non-Javadoc)
|
|
| 59 |
*
|
|
| 60 |
* @see java.lang.Comparable#compareTo(java.lang.Object)
|
|
| 61 |
*/
|
|
| 62 | 0 |
public int compareTo( Object o ) { |
| 63 |
// TODO Auto-generated method stub
|
|
| 64 | 0 |
return 0;
|
| 65 |
} |
|
| 66 |
|
|
| 67 |
/*
|
|
| 68 |
* (non-Javadoc)
|
|
| 69 |
*
|
|
| 70 |
* @see baseCode.common.Distanceable#toCollection()
|
|
| 71 |
*/
|
|
| 72 | 0 |
public Collection toCollection() {
|
| 73 | 0 |
return items;
|
| 74 |
} |
|
| 75 |
|
|
| 76 |
} |
|
||||||||||