Clover coverage report - baseCode - 0.2.5 Coverage timestamp: Tue Apr 12 2005 11:31:58 EDT FRAMES NO FRAMES |
file stats: | LOC: | 46 |  | Methods: | 1
| NCLOC: | 21 |  | Classes: | 1
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
AverageLinkageDistancer.java | 0% | 0% | 0% | 0% |

1 |  |
     package baseCode.algorithm.learning.unsupervised.cluster;
2 |  |
3 |  |
     import java.util.Collection;
4 |  |
     import java.util.Iterator;
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: AverageLinkageDistancer.java,v 1.3 2004/08/02 15:03:43 pavlidis Exp $
15 |  |
      */
16 |  |
     public class AverageLinkageDistancer implements Distancer {
17 |  |
18 |  |
        /*
19 |  |
         * (non-Javadoc)
20 |  |
         *
21 |  |
         * @see baseCode.algorithm.learning.unsupervised.cluster.Distance#distance(java.lang.Object, java.lang.Object)
22 |  |
         */
23 | 0 |
        public double distance( Distanceable a, Distanceable b ) {
24 |  |
25 | 0 |
           double mean = 0.0;
26 | 0 |
           int numComparisons = 0;
27 |  |
28 | 0 |
           Collection ac = a.toCollection();
29 | 0 |
           Collection bc = b.toCollection();
30 |  |
31 | 0 |
           for ( Iterator iter = ac.iterator(); iter.hasNext(); ) {
32 | 0 |
              Distanceable elementA = ( Distanceable ) iter.next();
33 |  |
34 | 0 |
              for ( Iterator iterator = bc.iterator(); iterator
35 |  |
                    .hasNext(); ) {
36 | 0 |
                 Distanceable elementB = ( Distanceable ) iterator.next();
37 | 0 |
                 mean += elementA.distanceTo( elementB );
38 | 0 |
                 numComparisons++;
39 |  |
              }
40 |  |
41 |  |
           }
42 |  |
43 | 0 |
           return mean / numComparisons;
44 |  |
45 |  |
        }
46 |  |
     }