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