blob: e48e341136a4ad2a8e18171916a8b50edc2bf038 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
package bjc.utils.parserutils.delims;
/**
* Marks the parameters for building a sequence tree.
*
* @author EVE
*
* @param <T>
* The type of item in the tree.
*/
public class SequenceCharacteristics<T> {
/**
* The item to mark the root of the tree.
*/
public final T root;
/**
* The item to mark the contents of a group/subgroup.
*/
public final T contents;
/**
* The item to mark a subgroup.
*/
public final T subgroup;
/**
* Create a new set of parameters for building a tree.
*
* @param root
* The root marker.
* @param contents
* The group/subgroup contents marker.
* @param subgroup
* The subgroup marker.
*/
public SequenceCharacteristics(final T root, final T contents, final T subgroup) {
this.root = root;
this.contents = contents;
this.subgroup = subgroup;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (contents == null ? 0 : contents.hashCode());
result = prime * result + (root == null ? 0 : root.hashCode());
result = prime * result + (subgroup == null ? 0 : subgroup.hashCode());
return result;
}
@Override
public boolean equals(final Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (!(obj instanceof SequenceCharacteristics))
return false;
final SequenceCharacteristics<?> other = (SequenceCharacteristics<?>) obj;
if (contents == null) {
if (other.contents != null)
return false;
} else if (!contents.equals(other.contents))
return false;
if (root == null) {
if (other.root != null)
return false;
} else if (!root.equals(other.root))
return false;
if (subgroup == null) {
if (other.subgroup != null)
return false;
} else if (!subgroup.equals(other.subgroup))
return false;
return true;
}
@Override
public String toString() {
final StringBuilder builder = new StringBuilder();
builder.append("SequenceCharacteristics [root=");
builder.append(root == null ? "(null)" : root);
builder.append(", contents=");
builder.append(contents == null ? "(null)" : contents);
builder.append(", subgroup=");
builder.append(subgroup == null ? "(null)" : subgroup);
builder.append("]");
return builder.toString();
}
}
|