1 28 29 package com.caucho.xpath.pattern; 30 31 import com.caucho.xpath.ExprEnvironment; 32 33 import org.w3c.dom.Node ; 34 35 import java.util.ArrayList ; 36 37 40 public class NodeArrayListIterator extends NodeIterator { 41 protected ArrayList <Node > _list; 42 protected int _position; 43 44 public NodeArrayListIterator(ExprEnvironment env, ArrayList <Node > list) 45 { 46 super(env); 47 48 _list = list; 49 } 50 51 54 public int getContextPosition() 55 { 56 return _position; 57 } 58 59 62 public int getContextSize() 63 { 64 return _list.size(); 65 } 66 67 70 public boolean hasNext() 71 { 72 return _position < _list.size(); 73 } 74 75 78 public Node next() 79 { 80 return nextNode(); 81 } 82 83 86 public Node nextNode() 87 { 88 if (_position < _list.size()) 89 return _list.get(_position++); 90 else 91 return null; 92 } 93 94 97 public Object clone() 98 { 99 NodeArrayListIterator clone = new NodeArrayListIterator(_env, _list); 100 101 clone._position = _position; 102 103 return clone; 104 } 105 } 106 | Popular Tags |