1 28 29 package com.caucho.xpath.pattern; 30 31 import com.caucho.xpath.ExprEnvironment; 32 33 import org.w3c.dom.Node ; 34 import org.w3c.dom.NodeList ; 35 36 39 public class NodeListIterator extends NodeIterator { 40 protected NodeList _list; 41 protected int _position; 42 43 public NodeListIterator(ExprEnvironment env, NodeList list) 44 { 45 super(env); 46 47 _list = list; 48 } 49 50 53 public int getContextPosition() 54 { 55 return _position; 56 } 57 58 61 public int getContextSize() 62 { 63 return _list.getLength(); 64 } 65 66 69 public boolean hasNext() 70 { 71 return _position < _list.getLength(); 72 } 73 74 77 public Node next() 78 { 79 return nextNode(); 80 } 81 82 85 public Node nextNode() 86 { 87 return _list.item(_position++); 88 } 89 90 93 public Object clone() 94 { 95 NodeListIterator clone = new NodeListIterator(_env, _list); 96 97 clone._position = _position; 98 99 return clone; 100 } 101 } 102 | Popular Tags |