1 29 30 package com.caucho.jcr.base; 31 32 import javax.jcr.Node; 33 import javax.jcr.NodeIterator; 34 35 38 public class BaseNodeIterator implements NodeIterator { 39 private BaseNode []_nodes; 40 private int _index; 41 42 public BaseNodeIterator(BaseNode []nodes) 43 { 44 _nodes = nodes; 45 } 46 49 public Node nextNode() 50 { 51 if (_index < _nodes.length) 52 return _nodes[_index++]; 53 else 54 return null; 55 } 56 57 61 64 public void skip(long skipNum) 65 { 66 _index += skipNum; 67 } 68 69 72 public long getSize() 73 { 74 return _nodes.length; 75 } 76 77 80 public long getPosition() 81 { 82 return _index; 83 } 84 85 89 92 public Object next() 93 { 94 return nextNode(); 95 } 96 97 100 public boolean hasNext() 101 { 102 return _index < _nodes.length; 103 } 104 105 108 public void remove() 109 { 110 throw new UnsupportedOperationException (getClass().getName()); 111 } 112 } 113 | Popular Tags |