01: package JSci.awt;
02:
03: import java.util.EventObject;
04:
05: /**
06: * Defines an event that encapsulates changes to a graph.
07: * @version 1.1
08: * @author Mark Hale
09: */
10: public final class GraphDataEvent extends EventObject {
11: /**
12: * Specifies all series.
13: */
14: public static final int ALL_SERIES = -1;
15:
16: private final int series;
17: private final boolean isIncremental;
18:
19: /**
20: * All series data in the graph has changed.
21: */
22: public GraphDataEvent(Object src) {
23: this (src, ALL_SERIES, false);
24: }
25:
26: /**
27: * This series has changed.
28: * @param seriesChanged The index of the series that may have changed.
29: */
30: public GraphDataEvent(Object src, int seriesChanged) {
31: this (src, seriesChanged, false);
32: }
33:
34: /**
35: * This series has changed incrementally.
36: * Useful for streaming data to a graph.
37: * @param seriesChanged The index of the series that may have changed.
38: * @param isIncrementalChange True indicates an extra data point has been added.
39: */
40: public GraphDataEvent(Object src, int seriesChanged,
41: boolean isIncrementalChange) {
42: super (src);
43: series = seriesChanged;
44: isIncremental = isIncrementalChange;
45: }
46:
47: /**
48: * Returns the series that has changed.
49: * @return The index of the series that may have changed or ALL_SERIES.
50: */
51: public int getSeries() {
52: return series;
53: }
54:
55: /**
56: * Returns whether the change was incremental.
57: * @return True if an extra data point has been added.
58: */
59: public boolean isIncremental() {
60: return isIncremental;
61: }
62: }
|