source: branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/matrix/UPGMAMatrix.java @ 1572

Last change on this file since 1572 was 1572, checked in by rkrimmel, 10 years ago

Added parts of the PAL library, implemented UPGMA Algoritm for Feng Doolittle guide tree

File size: 813 bytes
Line 
1package de.ugoe.cs.autoquest.tasktrees.alignment.matrix;
2
3import de.ugoe.cs.autoquest.tasktrees.alignment.pal.misc.Identifier;
4
5
6public class UPGMAMatrix extends TriangleMatrix {
7
8        public UPGMAMatrix(int size) {
9                super(size);
10        }
11
12        public int size() {
13                return size;
14        }
15
16        public String toString() {
17                String result = "";
18                for (int i = 0; i < size; i++) {
19                        result = result + String.format("%8d", i);
20                }
21                result += "\n";
22               
23                for (int i = 0; i < size; i++) {
24                        for(int j = 0; j< size; j++) {
25                                if(i<j) {
26                                        if(Double.isInfinite(this.get(i,j))) {
27                                                result = result + " -------";
28                                        }
29                                        else {
30                                                result = result + String.format("%+8.2f",this.get(i,j));
31                                        }
32                                }
33                                else {
34                                        result = result + ("        ");
35                                }
36                        }
37                        result = result + "   " + i + "\n";
38                }
39                return result;
40        }
41
42       
43
44}
Note: See TracBrowser for help on using the repository browser.