1 /*
2 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
3 * @LastModified: Oct 2017
4 */
5 /*
6 * Licensed to the Apache Software Foundation (ASF) under one or more
7 * contributor license agreements. See the NOTICE file distributed with
8 * this work for additional information regarding copyright ownership.
9 * The ASF licenses this file to You under the Apache License, Version 2.0
10 * (the "License"); you may not use this file except in compliance with
11 * the License. You may obtain a copy of the License at
12 *
13 * http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 */
21
22 package com.sun.org.apache.xpath.internal.axes;
23
24 import com.sun.org.apache.xml.internal.dtm.Axis;
25 import com.sun.org.apache.xml.internal.dtm.DTM;
26 import com.sun.org.apache.xml.internal.dtm.DTMAxisTraverser;
27 import com.sun.org.apache.xml.internal.dtm.DTMIterator;
28 import com.sun.org.apache.xpath.internal.XPathContext;
29 import com.sun.org.apache.xpath.internal.compiler.Compiler;
30 import com.sun.org.apache.xpath.internal.compiler.OpMap;
31 import com.sun.org.apache.xpath.internal.objects.XObject;
32 import com.sun.org.apache.xpath.internal.patterns.NodeTest;
33 import com.sun.org.apache.xpath.internal.patterns.StepPattern;
34
35 /**
36 * This class treats a
37 * <a href="http://www.w3.org/TR/xpath#location-paths">LocationPath</a> as a
38 * filtered iteration over the tree, evaluating each node in a super axis
39 * traversal against the LocationPath interpreted as a match pattern. This
40 * class is useful to find nodes in document order that are complex paths
41 * whose steps probably criss-cross each other.
42 */
43 public class MatchPatternIterator extends LocPathIterator
44 {
45 static final long serialVersionUID = -5201153767396296474L;
46
47 /** This is the select pattern, translated into a match pattern. */
48 protected StepPattern m_pattern;
49
50 /** The traversal axis from where the nodes will be filtered. */
51 protected int m_superAxis = -1;
52
53 /** The DTM inner traversal class, that corresponds to the super axis. */
54 protected DTMAxisTraverser m_traverser;
55
56 /** DEBUG flag for diagnostic dumps. */
57 private static final boolean DEBUG = false;
58
59 // protected int m_nsElemBase = DTM.NULL;
60
61 /**
|
1 /*
2 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
3 */
4 /*
5 * Licensed to the Apache Software Foundation (ASF) under one or more
6 * contributor license agreements. See the NOTICE file distributed with
7 * this work for additional information regarding copyright ownership.
8 * The ASF licenses this file to You under the Apache License, Version 2.0
9 * (the "License"); you may not use this file except in compliance with
10 * the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20
21 package com.sun.org.apache.xpath.internal.axes;
22
23 import com.sun.org.apache.xml.internal.dtm.Axis;
24 import com.sun.org.apache.xml.internal.dtm.DTM;
25 import com.sun.org.apache.xml.internal.dtm.DTMAxisTraverser;
26 import com.sun.org.apache.xml.internal.dtm.DTMIterator;
27 import com.sun.org.apache.xpath.internal.XPathContext;
28 import com.sun.org.apache.xpath.internal.compiler.Compiler;
29 import com.sun.org.apache.xpath.internal.compiler.OpMap;
30 import com.sun.org.apache.xpath.internal.objects.XObject;
31 import com.sun.org.apache.xpath.internal.patterns.NodeTest;
32 import com.sun.org.apache.xpath.internal.patterns.StepPattern;
33
34 /**
35 * This class treats a
36 * <a href="http://www.w3.org/TR/xpath#location-paths">LocationPath</a> as a
37 * filtered iteration over the tree, evaluating each node in a super axis
38 * traversal against the LocationPath interpreted as a match pattern. This
39 * class is useful to find nodes in document order that are complex paths
40 * whose steps probably criss-cross each other.
41 *
42 * @LastModified: Oct 2017
43 */
44 public class MatchPatternIterator extends LocPathIterator
45 {
46 static final long serialVersionUID = -5201153767396296474L;
47
48 /** This is the select pattern, translated into a match pattern. */
49 protected StepPattern m_pattern;
50
51 /** The traversal axis from where the nodes will be filtered. */
52 protected int m_superAxis = -1;
53
54 /** The DTM inner traversal class, that corresponds to the super axis. */
55 protected DTMAxisTraverser m_traverser;
56
57 /** DEBUG flag for diagnostic dumps. */
58 private static final boolean DEBUG = false;
59
60 // protected int m_nsElemBase = DTM.NULL;
61
62 /**
|