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