30
30
import org .exist .xquery .value .*;
31
31
32
32
/**
33
- * Abstract superclass for the variable binding expressions "for" and "let ".
33
+ * Abstract superclass for the variable binding expressions "for", "let", and "count ".
34
34
*
35
35
* @author <a href="mailto:[email protected] ">Wolfgang Meier</a>
36
36
*/
@@ -45,11 +45,9 @@ public abstract class BindingExpression extends AbstractFLWORClause implements R
45
45
protected QName varName ;
46
46
protected SequenceType sequenceType = null ;
47
47
protected Expression inputSequence ;
48
-
49
48
private ExprUpdateListener listener ;
50
49
51
-
52
- public BindingExpression (XQueryContext context ) {
50
+ public BindingExpression (final XQueryContext context ) {
53
51
super (context );
54
52
}
55
53
@@ -78,10 +76,8 @@ public Expression getInputSequence() {
78
76
return this .inputSequence ;
79
77
}
80
78
81
- /* (non-Javadoc)
82
- * @see org.exist.xquery.Expression#analyze(org.exist.xquery.Expression, int)
83
- */
84
- public void analyze (AnalyzeContextInfo contextInfo ) throws XPathException {
79
+ @ Override
80
+ public void analyze (final AnalyzeContextInfo contextInfo ) throws XPathException {
85
81
unordered = (contextInfo .getFlags () & UNORDERED ) > 0 ;
86
82
}
87
83
@@ -93,37 +89,32 @@ public Sequence postEval(Sequence seq) throws XPathException {
93
89
return super .postEval (seq );
94
90
}
95
91
96
- /* (non-Javadoc)
97
- * @see org.exist.xquery.Expression#preselect(org.exist.dom.persistent.DocumentSet, org.exist.xquery.StaticContext)
98
- */
99
- public DocumentSet preselect (DocumentSet in_docs ) throws XPathException {
100
- return in_docs ;
92
+ public DocumentSet preselect (final DocumentSet docs ) throws XPathException {
93
+ return docs ;
101
94
}
102
95
103
- /* (non-Javadoc)
104
- * @see org.exist.xquery.AbstractExpression#resetState()
105
- */
106
- public void resetState (boolean postOptimization ) {
96
+ @ Override
97
+ public void resetState (final boolean postOptimization ) {
107
98
super .resetState (postOptimization );
108
99
inputSequence .resetState (postOptimization );
109
100
returnExpr .resetState (postOptimization );
110
101
}
111
102
112
- public final static void setContext (int contextId , Sequence seq ) throws XPathException {
103
+ public static void setContext (final int contextId , final Sequence seq ) throws XPathException {
113
104
if (seq instanceof VirtualNodeSet ) {
114
105
((VirtualNodeSet )seq ).setInPredicate (true );
115
106
((VirtualNodeSet )seq ).setSelfIsContext ();
116
107
} else {
117
- Item next ;
118
- for ( final SequenceIterator i = seq . unorderedIterator (); i . hasNext ();) {
119
- next = i . nextItem ();
120
- if ( next instanceof NodeProxy )
121
- {(( NodeProxy ) next ). addContextNode ( contextId , ( NodeProxy ) next ); }
108
+ for ( final SequenceIterator i = seq . unorderedIterator (); i . hasNext (); ) {
109
+ final Item next = i . nextItem ();
110
+ if ( next instanceof NodeProxy ) {
111
+ (( NodeProxy ) next ). addContextNode ( contextId , ( NodeProxy ) next );
112
+ }
122
113
}
123
114
}
124
115
}
125
116
126
- public final static void clearContext (int contextId , Sequence seq ) throws XPathException {
117
+ public final static void clearContext (final int contextId , final Sequence seq ) throws XPathException {
127
118
if (seq != null && !(seq instanceof VirtualNodeSet )) {
128
119
seq .clearContext (contextId );
129
120
}
@@ -133,27 +124,28 @@ protected void registerUpdateListener(final Sequence sequence) {
133
124
if (listener == null ) {
134
125
listener = new ExprUpdateListener (sequence );
135
126
context .registerUpdateListener (listener );
136
- } else
137
- {listener .setSequence (sequence );}
127
+ } else {
128
+ listener .setSequence (sequence );
129
+ }
138
130
}
139
131
140
132
private class ExprUpdateListener implements UpdateListener {
141
133
private Sequence sequence ;
142
134
143
- public ExprUpdateListener (Sequence sequence ) {
135
+ public ExprUpdateListener (final Sequence sequence ) {
144
136
this .sequence = sequence ;
145
137
}
146
138
147
- public void setSequence (Sequence sequence ) {
139
+ public void setSequence (final Sequence sequence ) {
148
140
this .sequence = sequence ;
149
141
}
150
142
151
143
@ Override
152
- public void documentUpdated (DocumentImpl document , int event ) {
144
+ public void documentUpdated (final DocumentImpl document , final int event ) {
153
145
}
154
146
155
147
@ Override
156
- public void nodeMoved (NodeId oldNodeId , NodeHandle newNode ) {
148
+ public void nodeMoved (final NodeId oldNodeId , final NodeHandle newNode ) {
157
149
sequence .nodeMoved (oldNodeId , newNode );
158
150
}
159
151
@@ -179,11 +171,12 @@ public int returnsType() {
179
171
/* RewritableExpression API */
180
172
181
173
@ Override
182
- public void replace (Expression oldExpr , Expression newExpr ) {
183
- if (inputSequence == oldExpr )
184
- {inputSequence = newExpr ;}
185
- else if (returnExpr == oldExpr )
186
- {returnExpr = newExpr ;}
174
+ public void replace (final Expression oldExpr , final Expression newExpr ) {
175
+ if (inputSequence == oldExpr ) {
176
+ inputSequence = newExpr ;
177
+ } else if (returnExpr == oldExpr ) {
178
+ returnExpr = newExpr ;
179
+ }
187
180
}
188
181
189
182
@ Override
@@ -197,7 +190,7 @@ public Expression getFirst() {
197
190
}
198
191
199
192
@ Override
200
- public void remove (Expression oldExpr ) throws XPathException {
193
+ public void remove (final Expression oldExpr ) throws XPathException {
201
194
}
202
195
203
196
/* END RewritableExpression API */
0 commit comments