File tree Expand file tree Collapse file tree 4 files changed +60
-3
lines changed
src/main/java/com/github/developframework/expression Expand file tree Collapse file tree 4 files changed +60
-3
lines changed Original file line number Diff line number Diff line change 3
3
.classpath
4
4
.project
5
5
.idea
6
- * .iml
6
+ * .iml
7
+
8
+ * /src /test
Original file line number Diff line number Diff line change @@ -84,4 +84,29 @@ public String toString() {
84
84
}
85
85
return parentExpression + "." + propertyName + "[" + index + "]" ;
86
86
}
87
+
88
+ @ Override
89
+ public int hashCode () {
90
+ int hash = 7 ;
91
+ if (parentExpression != null ) {
92
+ hash = hash * 31 + parentExpression .hashCode ();
93
+ }
94
+ hash = hash * 31 + propertyName .hashCode ();
95
+ hash = hash * 31 + index ;
96
+ return hash ;
97
+ }
98
+
99
+ @ Override
100
+ public boolean equals (Object obj ) {
101
+ if (obj instanceof ArrayExpression ) {
102
+ ArrayExpression otherExpression = (ArrayExpression ) obj ;
103
+ if (propertyName .equals (otherExpression .getPropertyName ()) && index == otherExpression .getIndex ()) {
104
+ if (this .hasParentExpression () && otherExpression .hasParentExpression ()) {
105
+ return parentExpression .equals (otherExpression .getParentExpression ());
106
+ }
107
+ return !this .hasParentExpression () && !this .hasParentExpression ();
108
+ }
109
+ }
110
+ return false ;
111
+ }
87
112
}
Original file line number Diff line number Diff line change @@ -11,4 +11,9 @@ public class EmptyExpression extends Expression{
11
11
public String toString () {
12
12
return "" ;
13
13
}
14
+
15
+ @ Override
16
+ public boolean equals (Object obj ) {
17
+ return this == obj ;
18
+ }
14
19
}
Original file line number Diff line number Diff line change 5
5
/**
6
6
* 对象表达式
7
7
* 示例: abc
8
+ *
8
9
* @author qiuzhenhao
9
10
* @date 2017/5/6
10
11
*/
11
- public class ObjectExpression extends Expression {
12
+ public class ObjectExpression extends Expression {
12
13
13
14
/* 属性名称 */
14
15
@ Getter
@@ -20,9 +21,33 @@ public ObjectExpression(String propertyName) {
20
21
21
22
@ Override
22
23
public String toString () {
23
- if (parentExpression == null ) {
24
+ if (parentExpression == null ) {
24
25
return propertyName ;
25
26
}
26
27
return parentExpression + "." + propertyName ;
27
28
}
29
+
30
+ @ Override
31
+ public int hashCode () {
32
+ int hash = 7 ;
33
+ if (this .hasParentExpression ()) {
34
+ hash = hash * 31 + parentExpression .hashCode ();
35
+ }
36
+ hash = hash * 31 + propertyName .hashCode ();
37
+ return hash ;
38
+ }
39
+
40
+ @ Override
41
+ public boolean equals (Object obj ) {
42
+ if (obj instanceof ObjectExpression ) {
43
+ ObjectExpression otherExpression = (ObjectExpression ) obj ;
44
+ if (propertyName .equals (otherExpression .getPropertyName ())) {
45
+ if (this .hasParentExpression () && otherExpression .hasParentExpression ()) {
46
+ return parentExpression .equals (otherExpression .getParentExpression ());
47
+ }
48
+ return !this .hasParentExpression () && !this .hasParentExpression ();
49
+ }
50
+ }
51
+ return false ;
52
+ }
28
53
}
You can’t perform that action at this time.
0 commit comments