1 | public final class CategoryAnchor implements Serializable {↵ | | 1 | public final class DialShape implements Serializable {↵
|
|
2 | /** For serialization. */↵ | | 2 | /** For serialization. */↵
|
3 | private static final long serialVersionUID = -2604142742210173810L;↵ | | 3 | private static final long serialVersionUID = -3471933055190251131L;↵
|
4 | ↵ | | 4 | ↵
|
5 | /** Start of period. */↵ | | 5 | /** Circle. */↵
|
6 | public static final CategoryAnchor START ↵ | | 6 | public static final ↵
|
7 | = new CategoryAnchor("CategoryAnchor.START");↵ | | |
|
|
8 | /** Middle of period. */↵ | | |
|
9 | public static final CategoryAnchor MIDDLE ↵ | | |
|
10 | = new CategoryAnchor("CategoryAnchor.MIDDLE↵ | | 7 | DialShape CIRCLE = new DialShape("DialShape.CIRCLE");↵
|
|
| | | 8 | /** Chord. */↵
|
11 | ");↵ | | 9 | public static final DialShape CHORD = new DialShape("DialShape.CHORD");↵
|
|
12 | /** End of period. */↵ | | 10 | /** Pie. */↵
|
13 | public static final CategoryAnchor END ↵ | | 11 | public static final ↵
|
14 | = new CategoryAnchor("CategoryAnchor.END");↵ | | 12 | 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 CategoryAnchor(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 other object.↵ | | 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 CategoryAnchor)) {↵ | | 43 | if (!(obj instanceof DialShape)) {↵
|
46 | return false;↵ | | 44 | return false;↵
|
47 | }↵ | | 45 | }↵
|
48 | CategoryAnchor position = (CategoryAnchor) obj;↵ | | 46 | DialShape shape = (DialShape) obj;↵
|
49 | if (!this.name.equals(position.toString())) {↵ | | 47 | if (!this.name.equals(shape.toString())) {↵
|
50 | return false;↵ | | 48 | return false;↵
|
51 | }↵ | | 49 | }↵
|
52 | return true;↵ | | 50 | return true;↵
|
| | | 51 | }↵
|
| | | 52 | ↵
|
| | | 53 | /**↵
|
| | | 54 | * Returns a hash code for this instance.↵
|
| | | 55 | * ↵
|
| | | 56 | * @return A hash code.↵
|
| | | 57 | */↵
|
| | | 58 | public int hashCode() {↵
|
| | | 59 | return this.name.hashCode();↵
|
53 | }↵ | | 60 | }↵
|
54 | ↵ | | 61 | ↵
|
55 | /**↵ | | 62 | /**↵
|
56 | * Ensures that serialization returns the unique instances.↵ | | 63 | * Ensures that serialization returns the unique instances.↵
|
57 | * ↵ | | 64 | * ↵
|
58 | * @return The object.↵ | | 65 | * @return The object.↵
|
59 | * ↵ | | 66 | * ↵
|
60 | * @throws ObjectStreamException if there is a problem.↵ | | 67 | * @throws ObjectStreamException if there is a problem.↵
|
61 | */↵ | | 68 | */↵
|
62 | private Object readResolve() throws ObjectStreamException {↵ | | 69 | private Object readResolve() throws ObjectStreamException {↵
|
63 | if (this.equals(CategoryAnchor.START)) {↵ | | 70 | if (this.equals(DialShape.CIRCLE)) {↵
|
64 | return CategoryAnchor.START;↵ | | 71 | return DialShape.CIRCLE;↵
|
65 | }↵ | | 72 | }↵
|
66 | else if (this.equals(CategoryAnchor.MIDDLE)) {↵ | | 73 | else if (this.equals(DialShape.CHORD)) {↵
|
67 | return CategoryAnchor.MIDDLE;↵ | | 74 | return DialShape.CHORD;↵
|
68 | } ↵ | | 75 | } ↵
|
69 | else if (this.equals(CategoryAnchor.END)) {↵ | | 76 | else if (this.equals(DialShape.PIE)) {↵
|
70 | return CategoryAnchor.END;↵ | | 77 | return DialShape.PIE;↵
|
71 | } ↵ | | 78 | } ↵
|
72 | return null | | 79 | return null
|