1 16 19 package com.sun.org.apache.xpath.internal.axes; 20 21 import com.sun.org.apache.xml.internal.dtm.Axis; 22 import com.sun.org.apache.xml.internal.utils.PrefixResolver; 23 import com.sun.org.apache.xpath.internal.compiler.Compiler; 24 25 29 public class WalkingIteratorSorted extends WalkingIterator 30 { 31 32 35 37 protected boolean m_inNaturalOrderStatic = false; 38 39 45 public WalkingIteratorSorted(PrefixResolver nscontext) 46 { 47 super(nscontext); 48 } 49 50 65 WalkingIteratorSorted( 66 Compiler compiler, int opPos, int analysis, boolean shouldLoadWalkers) 67 throws javax.xml.transform.TransformerException 68 { 69 super(compiler, opPos, analysis, shouldLoadWalkers); 70 } 71 72 78 public boolean isDocOrdered() 79 { 80 return m_inNaturalOrderStatic; 81 } 82 83 84 90 boolean canBeWalkedInNaturalDocOrderStatic() 91 { 92 93 if (null != m_firstWalker) 94 { 95 AxesWalker walker = m_firstWalker; 96 int prevAxis = -1; 97 boolean prevIsSimpleDownAxis = true; 98 99 for(int i = 0; null != walker; i++) 100 { 101 int axis = walker.getAxis(); 102 103 if(walker.isDocOrdered()) 104 { 105 boolean isSimpleDownAxis = ((axis == Axis.CHILD) 106 || (axis == Axis.SELF) 107 || (axis == Axis.ROOT)); 108 if(isSimpleDownAxis || (axis == -1)) 111 walker = walker.getNextWalker(); 112 else 113 { 114 boolean isLastWalker = (null == walker.getNextWalker()); 115 if(isLastWalker) 116 { 117 if(walker.isDocOrdered() && (axis == Axis.DESCENDANT || 118 axis == Axis.DESCENDANTORSELF || axis == Axis.DESCENDANTSFROMROOT 119 || axis == Axis.DESCENDANTSORSELFFROMROOT) || (axis == Axis.ATTRIBUTE)) 120 return true; 121 } 122 return false; 123 } 124 } 125 else 126 return false; 127 } 128 return true; 129 } 130 return false; 131 } 132 133 134 183 193 public void fixupVariables(java.util.Vector vars, int globalsSize) 194 { 195 super.fixupVariables(vars, globalsSize); 196 197 int analysis = getAnalysisBits(); 198 if(WalkerFactory.isNaturalDocOrder(analysis)) 199 { 200 m_inNaturalOrderStatic = true; 201 } 202 else 203 { 204 m_inNaturalOrderStatic = false; 205 } 208 209 } 210 211 } 212 | Popular Tags |