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