source: branches/autoquest-core-tasktrees-alignment/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/matrix/UPGMAMatrix.java @ 1736

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

Even more cleanup

File size: 1.2 KB
Line 
1/*
2 *
3 */
4package de.ugoe.cs.autoquest.tasktrees.alignment.matrix;
5
6// TODO: Auto-generated Javadoc
7/**
8 * The Class UPGMAMatrix.
9 */
10public class UPGMAMatrix extends StaticTriangleMatrix {
11
12        /**
13         *
14         */
15        private static final long serialVersionUID = 1L;
16
17        /**
18         * Instantiates a new UPGMA matrix.
19         *
20         * @param size the size of the matrix
21         */
22        public UPGMAMatrix(int size) {
23                super(size);
24        }
25
26        /* (non-Javadoc)
27         * @see de.ugoe.cs.autoquest.tasktrees.alignment.matrix.StaticTriangleMatrix#size()
28         */
29        @Override
30        public int size() {
31                return size;
32        }
33
34        /* (non-Javadoc)
35         * @see de.ugoe.cs.autoquest.tasktrees.alignment.matrix.StaticTriangleMatrix#toString()
36         */
37        @Override
38        public String toString() {
39                String result = "";
40                for (int i = 0; i < size; i++) {
41                        result = result + String.format("%8d", i);
42                }
43                result += "\n";
44
45                for (int i = 0; i < size; i++) {
46                        for (int j = 0; j < size; j++) {
47                                if (i < j) {
48                                        if (Double.isInfinite(this.get(i, j))) {
49                                                result = result + " -------";
50                                        } else {
51                                                result = result
52                                                                + String.format("%+8.2f", this.get(i, j));
53                                        }
54                                } else {
55                                        result = result + ("        ");
56                                }
57                        }
58                        result = result + "   " + i + "\n";
59                }
60                return result;
61        }
62
63}
Note: See TracBrowser for help on using the repository browser.