1 | public final class ChartChangeEventType implements Serializable {↵ | | 1 | public final class RangeType implements Serializable {↵
|
|
2 | /** For serialization. */↵ | | 2 | /** For serialization. */↵
|
3 | private static final long serialVersionUID = 5481917022435735602L;↵ | | 3 | private static final long serialVersionUID = -9073319010650549239L;↵
|
4 | ↵ | | 4 | ↵
|
5 | /** GENERAL. */↵ | | 5 | /** ↵
|
6 | public static final ChartChangeEventType GENERAL ↵ | | |
|
7 | = new ChartChangeEventType("ChartChangeEventType.GENERA↵ | | 6 | Full range (positive and negative). */↵
|
8 | L");↵ | | 7 | public static final RangeType FULL = new RangeType("RangeType.FULL");↵
|
|
9 | /** NEW_DATASET. */↵ | | 8 | /** Positive range. */↵
|
10 | public static final ChartChangeEventType NEW_DATASET ↵ | | 9 | public static final ↵
|
11 | = new ChartChangeEventType("ChartChangeEventType.NEW_DATASET");↵ | | |
|
|
12 | /** DATASET_UPDATED. */↵ | | |
|
13 | public static final ChartChangeEventType DATASET_UPDATED↵ | | |
|
14 | = new ChartChangeEventType("ChartChangeEventType.DATASET_UPDATED↵ | | 10 | RangeType POSITIVE ↵
|
| | | 11 | = new RangeType("RangeType.POSITIVE");↵
|
|
| | | 12 | /** Negative range. */↵
|
| | | 13 | public static final RangeType NEGATIVE ↵
|
15 | ");↵ | | 14 | = new RangeType("RangeType.NEGATIVE");↵
|
|
16 | /** The name. */↵ | | 15 | /** The name. */↵
|
17 | private String name;↵ | | 16 | private String name;↵
|
|
18 | /**↵ | | 17 | /**↵
|
19 | * Private constructor.↵ | | 18 | * Private constructor.↵
|
20 | *↵ | | 19 | *↵
|
21 | * @param name the name.↵ | | 20 | * @param name the name.↵
|
22 | */↵ | | 21 | */↵
|
23 | private ChartChangeEventType(String name) {↵ | | 22 | private RangeType(String name) {↵
|
24 | this.name = name;↵ | | 23 | this.name = name;↵
|
25 | }↵ | | 24 | }↵
|
|
26 | /**↵ | | 25 | /**↵
|
27 | * Returns a string representing the object.↵ | | 26 | * Returns a string representing the object.↵
|
28 | *↵ | | 27 | *↵
|
29 | * @return The string.↵ | | 28 | * @return The string.↵
|
30 | */↵ | | 29 | */↵
|
31 | public String toString() {↵ | | 30 | public String toString() {↵
|
32 | return this.name;↵ | | 31 | return this.name;↵
|
33 | }↵ | | 32 | }↵
|
|
34 | /**↵ | | 33 | /**↵
|
35 | * Returns <code>true</code> if this object is equal to the specified ↵ | | 34 | * Returns <code>true</code> if this object is equal to the specified ↵
|
36 | * object, and <code>false</code> otherwise.↵ | | 35 | * object, and <code>false</code> otherwise.↵
|
37 | *↵ | | 36 | *↵
|
38 | * @param obj the object (<code>null</code> permitted).↵ | | 37 | * @param obj the other object.↵
|
39 | *↵ | | 38 | *↵
|
40 | * @return A boolean.↵ | | 39 | * @return A boolean.↵
|
41 | */↵ | | 40 | */↵
|
42 | public boolean equals(Object obj) {↵ | | 41 | public boolean equals(Object obj) {↵
|
|
43 | if (this == obj) {↵ | | 42 | if (this == obj) {↵
|
44 | return true;↵ | | 43 | return true;↵
|
45 | }↵ | | 44 | }↵
|
46 | if (!(obj instanceof ChartChangeEventType)) {↵ | | 45 | if (!(obj instanceof RangeType)) {↵
|
47 | return false;↵ | | 46 | return false;↵
|
48 | }↵ | | 47 | }↵
|
49 | ChartChangeEventType that = (ChartChangeEventType) obj;↵ | | 48 | RangeType that = (RangeType) obj;↵
|
50 | if (!this.name.equals(that.toString())) {↵ | | 49 | if (!this.name.equals(that.toString())) {↵
|
51 | return false;↵ | | 50 | return false;↵
|
52 | }↵ | | 51 | }↵
|
53 | return true;↵ | | 52 | return true;↵
|
54 | }↵ | | 53 | }↵
|
55 | ↵ | | 54 | ↵
|
56 | /**↵ | | 55 | /**↵
|
57 | * Returns a hash code value for the object.↵ | | 56 | * Returns a hash code value for the object.↵
|
58 | *↵ | | 57 | *↵
|
59 | * @return The hashcode↵ | | 58 | * @return The hashcode↵
|
60 | */↵ | | 59 | */↵
|
61 | public int hashCode() {↵ | | 60 | public int hashCode() {↵
|
62 | return this.name.hashCode();↵ | | 61 | return this.name.hashCode();↵
|
63 | }↵ | | 62 | }↵
|
|
64 | /**↵ | | 63 | /**↵
|
65 | * Ensures that serialization returns the unique instances.↵ | | 64 | * Ensures that serialization returns the unique instances.↵
|
66 | * ↵ | | 65 | * ↵
|
67 | * @return The object.↵ | | 66 | * @return The object.↵
|
68 | * ↵ | | 67 | * ↵
|
69 | * @throws ObjectStreamException if there is a problem.↵ | | 68 | * @throws ObjectStreamException if there is a problem.↵
|
70 | */↵ | | 69 | */↵
|
71 | private Object readResolve() throws ObjectStreamException {↵ | | 70 | private Object readResolve() throws ObjectStreamException {↵
|
72 | if (this.equals(ChartChangeEventType.GENERAL)) {↵ | | 71 | if (this.equals(↵
|
73 | return ChartChangeEventType.GENERA↵ | | 72 | RangeType.FULL)) {↵
|
74 | L;↵ | | 73 | return RangeType.FULL;↵
|
75 | }↵ | | 74 | }↵
|
76 | else if (this.equals(ChartChangeEventType.NEW_DATASET)) {↵ | | 75 | else if (this.equals(↵
|
77 | return ChartChangeEventType.NEW_DATASET↵ | | 76 | RangeType.POSITIVE)) {↵
|
78 | ;↵ | | 77 | return RangeType.POSITIVE;↵
|
79 | }↵ | | 78 | }↵
|
80 | else if (this.equals(ChartChangeEventType.DATASET_UPDATED)) {↵ | | 79 | else if (this.equals(↵
|
81 | return ChartChangeEventType.DATASET_UPDATED↵ | | 80 | RangeType.NEGATIVE)) {↵
|
82 | ;↵ | | 81 | return RangeType.NEGATIVE;↵
|
83 | }↵ | | 82 | }↵
|
84 | return null | | 83 | return null
|