You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vxquery.apache.org by vi...@apache.org on 2010/01/05 22:54:23 UTC
svn commit: r896237 - in /incubator/vxquery/trunk/vxquery/src:
main/java/org/apache/vxquery/datamodel/ main/java/org/apache/vxquery/drivers/
main/java/org/apache/vxquery/runtime/base/
main/java/org/apache/vxquery/runtime/core/ main/java/org/apache/vxqu...
Author: vinayakb
Date: Tue Jan 5 21:54:10 2010
New Revision: 896237
URL: http://svn.apache.org/viewvc?rev=896237&view=rev
Log:
- Added skip() call to Runtime Iterator.
- Optimized subsequence implementation by using skip.
- Removed Deflate operation from being inserted for variables
- Fixed next() to auto deflate for eagerly evaluated iterators.
- Added promotion to boolean for satisfies expression of QuantifiedExpressions.
- Replaced filter option in XTest with include and exclude options.
Added:
incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/runtime/base/CloseableSkippableIterator.java
Modified:
incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/datamodel/EagerlyMaterializedXDMSequenceImpl.java
incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/datamodel/XDMSequence.java
incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/drivers/VXQuery.java
incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/runtime/base/AbstractEagerlyEvaluatedIterator.java
incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/runtime/base/AbstractRuntimeIterator.java
incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/runtime/base/RuntimeIterator.java
incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/runtime/core/GlobalRegisterAccessIterator.java
incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/runtime/core/LocalRegisterAccessIterator.java
incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/runtime/core/SingletonRuntimeIterator.java
incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/runtime/functions/FnSubsequenceIterator.java
incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/xmlquery/query/XMLQueryTranslator.java
incubator/vxquery/trunk/vxquery/src/test/java/org/apache/vxquery/xtest/TestCaseFactory.java
incubator/vxquery/trunk/vxquery/src/test/java/org/apache/vxquery/xtest/TestRunnerFactory.java
incubator/vxquery/trunk/vxquery/src/test/java/org/apache/vxquery/xtest/XTestOptions.java
Modified: incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/datamodel/EagerlyMaterializedXDMSequenceImpl.java
URL: http://svn.apache.org/viewvc/incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/datamodel/EagerlyMaterializedXDMSequenceImpl.java?rev=896237&r1=896236&r2=896237&view=diff
==============================================================================
--- incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/datamodel/EagerlyMaterializedXDMSequenceImpl.java (original)
+++ incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/datamodel/EagerlyMaterializedXDMSequenceImpl.java Tue Jan 5 21:54:10 2010
@@ -1,19 +1,17 @@
/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.apache.vxquery.datamodel;
import java.util.ArrayList;
@@ -22,6 +20,7 @@
import org.apache.vxquery.exceptions.SystemException;
import org.apache.vxquery.runtime.base.CloseableIterator;
+import org.apache.vxquery.runtime.base.CloseableSkippableIterator;
public final class EagerlyMaterializedXDMSequenceImpl implements XDMSequence {
private List<XDMItem> list;
@@ -62,10 +61,10 @@
}
@Override
- public CloseableIterator createItemIterator() {
- return new CloseableIterator() {
+ public CloseableSkippableIterator createItemIterator() {
+ return new CloseableSkippableIterator() {
private int i = 0;
- private int len = list.size();
+ private int length = list.size();
@Override
public void close() {
@@ -73,11 +72,20 @@
@Override
public Object next() throws SystemException {
- if (i < len) {
+ if (i < length) {
return list.get(i++);
}
return null;
}
+
+ @Override
+ public int skip(int len) {
+ if (i < length) {
+ i += len;
+ return i > len ? i - length : 0;
+ }
+ return len;
+ }
};
}
Modified: incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/datamodel/XDMSequence.java
URL: http://svn.apache.org/viewvc/incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/datamodel/XDMSequence.java?rev=896237&r1=896236&r2=896237&view=diff
==============================================================================
--- incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/datamodel/XDMSequence.java (original)
+++ incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/datamodel/XDMSequence.java Tue Jan 5 21:54:10 2010
@@ -1,27 +1,25 @@
/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.apache.vxquery.datamodel;
import java.util.List;
-import org.apache.vxquery.runtime.base.CloseableIterator;
+import org.apache.vxquery.runtime.base.CloseableSkippableIterator;
public interface XDMSequence extends XDMValue {
- public CloseableIterator createItemIterator();
+ public CloseableSkippableIterator createItemIterator();
public void appendToList(List<XDMItem> list);
Modified: incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/drivers/VXQuery.java
URL: http://svn.apache.org/viewvc/incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/drivers/VXQuery.java?rev=896237&r1=896236&r2=896237&view=diff
==============================================================================
--- incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/drivers/VXQuery.java (original)
+++ incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/drivers/VXQuery.java Tue Jan 5 21:54:10 2010
@@ -1,13 +1,11 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
+ * contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
+ * the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -26,21 +24,20 @@
import java.util.Map;
import org.apache.commons.io.FileUtils;
-import org.kohsuke.args4j.Argument;
-import org.kohsuke.args4j.CmdLineParser;
-import org.kohsuke.args4j.Option;
-
import org.apache.vxquery.api.InternalAPI;
import org.apache.vxquery.compiler.expression.ExpressionPrinter;
import org.apache.vxquery.datamodel.XDMItem;
import org.apache.vxquery.datamodel.dtm.DTMDatamodelStaticInterfaceImpl;
import org.apache.vxquery.datamodel.serialization.XMLSerializer;
import org.apache.vxquery.runtime.base.OpenableCloseableIterator;
-import org.apache.vxquery.runtime.core.Deflater;
import org.apache.vxquery.xmlquery.ast.ModuleNode;
import org.apache.vxquery.xmlquery.query.Module;
import org.apache.vxquery.xmlquery.query.PrologVariable;
import org.apache.vxquery.xmlquery.query.XQueryCompilationListener;
+import org.kohsuke.args4j.Argument;
+import org.kohsuke.args4j.CmdLineParser;
+import org.kohsuke.args4j.Option;
+
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.xml.DomDriver;
@@ -108,19 +105,17 @@
ri.open();
System.err.println("--- Results begin");
XDMItem o;
- Deflater deflater = new Deflater();
- deflater.reset(ri);
PrintWriter out = new PrintWriter(System.out, true);
XMLSerializer s = new XMLSerializer(out, false);
s.open();
try {
- while ((o = (XDMItem) deflater.next()) != null) {
+ while ((o = (XDMItem) ri.next()) != null) {
s.item(o);
}
} finally {
s.close();
out.flush();
- deflater.close();
+ ri.close();
}
System.err.println("--- Results end");
long end = System.currentTimeMillis();
Modified: incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/runtime/base/AbstractEagerlyEvaluatedIterator.java
URL: http://svn.apache.org/viewvc/incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/runtime/base/AbstractEagerlyEvaluatedIterator.java?rev=896237&r1=896236&r2=896237&view=diff
==============================================================================
--- incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/runtime/base/AbstractEagerlyEvaluatedIterator.java (original)
+++ incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/runtime/base/AbstractEagerlyEvaluatedIterator.java Tue Jan 5 21:54:10 2010
@@ -1,21 +1,22 @@
/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.apache.vxquery.runtime.base;
+import org.apache.vxquery.datamodel.DMOKind;
+import org.apache.vxquery.datamodel.XDMSequence;
+import org.apache.vxquery.datamodel.XDMValue;
import org.apache.vxquery.exceptions.SystemException;
import org.apache.vxquery.runtime.CallStackFrame;
import org.apache.vxquery.runtime.LocalRegisterAccessor;
@@ -23,10 +24,12 @@
public abstract class AbstractEagerlyEvaluatedIterator extends AbstractRuntimeIterator {
private final LocalRegisterAccessor<Boolean> done;
+ private final LocalRegisterAccessor<CloseableSkippableIterator> deflator;
public AbstractEagerlyEvaluatedIterator(RegisterAllocator rAllocator) {
super(rAllocator);
done = new LocalRegisterAccessor<Boolean>(rAllocator.allocate(1));
+ deflator = new LocalRegisterAccessor<CloseableSkippableIterator>(rAllocator.allocate(1));
}
@Override
@@ -36,6 +39,11 @@
@Override
public final void close(CallStackFrame frame) {
+ CloseableSkippableIterator seqIter = deflator.get(frame);
+ if (seqIter != null) {
+ seqIter.close();
+ deflator.set(frame, null);
+ }
}
@Override
@@ -43,7 +51,41 @@
if (done.get(frame)) {
return null;
}
+ CloseableSkippableIterator seqIter = deflator.get(frame);
+ if (seqIter == null) {
+ XDMValue value = (XDMValue) evaluateEagerly(frame);
+ if (value != null && value.getDMOKind() == DMOKind.SEQUENCE) {
+ seqIter = ((XDMSequence) value).createItemIterator();
+ deflator.set(frame, seqIter);
+ } else {
+ done.set(frame, true);
+ return value;
+ }
+ }
+ Object o = seqIter.next();
+ if (o != null) {
+ return o;
+ }
done.set(frame, true);
- return evaluateEagerly(frame);
+ return null;
+ }
+
+ @Override
+ public int skip(CallStackFrame frame, int len) throws SystemException {
+ if (len == 0 || done.get(frame)) {
+ return len;
+ }
+ CloseableSkippableIterator seqIter = deflator.get(frame);
+ if (seqIter == null) {
+ XDMValue value = (XDMValue) evaluateEagerly(frame);
+ if (value != null && value.getDMOKind() == DMOKind.SEQUENCE) {
+ seqIter = ((XDMSequence) value).createItemIterator();
+ deflator.set(frame, seqIter);
+ } else {
+ done.set(frame, true);
+ return len - 1;
+ }
+ }
+ return seqIter.skip(len);
}
}
\ No newline at end of file
Modified: incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/runtime/base/AbstractRuntimeIterator.java
URL: http://svn.apache.org/viewvc/incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/runtime/base/AbstractRuntimeIterator.java?rev=896237&r1=896236&r2=896237&view=diff
==============================================================================
--- incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/runtime/base/AbstractRuntimeIterator.java (original)
+++ incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/runtime/base/AbstractRuntimeIterator.java Tue Jan 5 21:54:10 2010
@@ -1,28 +1,34 @@
/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.apache.vxquery.runtime.base;
+import org.apache.vxquery.exceptions.SystemException;
+import org.apache.vxquery.runtime.CallStackFrame;
import org.apache.vxquery.runtime.RegisterAllocator;
import org.apache.vxquery.util.Debug;
public abstract class AbstractRuntimeIterator implements RuntimeIterator {
public AbstractRuntimeIterator(RegisterAllocator rAllocator) {
}
-
+
+ @Override
+ public int skip(CallStackFrame frame, int len) throws SystemException {
+ while (len-- > 0 && next(frame) != null);
+ return len + 1;
+ }
+
public String toString() {
return Debug.toString(this);
}
Added: incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/runtime/base/CloseableSkippableIterator.java
URL: http://svn.apache.org/viewvc/incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/runtime/base/CloseableSkippableIterator.java?rev=896237&view=auto
==============================================================================
--- incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/runtime/base/CloseableSkippableIterator.java (added)
+++ incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/runtime/base/CloseableSkippableIterator.java Tue Jan 5 21:54:10 2010
@@ -0,0 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.vxquery.runtime.base;
+
+public interface CloseableSkippableIterator extends CloseableIterator {
+ public int skip(int len);
+}
\ No newline at end of file
Modified: incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/runtime/base/RuntimeIterator.java
URL: http://svn.apache.org/viewvc/incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/runtime/base/RuntimeIterator.java?rev=896237&r1=896236&r2=896237&view=diff
==============================================================================
--- incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/runtime/base/RuntimeIterator.java (original)
+++ incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/runtime/base/RuntimeIterator.java Tue Jan 5 21:54:10 2010
@@ -1,19 +1,19 @@
/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.apache.vxquery.runtime.base;
import org.apache.vxquery.exceptions.SystemException;
@@ -24,5 +24,19 @@
public Object next(CallStackFrame frame) throws SystemException;
+ /**
+ * Positions the iterator after skipping said number of items. This call may
+ * skip
+ * fewer items if it reaches the end of the sequence.
+ *
+ * @param frame
+ * - The call stack frame.
+ * @param len
+ * - Number of items to skip.
+ * @return len - n where n is the number of items actually skipped.
+ * @throws SystemException
+ */
+ public int skip(CallStackFrame frame, int len) throws SystemException;
+
public void close(CallStackFrame frame);
}
\ No newline at end of file
Modified: incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/runtime/core/GlobalRegisterAccessIterator.java
URL: http://svn.apache.org/viewvc/incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/runtime/core/GlobalRegisterAccessIterator.java?rev=896237&r1=896236&r2=896237&view=diff
==============================================================================
--- incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/runtime/core/GlobalRegisterAccessIterator.java (original)
+++ incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/runtime/core/GlobalRegisterAccessIterator.java Tue Jan 5 21:54:10 2010
@@ -1,53 +1,31 @@
/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.apache.vxquery.runtime.core;
import org.apache.vxquery.exceptions.SystemException;
import org.apache.vxquery.runtime.CallStackFrame;
import org.apache.vxquery.runtime.GlobalRegisterAccessor;
-import org.apache.vxquery.runtime.LocalRegisterAccessor;
import org.apache.vxquery.runtime.RegisterAllocator;
-import org.apache.vxquery.runtime.base.RuntimeIterator;
+import org.apache.vxquery.runtime.base.AbstractEagerlyEvaluatedIterator;
-public class GlobalRegisterAccessIterator implements RuntimeIterator {
+public class GlobalRegisterAccessIterator extends AbstractEagerlyEvaluatedIterator {
private final GlobalRegisterAccessor<Object> regAccess;
- private final LocalRegisterAccessor<Boolean> done;
public GlobalRegisterAccessIterator(RegisterAllocator rAllocator, int register) {
+ super(rAllocator);
regAccess = new GlobalRegisterAccessor<Object>(register);
- done = new LocalRegisterAccessor<Boolean>(rAllocator.allocate(1));
- }
-
- @Override
- public void open(CallStackFrame frame) {
- done.set(frame, false);
- }
-
- @Override
- public void close(CallStackFrame frame) {
- }
-
- @Override
- public Object next(CallStackFrame frame) throws SystemException {
- if (done.get(frame)) {
- return null;
- }
- done.set(frame, true);
- return regAccess.get(frame);
}
@Override
Modified: incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/runtime/core/LocalRegisterAccessIterator.java
URL: http://svn.apache.org/viewvc/incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/runtime/core/LocalRegisterAccessIterator.java?rev=896237&r1=896236&r2=896237&view=diff
==============================================================================
--- incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/runtime/core/LocalRegisterAccessIterator.java (original)
+++ incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/runtime/core/LocalRegisterAccessIterator.java Tue Jan 5 21:54:10 2010
@@ -1,52 +1,31 @@
/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.apache.vxquery.runtime.core;
import org.apache.vxquery.exceptions.SystemException;
import org.apache.vxquery.runtime.CallStackFrame;
import org.apache.vxquery.runtime.LocalRegisterAccessor;
import org.apache.vxquery.runtime.RegisterAllocator;
-import org.apache.vxquery.runtime.base.RuntimeIterator;
+import org.apache.vxquery.runtime.base.AbstractEagerlyEvaluatedIterator;
-public class LocalRegisterAccessIterator implements RuntimeIterator {
+public class LocalRegisterAccessIterator extends AbstractEagerlyEvaluatedIterator {
private final LocalRegisterAccessor<Object> regAccess;
- private final LocalRegisterAccessor<Boolean> done;
public LocalRegisterAccessIterator(RegisterAllocator rAllocator, int register) {
+ super(rAllocator);
regAccess = new LocalRegisterAccessor<Object>(register);
- done = new LocalRegisterAccessor<Boolean>(rAllocator.allocate(1));
- }
-
- @Override
- public void open(CallStackFrame frame) {
- done.set(frame, false);
- }
-
- @Override
- public void close(CallStackFrame frame) {
- }
-
- @Override
- public Object next(CallStackFrame frame) throws SystemException {
- if (done.get(frame)) {
- return null;
- }
- done.set(frame, true);
- return regAccess.get(frame);
}
@Override
Modified: incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/runtime/core/SingletonRuntimeIterator.java
URL: http://svn.apache.org/viewvc/incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/runtime/core/SingletonRuntimeIterator.java?rev=896237&r1=896236&r2=896237&view=diff
==============================================================================
--- incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/runtime/core/SingletonRuntimeIterator.java (original)
+++ incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/runtime/core/SingletonRuntimeIterator.java Tue Jan 5 21:54:10 2010
@@ -1,56 +1,34 @@
/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.apache.vxquery.runtime.core;
import org.apache.vxquery.exceptions.SystemException;
import org.apache.vxquery.runtime.CallStackFrame;
-import org.apache.vxquery.runtime.LocalRegisterAccessor;
import org.apache.vxquery.runtime.RegisterAllocator;
-import org.apache.vxquery.runtime.base.RuntimeIterator;
+import org.apache.vxquery.runtime.base.AbstractEagerlyEvaluatedIterator;
-public class SingletonRuntimeIterator implements RuntimeIterator {
+public class SingletonRuntimeIterator extends AbstractEagerlyEvaluatedIterator {
private final Object value;
- private final LocalRegisterAccessor<Boolean> done;
public SingletonRuntimeIterator(RegisterAllocator rAllocator, Object value) {
+ super(rAllocator);
this.value = value;
- done = new LocalRegisterAccessor<Boolean>(rAllocator.allocate(1));
- }
-
- @Override
- public Object next(CallStackFrame frame) throws SystemException {
- if (done.get(frame)) {
- return null;
- }
- done.set(frame, true);
- return value;
- }
-
- @Override
- public void open(CallStackFrame frame) {
- done.set(frame, false);
}
@Override
public Object evaluateEagerly(CallStackFrame frame) throws SystemException {
return value;
}
-
- @Override
- public void close(CallStackFrame frame) {
- }
}
\ No newline at end of file
Modified: incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/runtime/functions/FnSubsequenceIterator.java
URL: http://svn.apache.org/viewvc/incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/runtime/functions/FnSubsequenceIterator.java?rev=896237&r1=896236&r2=896237&view=diff
==============================================================================
--- incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/runtime/functions/FnSubsequenceIterator.java (original)
+++ incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/runtime/functions/FnSubsequenceIterator.java Tue Jan 5 21:54:10 2010
@@ -1,19 +1,17 @@
/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.apache.vxquery.runtime.functions;
import org.apache.vxquery.context.StaticContext;
@@ -46,13 +44,13 @@
public Object next(CallStackFrame frame) throws SystemException {
if (remaining.get(frame) == null) {
int start = (int) Math.round(RuntimeUtils.fetchNumericItemEagerly(arguments[1], frame).getDoubleValue());
- while (start > 1) {
- arguments[0].next(frame);
- start--;
+ if (start > 1) {
+ arguments[0].skip(frame, start - 1);
}
-
+
if (arguments.length > 2) {
- int length = (int) Math.round(RuntimeUtils.fetchNumericItemEagerly(arguments[2], frame).getDoubleValue());
+ int length = (int) Math.round(RuntimeUtils.fetchNumericItemEagerly(arguments[2], frame)
+ .getDoubleValue());
remaining.set(frame, length < 0 ? 0 : length);
} else {
remaining.set(frame, -1);
@@ -67,7 +65,7 @@
if (o == null) {
remain = 0;
} else {
- --remain;
+ --remain;
}
remaining.set(frame, remain);
return o;
Modified: incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/xmlquery/query/XMLQueryTranslator.java
URL: http://svn.apache.org/viewvc/incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/xmlquery/query/XMLQueryTranslator.java?rev=896237&r1=896236&r2=896237&view=diff
==============================================================================
--- incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/xmlquery/query/XMLQueryTranslator.java (original)
+++ incubator/vxquery/trunk/vxquery/src/main/java/org/apache/vxquery/xmlquery/query/XMLQueryTranslator.java Tue Jan 5 21:54:10 2010
@@ -1,13 +1,11 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
+ * contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
+ * the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -759,8 +757,8 @@
if (!type.isAtomicType()) {
throw new SystemException(ErrorCode.XPST0051, fnNode.getName().getSourceLocation());
}
- Expression arg = args.isEmpty() ? deflate(currCtx, new VariableReferenceExpression(currCtx,
- varScope.lookupVariable(XMLQueryCompilerConstants.DOT_VAR_NAME))) : args.get(0);
+ Expression arg = args.isEmpty() ? new VariableReferenceExpression(currCtx, varScope
+ .lookupVariable(XMLQueryCompilerConstants.DOT_VAR_NAME)) : args.get(0);
return new CastExpression(currCtx, arg, SequenceType.create((ItemType) type,
Quantifier.QUANT_QUESTION));
}
@@ -776,8 +774,8 @@
int nArgs = fnNode.getArguments().size();
Function fn = moduleCtx.lookupFunction(fName, nArgs);
if (fn != null && fn.useContextImplicitly()) {
- args.add(deflate(currCtx, new VariableReferenceExpression(currCtx, varScope
- .lookupVariable(XMLQueryCompilerConstants.DOT_VAR_NAME))));
+ args.add(new VariableReferenceExpression(currCtx, varScope
+ .lookupVariable(XMLQueryCompilerConstants.DOT_VAR_NAME)));
nArgs = fnNode.getArguments().size();
fn = moduleCtx.lookupFunction(fName, nArgs);
}
@@ -980,8 +978,8 @@
if (var == null) {
throw new SystemException(ErrorCode.XPST0008, vrNode.getSourceLocation());
}
- return new TreatExpression(currCtx, deflate(currCtx, new VariableReferenceExpression(currCtx, var)),
- var.getDeclaredStaticType());
+ return new TreatExpression(currCtx, new VariableReferenceExpression(currCtx, var), var
+ .getDeclaredStaticType());
}
case FLWOR_EXPRESSION: {
@@ -1118,7 +1116,8 @@
varScope.registerVariable(var);
++pushCount;
}
- Expression sExpr = translateExpression(qeNode.getSatisfiesExpr());
+ Expression sExpr = ExpressionBuilder.functionCall(currCtx, BuiltinFunctions.FN_BOOLEAN_1,
+ translateExpression(qeNode.getSatisfiesExpr()));
for (int i = 0; i < pushCount; ++i) {
popVariableScope();
}
@@ -1281,10 +1280,6 @@
return buffer.toString();
}
- private static Expression deflate(StaticContext ctx, Expression expr) {
- return ExpressionBuilder.functionCall(ctx, BuiltinOperators.DEFLATE_SEQUENCES, expr);
- }
-
private static Expression normalize(StaticContext ctx, Expression e, SequenceType type) {
if (type.getItemType().isAtomicType()) {
Expression atomizedExpr = atomize(ctx, e);
@@ -1493,11 +1488,11 @@
Expression typeTest = ExpressionBuilder.instanceOf(currCtx, new VariableReferenceExpression(currCtx, pVar),
SequenceType.create(BuiltinTypeRegistry.XSEXT_NUMERIC, Quantifier.QUANT_ONE));
- Expression posTest = ExpressionBuilder.functionCall(currCtx, BuiltinOperators.VALUE_EQ, deflate(currCtx,
- new VariableReferenceExpression(currCtx, pVar)), new VariableReferenceExpression(currCtx, varScope
- .lookupVariable(XMLQueryCompilerConstants.POS_VAR_NAME)));
- Expression boolTest = ExpressionBuilder.functionCall(currCtx, BuiltinFunctions.FN_BOOLEAN_1, deflate(
- currCtx, new VariableReferenceExpression(currCtx, pVar)));
+ Expression posTest = ExpressionBuilder.functionCall(currCtx, BuiltinOperators.VALUE_EQ,
+ new VariableReferenceExpression(currCtx, pVar), new VariableReferenceExpression(currCtx, varScope
+ .lookupVariable(XMLQueryCompilerConstants.POS_VAR_NAME)));
+ Expression boolTest = ExpressionBuilder.functionCall(currCtx, BuiltinFunctions.FN_BOOLEAN_1,
+ new VariableReferenceExpression(currCtx, pVar));
clauses
.add(new FLWORExpression.WhereClause(new IfThenElseExpression(currCtx, typeTest, posTest, boolTest)));
@@ -1531,15 +1526,15 @@
clauses.add(seqLC);
List<Expression> cArgs = new ArrayList<Expression>();
- cArgs.add(deflate(currCtx, new VariableReferenceExpression(currCtx, seqVar)));
+ cArgs.add(new VariableReferenceExpression(currCtx, seqVar));
ForLetVariable cVar = new ForLetVariable(VarTag.LET, XMLQueryCompilerConstants.LAST_VAR_NAME,
new FunctionCallExpression(currCtx, BuiltinFunctions.FN_COUNT_1, cArgs));
FLWORExpression.LetClause cLC = new FLWORExpression.LetClause(cVar);
varScope.registerVariable(cVar);
clauses.add(cLC);
- ForLetVariable dotVar = new ForLetVariable(VarTag.FOR, XMLQueryCompilerConstants.DOT_VAR_NAME, deflate(currCtx,
- new VariableReferenceExpression(currCtx, seqVar)));
+ ForLetVariable dotVar = new ForLetVariable(VarTag.FOR, XMLQueryCompilerConstants.DOT_VAR_NAME,
+ new VariableReferenceExpression(currCtx, seqVar));
PositionVariable posVar = new PositionVariable(XMLQueryCompilerConstants.POS_VAR_NAME);
FLWORExpression.ForClause dotFC = new FLWORExpression.ForClause(dotVar, posVar, null);
varScope.registerVariable(dotVar);
Modified: incubator/vxquery/trunk/vxquery/src/test/java/org/apache/vxquery/xtest/TestCaseFactory.java
URL: http://svn.apache.org/viewvc/incubator/vxquery/trunk/vxquery/src/test/java/org/apache/vxquery/xtest/TestCaseFactory.java?rev=896237&r1=896236&r2=896237&view=diff
==============================================================================
--- incubator/vxquery/trunk/vxquery/src/test/java/org/apache/vxquery/xtest/TestCaseFactory.java (original)
+++ incubator/vxquery/trunk/vxquery/src/test/java/org/apache/vxquery/xtest/TestCaseFactory.java Tue Jan 5 21:54:10 2010
@@ -1,13 +1,11 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
+ * contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
+ * the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -43,7 +41,8 @@
private TestRunnerFactory trf;
private ExecutorService eSvc;
private TestCase tc;
- private Pattern filter;
+ private Pattern include;
+ private Pattern exclude;
private XTestOptions opts;
private String nextVariable;
@@ -59,8 +58,11 @@
tConfig.options = opts;
this.eSvc = eSvc;
this.opts = opts;
- if (opts.filter != null) {
- this.filter = Pattern.compile(opts.filter);
+ if (opts.include != null) {
+ this.include = Pattern.compile(opts.include);
+ }
+ if (opts.exclude != null) {
+ this.exclude = Pattern.compile(opts.exclude);
}
srcMap = new HashMap<String, File>();
try {
@@ -88,7 +90,8 @@
}
private void submit(TestCase tc) {
- boolean toSubmit = filter == null || filter.matcher(tc.getXQueryDisplayName()).find();
+ boolean toSubmit = include == null || include.matcher(tc.getXQueryDisplayName()).find();
+ toSubmit = exclude == null || !exclude.matcher(tc.getXQueryDisplayName()).find();
if (toSubmit) {
if (opts.verbose) {
System.err.println(tc);
Modified: incubator/vxquery/trunk/vxquery/src/test/java/org/apache/vxquery/xtest/TestRunnerFactory.java
URL: http://svn.apache.org/viewvc/incubator/vxquery/trunk/vxquery/src/test/java/org/apache/vxquery/xtest/TestRunnerFactory.java?rev=896237&r1=896236&r2=896237&view=diff
==============================================================================
--- incubator/vxquery/trunk/vxquery/src/test/java/org/apache/vxquery/xtest/TestRunnerFactory.java (original)
+++ incubator/vxquery/trunk/vxquery/src/test/java/org/apache/vxquery/xtest/TestRunnerFactory.java Tue Jan 5 21:54:10 2010
@@ -1,13 +1,11 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
+ * contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
+ * the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -34,7 +32,6 @@
import org.apache.vxquery.datamodel.dtm.DTMDatamodelStaticInterfaceImpl;
import org.apache.vxquery.datamodel.serialization.XMLSerializer;
import org.apache.vxquery.runtime.base.OpenableCloseableIterator;
-import org.apache.vxquery.runtime.core.Deflater;
import org.apache.vxquery.xmlquery.ast.ModuleNode;
import org.apache.vxquery.xmlquery.query.Module;
import org.apache.vxquery.xmlquery.query.PrologVariable;
@@ -82,18 +79,16 @@
OpenableCloseableIterator ri = iapi.execute(module);
ri.open();
XDMItem o;
- Deflater deflater = new Deflater();
- deflater.reset(ri);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(baos)), true);
XMLSerializer s = new XMLSerializer(out, false);
try {
- while ((o = (XDMItem) deflater.next()) != null) {
+ while ((o = (XDMItem) ri.next()) != null) {
s.item(o);
}
} finally {
out.flush();
- deflater.close();
+ ri.close();
}
try {
res.result = baos.toString("UTF-8");
Modified: incubator/vxquery/trunk/vxquery/src/test/java/org/apache/vxquery/xtest/XTestOptions.java
URL: http://svn.apache.org/viewvc/incubator/vxquery/trunk/vxquery/src/test/java/org/apache/vxquery/xtest/XTestOptions.java?rev=896237&r1=896236&r2=896237&view=diff
==============================================================================
--- incubator/vxquery/trunk/vxquery/src/test/java/org/apache/vxquery/xtest/XTestOptions.java (original)
+++ incubator/vxquery/trunk/vxquery/src/test/java/org/apache/vxquery/xtest/XTestOptions.java Tue Jan 5 21:54:10 2010
@@ -1,13 +1,11 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
+ * contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
+ * the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -28,8 +26,11 @@
@Option(name = "-threads", required = false, usage = "Number of threads")
int threads;
- @Option(name = "-filter", required = false, usage = "Filter regular expression")
- String filter;
+ @Option(name = "-include", required = false, usage = "Include filter regular expression")
+ String include;
+
+ @Option(name = "-exclude", required = false, usage = "Exclude filter regular expression")
+ String exclude;
@Option(name = "-v", required = false, usage = "Verbose")
boolean verbose;