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