1 16 19 package org.apache.xpath.axes; 20 21 import org.apache.xml.dtm.DTM; 22 import org.apache.xml.dtm.DTMFilter; 23 import org.apache.xpath.Expression; 24 import org.apache.xpath.compiler.Compiler; 25 26 34 public class OneStepIteratorForward extends ChildTestIterator 35 { 36 37 protected int m_axis = -1; 38 39 48 OneStepIteratorForward(Compiler compiler, int opPos, int analysis) 49 throws javax.xml.transform.TransformerException 50 { 51 super(compiler, opPos, analysis); 52 int firstStepPos = compiler.getFirstChildPos(opPos); 53 54 m_axis = WalkerFactory.getAxisFromStep(compiler, firstStepPos); 55 56 } 57 58 65 public OneStepIteratorForward(int axis) 66 { 67 super(null); 68 69 m_axis = axis; 70 int whatToShow = DTMFilter.SHOW_ALL; 71 initNodeTest(whatToShow); 72 } 73 74 75 76 77 84 public void setRoot(int context, Object environment) 85 { 86 super.setRoot(context, environment); 87 m_traverser = m_cdtm.getAxisTraverser(m_axis); 88 89 } 90 91 131 134 protected int getNextNode() 135 { 136 m_lastFetched = (DTM.NULL == m_lastFetched) 137 ? m_traverser.first(m_context) 138 : m_traverser.next(m_context, m_lastFetched); 139 return m_lastFetched; 140 } 141 142 148 public int getAxis() 149 { 150 return m_axis; 151 } 152 153 156 public boolean deepEquals(Expression expr) 157 { 158 if(!super.deepEquals(expr)) 159 return false; 160 161 if(m_axis != ((OneStepIteratorForward)expr).m_axis) 162 return false; 163 164 return true; 165 } 166 167 168 } 169 | Popular Tags |