Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
DummyHCClusteringInfo |
|
| 1.8;1.8 |
1 | /* ======================================================================= | |
2 | * A visualisation library extension for JFreeChart. Please see JFreeChart | |
3 | * for further information. | |
4 | * ======================================================================= | |
5 | * Copyright (C) 2006 University of Helsinki, Department of Computer Science | |
6 | * | |
7 | * This library is free software; you can redistribute it and/or | |
8 | * modify it under the terms of the GNU Lesser General Public | |
9 | * License as published by the Free Software Foundation; either | |
10 | * version 2.1 of the License, or (at your option) any later version. | |
11 | * | |
12 | * This library is distributed in the hope that it will be useful, | |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 | * Lesser General Public License for more details. | |
16 | * | |
17 | * You should have received a copy of the GNU Lesser General Public | |
18 | * License along with this library; if not, write to the Free Software | |
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
20 | * ----------------------------- | |
21 | * Contact: ohtu@cs.helsinki.fi | |
22 | * ----------------------------- | |
23 | * | |
24 | */ | |
25 | ||
26 | package org.jfree.chart.plot; | |
27 | ||
28 | import java.util.Iterator; | |
29 | import java.util.LinkedList; | |
30 | import java.util.List; | |
31 | import java.util.Arrays; | |
32 | ||
33 | import javax.swing.event.ChangeEvent; | |
34 | import javax.swing.event.ChangeListener; | |
35 | ||
36 | import org.jfree.data.hc.HCTreeNode; | |
37 | import org.jfree.data.hc.DataRange; | |
38 | import org.jfree.chart.plot.AbstractHCClusteringInfo; | |
39 | ||
40 | /** | |
41 | * A class that stores information about the state of a clustering tree. | |
42 | * used in {@link HCPlot}. This is organized as a tree with the same topology | |
43 | * as the original clustering tree. | |
44 | * | |
45 | * @author viski project | |
46 | */ | |
47 | public class DummyHCClusteringInfo extends AbstractHCClusteringInfo { | |
48 | ||
49 | /** | |
50 | * Creates a new DummyHCClusteringInfo for non-clustered datasets | |
51 | * | |
52 | * @param names names of rows or columns. | |
53 | * @param location column or leaf tree? | |
54 | */ | |
55 | 22 | public DummyHCClusteringInfo(String[] names, int location) { |
56 | ||
57 | 22 | if ((location != HCPlot.LEFT) && (location != HCPlot.TOP)) |
58 | 2 | throw new IllegalArgumentException( |
59 | "location must be LEFT or RIGHT."); | |
60 | ||
61 | 20 | if (names == null) throw new NullPointerException( |
62 | "Names of a DummyHCClusteringInfo cannot be null."); | |
63 | 19 | this.location=location; |
64 | 19 | this.names = names; |
65 | 19 | this.listeners = new LinkedList(); |
66 | ||
67 | 19 | } |
68 | ||
69 | /** | |
70 | * Returns the visible data range. i.e. number of rows/columns | |
71 | * of a heatmap currently seen on the screen. | |
72 | * | |
73 | * @return The datarange specifying the visible indices. | |
74 | */ | |
75 | public int getNumberOfVisibleItems() { | |
76 | ||
77 | 3 | return this.names.length; |
78 | ||
79 | } | |
80 | ||
81 | /** | |
82 | * Return the names of visible rows/columns corresponding to | |
83 | * this clustering info object. | |
84 | * | |
85 | * @return a list object containing the names. | |
86 | */ | |
87 | public HCTreeNodeInfo getRootNode() { | |
88 | ||
89 | 1 | return null; |
90 | ||
91 | } | |
92 | ||
93 | /** | |
94 | * Return the HCTreeNodeInfo corresponding to the root node | |
95 | * of the clustering tree. | |
96 | * | |
97 | * @return the root node, or null, if the clustering tree does not exist. | |
98 | */ | |
99 | public List getNames() { | |
100 | ||
101 | 4 | return Arrays.asList(names); |
102 | ||
103 | } | |
104 | ||
105 | /** | |
106 | * Returns the indices of the dataset that | |
107 | * correspond to specified visible index | |
108 | * | |
109 | * @param row the row. | |
110 | * @return The datarange specifying the rows. | |
111 | */ | |
112 | public DataRange getDataRangeForVisibleIndex(int row) { | |
113 | ||
114 | 31 | return new DataRange(row,row); |
115 | } | |
116 | ||
117 | ||
118 | } |