Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
HeatMap |
|
| 1.2857142857142858;1.286 |
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 | ||
27 | package org.jfree.data.hc; | |
28 | ||
29 | import org.jfree.data.xy.MatrixSeries; | |
30 | ||
31 | /** | |
32 | * A class representing a heatmap of a {@link HCDataset}. | |
33 | * @author viski project | |
34 | */ | |
35 | public class HeatMap extends MatrixSeries { | |
36 | ||
37 | /** The rownames matrix. */ | |
38 | private String[] rowNames; | |
39 | /** The columnnames matrix. */ | |
40 | private String[] columnNames; | |
41 | ||
42 | ||
43 | /** | |
44 | * Creates a new heatmap matrix. | |
45 | * | |
46 | * @param name the name of the heatmap. | |
47 | * @param rows the amount of rows. | |
48 | * @param columns the amount of columns. | |
49 | */ | |
50 | public HeatMap(String name, int rows, int columns) { | |
51 | ||
52 | 26 | super(name, rows, columns); |
53 | ||
54 | int i; | |
55 | ||
56 | 25 | this.rowNames = new String[rows]; |
57 | 25 | this.columnNames = new String[columns]; |
58 | 25 | for (i = 0; i < rows; i++) this.rowNames[i] = ""; |
59 | 25 | for (i = 0; i < columns; i++) this.columnNames[i] = ""; |
60 | ||
61 | 25 | } |
62 | ||
63 | /** | |
64 | * Returns the names of all rows. | |
65 | * | |
66 | * @return The names of the rows.. | |
67 | */ | |
68 | public String[] getRowNames() { | |
69 | ||
70 | 20 | return this.rowNames; |
71 | } | |
72 | ||
73 | /** | |
74 | * Returns the names of all columns. | |
75 | * | |
76 | * @return The names of the columns. | |
77 | */ | |
78 | public String[] getColumnNames() { | |
79 | ||
80 | 20 | return this.columnNames; |
81 | } | |
82 | ||
83 | /** | |
84 | * Sets the name of a row. | |
85 | * | |
86 | * @param row the row to be named. | |
87 | * @param name the name. | |
88 | */ | |
89 | public void setRowName(int row, String name) { | |
90 | ||
91 | 5 | this.rowNames[row] = name; |
92 | 5 | } |
93 | ||
94 | /** | |
95 | * Returns the name of a row. | |
96 | * | |
97 | * @param row the row. | |
98 | * | |
99 | * @return The name of this row. | |
100 | */ | |
101 | public String getRowName(int row) { | |
102 | ||
103 | 5 | return this.rowNames[row]; |
104 | } | |
105 | ||
106 | /** | |
107 | * Sets the name of a column. | |
108 | * | |
109 | * @param column the column to be named. | |
110 | * @param name the name. | |
111 | */ | |
112 | public void setColumnName(int column, String name) { | |
113 | ||
114 | 5 | this.columnNames[column] = name; |
115 | 5 | } |
116 | ||
117 | /** | |
118 | * Returns the name of a column. | |
119 | * | |
120 | * @param column the column. | |
121 | * | |
122 | * @return The name. | |
123 | */ | |
124 | public String getColumnName(int column) { | |
125 | ||
126 | 5 | return this.columnNames[column]; |
127 | } | |
128 | } |