1 | /* |
---|
2 | * This program is free software; you can redistribute it and/or modify |
---|
3 | * it under the terms of the GNU General Public License as published by |
---|
4 | * the Free Software Foundation; either version 2 of the License, or |
---|
5 | * (at your option) any later version. |
---|
6 | * |
---|
7 | * This program is distributed in the hope that it will be useful, |
---|
8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
10 | * GNU General Public License for more details. |
---|
11 | * |
---|
12 | * You should have received a copy of the GNU General Public License |
---|
13 | * along with this program; if not, write to the Free Software |
---|
14 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
---|
15 | */ |
---|
16 | |
---|
17 | /* |
---|
18 | * ChartEvent.java |
---|
19 | * Copyright (C) 2002 University of Waikato, Hamilton, New Zealand |
---|
20 | * |
---|
21 | */ |
---|
22 | |
---|
23 | package weka.gui.beans; |
---|
24 | |
---|
25 | import java.util.EventObject; |
---|
26 | import java.util.Vector; |
---|
27 | |
---|
28 | /** |
---|
29 | * Event encapsulating info for plotting a data point on the StripChart |
---|
30 | * |
---|
31 | * @author <a href="mailto:mhall@cs.waikato.ac.nz">Mark Hall</a> |
---|
32 | * @version $Revision: 1.4 $ |
---|
33 | */ |
---|
34 | public class ChartEvent |
---|
35 | extends EventObject { |
---|
36 | |
---|
37 | /** for serialization */ |
---|
38 | private static final long serialVersionUID = 7812460715499569390L; |
---|
39 | |
---|
40 | private Vector m_legendText; |
---|
41 | private double m_max; |
---|
42 | private double m_min; |
---|
43 | |
---|
44 | private boolean m_reset; |
---|
45 | |
---|
46 | /** |
---|
47 | * Y values of the data points |
---|
48 | */ |
---|
49 | private double [] m_dataPoint; |
---|
50 | |
---|
51 | /** |
---|
52 | * Creates a new <code>ChartEvent</code> instance. |
---|
53 | * |
---|
54 | * @param source the source of the event |
---|
55 | * @param legendText a vector of strings to display in the legend |
---|
56 | * @param min minimum y value |
---|
57 | * @param max maximum y value |
---|
58 | * @param dataPoint an array of y values to plot |
---|
59 | * @param reset true if display is to be reset |
---|
60 | */ |
---|
61 | public ChartEvent(Object source, Vector legendText, double min, double max, |
---|
62 | double [] dataPoint, boolean reset) { |
---|
63 | super(source); |
---|
64 | m_legendText = legendText; |
---|
65 | m_max = max; |
---|
66 | m_min = min; |
---|
67 | m_dataPoint = dataPoint; |
---|
68 | m_reset = reset; |
---|
69 | } |
---|
70 | |
---|
71 | /** |
---|
72 | * Creates a new <code>ChartEvent</code> instance. |
---|
73 | * |
---|
74 | * @param source the source of the event |
---|
75 | */ |
---|
76 | public ChartEvent(Object source) { |
---|
77 | super(source); |
---|
78 | } |
---|
79 | |
---|
80 | /** |
---|
81 | * Get the legend text vector |
---|
82 | * |
---|
83 | * @return a <code>Vector</code> value |
---|
84 | */ |
---|
85 | public Vector getLegendText() { |
---|
86 | return m_legendText; |
---|
87 | } |
---|
88 | |
---|
89 | /** |
---|
90 | * Set the legend text vector |
---|
91 | * |
---|
92 | * @param lt a <code>Vector</code> value |
---|
93 | */ |
---|
94 | public void setLegendText(Vector lt) { |
---|
95 | m_legendText = lt; |
---|
96 | } |
---|
97 | |
---|
98 | /** |
---|
99 | * Get the min y value |
---|
100 | * |
---|
101 | * @return a <code>double</code> value |
---|
102 | */ |
---|
103 | public double getMin() { |
---|
104 | return m_min; |
---|
105 | } |
---|
106 | |
---|
107 | /** |
---|
108 | * Set the min y value |
---|
109 | * |
---|
110 | * @param m a <code>double</code> value |
---|
111 | */ |
---|
112 | public void setMin(double m) { |
---|
113 | m_min = m; |
---|
114 | } |
---|
115 | |
---|
116 | /** |
---|
117 | * Get the max y value |
---|
118 | * |
---|
119 | * @return a <code>double</code> value |
---|
120 | */ |
---|
121 | public double getMax() { |
---|
122 | return m_max; |
---|
123 | } |
---|
124 | |
---|
125 | /** |
---|
126 | * Set the max y value |
---|
127 | * |
---|
128 | * @param m a <code>double</code> value |
---|
129 | */ |
---|
130 | public void setMax(double m) { |
---|
131 | m_max = m; |
---|
132 | } |
---|
133 | |
---|
134 | /** |
---|
135 | * Get the data point |
---|
136 | * |
---|
137 | * @return a <code>double[]</code> value |
---|
138 | */ |
---|
139 | public double [] getDataPoint() { |
---|
140 | return m_dataPoint; |
---|
141 | } |
---|
142 | |
---|
143 | /** |
---|
144 | * Set the data point |
---|
145 | * |
---|
146 | * @param dp a <code>double[]</code> value |
---|
147 | */ |
---|
148 | public void setDataPoint(double [] dp) { |
---|
149 | m_dataPoint = dp; |
---|
150 | } |
---|
151 | |
---|
152 | /** |
---|
153 | * Set the reset flag |
---|
154 | * |
---|
155 | * @param reset a <code>boolean</code> value |
---|
156 | */ |
---|
157 | public void setReset(boolean reset) { |
---|
158 | m_reset = reset; |
---|
159 | } |
---|
160 | |
---|
161 | /** |
---|
162 | * get the value of the reset flag |
---|
163 | * |
---|
164 | * @return a <code>boolean</code> value |
---|
165 | */ |
---|
166 | public boolean getReset() { |
---|
167 | return m_reset; |
---|
168 | } |
---|
169 | } |
---|