1 16 19 package org.apache.xpath.axes; 20 21 import org.apache.xml.dtm.Axis; 22 import org.apache.xml.dtm.DTM; 23 import org.apache.xml.dtm.DTMAxisTraverser; 24 import org.apache.xml.dtm.DTMIterator; 25 import org.apache.xpath.compiler.Compiler; 26 27 33 public class ChildTestIterator extends BasicTestIterator 34 { 35 36 transient protected DTMAxisTraverser m_traverser; 37 38 39 41 42 51 ChildTestIterator(Compiler compiler, int opPos, int analysis) 52 throws javax.xml.transform.TransformerException 53 { 54 super(compiler, opPos, analysis); 55 } 56 57 64 public ChildTestIterator(DTMAxisTraverser traverser) 65 { 66 67 super(null); 68 69 m_traverser = traverser; 70 } 71 72 76 protected int getNextNode() 77 { 78 if(true ) 79 { 80 m_lastFetched = (DTM.NULL == m_lastFetched) 81 ? m_traverser.first(m_context) 82 : m_traverser.next(m_context, m_lastFetched); 83 } 84 92 return m_lastFetched; 93 } 94 95 96 104 public DTMIterator cloneWithReset() throws CloneNotSupportedException 105 { 106 107 ChildTestIterator clone = (ChildTestIterator) super.cloneWithReset(); 108 clone.m_traverser = m_traverser; 109 110 return clone; 111 } 112 113 114 121 public void setRoot(int context, Object environment) 122 { 123 super.setRoot(context, environment); 124 m_traverser = m_cdtm.getAxisTraverser(Axis.CHILD); 125 126 144 } 145 146 152 public int getAxis() 153 { 154 return org.apache.xml.dtm.Axis.CHILD; 155 } 156 157 164 public void detach() 165 { 166 if(m_allowDetach) 167 { 168 m_traverser = null; 169 170 super.detach(); 172 } 173 } 174 175 } 176 | Popular Tags |