1 | public final class XYCoordinateType implements Serializable {↵ | | 1 | public final class DateTickMarkPosition implements Serializable {↵
|
2 | ↵ | | |
|
| | | 2 |
↵
|
3 | /** The (x, y) coordinates represent a point in the data space. */↵ | | 3 | /** For serialization. */
↵
|
4 | public static final XYCoordinateType DATA ↵ | | 4 | private static final ↵
|
5 | = new XYCoordinateType("XYCoordinateType.DATA");↵ | | |
|
|
6 | /** ↵ | | |
|
7 | * The (x, y) coordinates represent a relative position in the data space. ↵ | | |
|
8 | * In this case, the values should be in the range (0.0 to 1.0).↵ | | |
|
9 | ↵ | | 5 | long serialVersionUID = 2540750672764537240L;↵
|
| | | 6 | ↵
|
10 | */↵ | | 7 | /** Start of period. */
↵
|
11 | public static final XYCoordinateType RELATIVE ↵ | | 8 | public static final ↵
|
12 | ↵ | | 9 | DateTickMarkPosition START↵
|
13 | = new XYCoordinateType("XYCoordinateType.RELATIVE");↵ | | 10 | = new ↵
|
|
14 | /** ↵ | | |
|
15 | * The (x, y) coordinates represent indices in a dataset. ↵ | | |
|
16 | * In this case, the values should be in the range (0.0 to 1.0).↵ | | |
|
17 | ↵ | | 11 | DateTickMarkPosition("DateTickMarkPosition.START");↵
|
|
| | | 12 | /** Middle of period. */↵
|
| | | 13 | public static final DateTickMarkPosition MIDDLE↵
|
| | | 14 | = new DateTickMarkPosition("DateTickMarkPosition.MIDDLE");↵
|
|
18 | */↵ | | 15 | /** End of period. */
↵
|
19 | public static final XYCoordinateType INDEX ↵ | | 16 | public static final ↵
|
20 | ↵ | | 17 | DateTickMarkPosition END↵
|
21 | = new XYCoordinateType("XYCoordinateType.INDEX");↵ | | 18 | = new ↵
|
| | | 19 | DateTickMarkPosition("DateTickMarkPosition.END");↵
|
| | | 20 |
↵
|
22 | /** The name. */↵ | | 21 | /** The name. */
↵
|
23 | private String name;↵ | | 22 | private String name;↵
|
|
| | | 23 |
↵
|
24 | /**↵ | | 24 | /**
↵
|
25 | * Private constructor.↵ | | 25 | * Private constructor.
↵
|
26 | *↵ | | 26 | *
↵
|
27 | * @param name the name.↵ | | 27 | * @param name the name.
↵
|
28 | */↵ | | 28 | */
↵
|
29 | private XYCoordinateType(String name) {↵ | | 29 | private DateTickMarkPosition(String name) {
↵
|
30 | this.name = name;↵ | | 30 | this.name = name;
↵
|
31 | }↵ | | 31 | }↵
|
|
| | | 32 |
↵
|
32 | /**↵ | | 33 | /**
↵
|
33 | * Returns a string representing the object.↵ | | 34 | * Returns a string representing the object.
↵
|
34 | *↵ | | 35 | *
↵
|
35 | * @return The string.↵ | | 36 | * @return The string.
↵
|
36 | */↵ | | 37 | */
↵
|
37 | public String toString() {↵ | | 38 | public String toString() {
↵
|
38 | return this.name;↵ | | 39 | return this.name;
↵
|
39 | }↵ | | 40 | }↵
|
|
| | | 41 |
↵
|
40 | /**↵ | | 42 | /**
↵
|
41 | * Returns <code>true</code> if this object is equal to the specified ↵ | | 43 | * Returns <code>true</code> if this object is equal to the specified
↵
|
42 | * object, and <code>false</code> otherwise.↵ | | 44 | * object, and <code>false</code> otherwise.
↵
|
43 | *↵ | | 45 | *
↵
|
44 | * @param obj the other object.↵ | | 46 | * @param obj the other object.
↵
|
45 | *↵ | | 47 | *
↵
|
46 | * @return A boolean.↵ | | 48 | * @return A boolean.
↵
|
47 | */↵ | | 49 | */
↵
|
48 | public boolean equals(Object obj) {↵ | | 50 | public boolean equals(Object obj) {↵
|
| | | 51 |
↵
|
49 | if (this == obj) {↵ | | 52 | if (this == obj) {
↵
|
50 | return true;↵ | | 53 | return true;
↵
|
51 | }↵ | | 54 | }
↵
|
52 | if (!(obj instanceof XYCoordinateType)) {↵ | | 55 | if (!(obj instanceof DateTickMarkPosition)) {
↵
|
53 | return false;↵ | | 56 | return false;
↵
|
54 | }↵ | | 57 | }
↵
|
55 | XYCoordinateType order = (XYCoordinateType) obj;↵ | | 58 | DateTickMarkPosition position = (DateTickMarkPosition) obj;
↵
|
56 | if (!this.name.equals(order.toString())) {↵ | | 59 | if (!this.name.equals(position.toString())) {
↵
|
57 | return false;↵ | | 60 | return false;
↵
|
58 | }↵ | | 61 | }
↵
|
59 | return true;↵ | | 62 | return true;↵
|
| | | 63 |
↵
|
60 | }↵ | | 64 | }
↵
|
61 | ↵ | | 65 |
↵
|
62 | /**↵ | | 66 | /**
↵
|
63 | * Ensures that serialization returns the unique instances.↵ | | 67 | * Ensures that serialization returns the unique instances.
↵
|
64 | *↵ | | 68 | *
↵
|
65 | * @return The object.↵ | | 69 | * @return The object.
↵
|
66 | *↵ | | 70 | *
↵
|
67 | * @throws ObjectStreamException if there is a problem.↵ | | 71 | * @throws ObjectStreamException if there is a problem.
↵
|
68 | */↵ | | 72 | */
↵
|
69 | private Object readResolve() throws ObjectStreamException {↵ | | 73 | private Object readResolve() throws ObjectStreamException {
↵
|
70 | if (this.equals(XYCoordinateType.DATA)) {↵ | | 74 | if (this.equals(DateTickMarkPosition.START)) {
↵
|
71 | return XYCoordinateType.DATA;↵ | | 75 | return DateTickMarkPosition.START;
↵
|
72 | }↵ | | 76 | }
↵
|
73 | else if (this.equals(XYCoordinateType.RELATIVE)) {↵ | | 77 | else if (this.equals(DateTickMarkPosition.MIDDLE)) {
↵
|
74 | return XYCoordinateType.RELATIVE;↵ | | 78 | return DateTickMarkPosition.MIDDLE;
↵
|
75 | } ↵ | | 79 | }
↵
|
76 | else if (this.equals(XYCoordinateType.INDEX)) {↵ | | 80 | else if (this.equals(DateTickMarkPosition.END)) {
↵
|
77 | return XYCoordinateType.INDEX;↵ | | 81 | return DateTickMarkPosition.END;
↵
|
78 | } ↵ | | 82 | }
↵
|
79 | return null | | 83 | return null
|