Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
SOMItemEntity |
|
| 2.2;2.2 |
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 | * ----------------------------- | |
22 | * Contact: ohtu@cs.helsinki.fi | |
23 | * ----------------------------- | |
24 | * ___________________ | |
25 | * SOMItemEntity.java | |
26 | * | |
27 | * Created on 18. hein�kuuta 2006, 1:22 | |
28 | * | |
29 | * To change this template, choose Tools | Options and locate the template under | |
30 | * the Source Creation and Management node. Right-click the template and choose | |
31 | * Open. You can then make changes to the template in the Source Editor. | |
32 | * | |
33 | */ | |
34 | ||
35 | package org.jfree.chart.entity; | |
36 | ||
37 | import org.jfree.chart.entity.ChartEntity; | |
38 | import org.jfree.data.som.*; | |
39 | ||
40 | import java.awt.Shape; | |
41 | ||
42 | /** | |
43 | * A chart entity that represents one item in a {@link SOMPlot}. | |
44 | * @author viski project, Univ. Helsinki | |
45 | */ | |
46 | public class SOMItemEntity extends ChartEntity { | |
47 | ||
48 | /** The dataset. */ | |
49 | protected SOMDataset dataset; | |
50 | /** The x coordinate in the SOM map. */ | |
51 | protected int x; | |
52 | /** The y coordinate in the SOM map. */ | |
53 | protected int y; | |
54 | ||
55 | /** | |
56 | * Creates a new entity. | |
57 | * | |
58 | * @param area the area. | |
59 | * @param dataset the dataset. Null value not allowed. | |
60 | * @param x the x coordinate. Must be non-negative. | |
61 | * @param y the y coordinate. Must be non-negative. | |
62 | * @param toolTipText the tool tip text. Null allowed. | |
63 | * @param urlText the URL text for HTML imagemaps. Null allowed. | |
64 | * @throws IllegalArgumentException If dataset == null or x < 0 or y < 0. | |
65 | */ | |
66 | public SOMItemEntity(Shape area, | |
67 | SOMDataset dataset, | |
68 | int x, int y, | |
69 | String toolTipText, | |
70 | String urlText) { | |
71 | 26 | super(area, toolTipText, urlText); |
72 | 25 | if (dataset == null) |
73 | 1 | throw new IllegalArgumentException("dataset was null"); |
74 | 24 | if (x < 0) |
75 | 1 | throw new IllegalArgumentException("x was negative"); |
76 | 23 | if (y < 0) |
77 | 1 | throw new IllegalArgumentException("y was negative"); |
78 | 22 | this.dataset = dataset; |
79 | 22 | this.x = x; |
80 | 22 | this.y = y; |
81 | 22 | } |
82 | ||
83 | /** | |
84 | * Returns the dataset this entity refers to. | |
85 | * | |
86 | * @return The dataset. | |
87 | */ | |
88 | public SOMDataset getDataset() { | |
89 | 15 | return this.dataset; |
90 | } | |
91 | ||
92 | /** | |
93 | * Sets the dataset this entity refers to. | |
94 | * | |
95 | * @param the dataset. | |
96 | */ | |
97 | public void setDataset(SOMDataset dataset) { | |
98 | 1 | this.dataset = dataset; |
99 | 1 | } |
100 | ||
101 | /** | |
102 | * Returns the x coordinate of this entity. | |
103 | * | |
104 | * @return The x coordinate. | |
105 | */ | |
106 | public int getX() { | |
107 | 13 | return this.x; |
108 | } | |
109 | ||
110 | /** | |
111 | * Returns the y coordinate of this entity. | |
112 | * | |
113 | * @return The y coordinate. | |
114 | */ | |
115 | public int getY() { | |
116 | 13 | return this.y; |
117 | } | |
118 | ||
119 | } |