From: Wolfgang M. M. <wol...@us...> - 2004-06-23 14:05:58
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/dom In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7342/src/org/exist/dom Modified Files: AVLTreeNodeSet.java Log Message: Added itemAt method to AVLTreeSet to avoid RuntimeException. Index: AVLTreeNodeSet.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/dom/AVLTreeNodeSet.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** AVLTreeNodeSet.java 21 Jun 2004 15:27:36 -0000 1.7 --- AVLTreeNodeSet.java 23 Jun 2004 14:05:49 -0000 1.8 *************** *** 45,49 **** */ public org.w3c.dom.Node item(int pos) { ! // TODO Auto-generated method stub return null; } --- 45,54 ---- */ public org.w3c.dom.Node item(int pos) { ! int i = 0; ! for(Iterator it = iterator(); it.hasNext(); i++) { ! NodeProxy p = (NodeProxy) it.next(); ! if(i == pos) ! return p.getNode(); ! } return null; } *************** *** 53,58 **** */ public NodeProxy get(int pos) { ! // TODO Auto-generated method stub ! return null; } --- 58,62 ---- */ public NodeProxy get(int pos) { ! return (NodeProxy)itemAt(pos); } *************** *** 69,73 **** */ public Item itemAt(int pos) { ! throw new RuntimeException("unsupported method: itemAt"); } --- 73,83 ---- */ public Item itemAt(int pos) { ! int i = 0; ! for(Iterator it = iterator(); it.hasNext(); i++) { ! NodeProxy p = (NodeProxy) it.next(); ! if(i == pos) ! return p; ! } ! return null; } |