6
6
// Copyright (C) 2007-2010 Julian Hyde
7
7
// All Rights Reserved.
8
8
// You must accept the terms of that agreement to use this software.
9
- */
9
+ */
10
10
package org .olap4j .query ;
11
11
12
12
import java .util .ArrayList ;
@@ -39,12 +39,12 @@ class SelectionImpl extends QueryNodeImpl implements Selection {
39
39
* @pre operator != null
40
40
*/
41
41
public SelectionImpl (
42
- Member member ,
43
- Dimension dimension ,
44
- String hierarchyName ,
45
- String levelName ,
46
- String memberName ,
47
- Operator operator )
42
+ Member member ,
43
+ Dimension dimension ,
44
+ String hierarchyName ,
45
+ String levelName ,
46
+ String memberName ,
47
+ Operator operator )
48
48
{
49
49
super ();
50
50
this .member = member ;
@@ -55,6 +55,55 @@ public SelectionImpl(
55
55
this .operator = operator ;
56
56
}
57
57
58
+ public int hashCode () {
59
+ final int prime = 31 ;
60
+ int result = 1 ;
61
+ result = prime * result
62
+ + ((member == null ) ? 0 : member .getUniqueName ().hashCode ());
63
+ result = prime * result
64
+ + ((operator == null ) ? 0 : operator .hashCode ());
65
+ result = prime * result
66
+ + ((selectionContext == null ) ? 0 : selectionContext .hashCode ());
67
+ return result ;
68
+ }
69
+
70
+ public boolean equals (Object obj ) {
71
+ if (this == obj ) {
72
+ return true ;
73
+ }
74
+ if (obj == null ) {
75
+ return false ;
76
+ }
77
+ if (!(obj instanceof SelectionImpl )) {
78
+ return false ;
79
+ }
80
+ SelectionImpl other = (SelectionImpl ) obj ;
81
+ if (member == null ) {
82
+ if (other .member != null ) {
83
+ return false ;
84
+ }
85
+ } else if (!member .getUniqueName ().equals (
86
+ other .member .getUniqueName ()))
87
+ {
88
+ return false ;
89
+ }
90
+ if (operator == null ) {
91
+ if (other .operator != null ) {
92
+ return false ;
93
+ }
94
+ } else if (!operator .equals (other .operator )) {
95
+ return false ;
96
+ }
97
+ if (selectionContext == null ) {
98
+ if (other .selectionContext != null ) {
99
+ return false ;
100
+ }
101
+ } else if (!selectionContext .equals (other .selectionContext )) {
102
+ return false ;
103
+ }
104
+ return true ;
105
+ }
106
+
58
107
public String getName () {
59
108
return memberName ;
60
109
}
0 commit comments