+++ /dev/null
-/*--------------------------------------------------------------------------\r
- * Copyright 2004 Taro L. Saito\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- *--------------------------------------------------------------------------*/\r
-//--------------------------------------\r
-// org.xerial.util.xml.dom Project\r
-// \r
-// NodeList.java \r
-// Since: 2004/12/30\r
-//\r
-// $URL: http://www.xerial.org/svn/project/XerialJ/trunk/xerial-core/src/main/java/org/xerial/util/xml/dom/IterableNodeList.java $ \r
-// $Author: leo $\r
-//--------------------------------------\r
-\r
-package org.xerial.util.xml.dom;\r
-\r
-import java.util.Iterator;\r
-\r
-import org.w3c.dom.Node;\r
-import org.w3c.dom.NodeList;\r
-\r
-/**\r
- * @author leo\r
- *\r
- */\r
-public class IterableNodeList implements Iterable<Node>, NodeList\r
-{\r
-\r
- \r
- NodeList _nodeList;\r
- /**\r
- * \r
- */\r
- public IterableNodeList(NodeList nodeList)\r
- {\r
- assert nodeList != null;\r
- _nodeList = nodeList;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see java.lang.Iterable#iterator()\r
- */\r
- public Iterator<Node> iterator() {\r
- return new NodeListIterator(_nodeList);\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see org.w3c.dom.NodeList#item(int)\r
- */\r
- public Node item(int index) {\r
- _nodeList.item(index);\r
- return null;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see org.w3c.dom.NodeList#getLength()\r
- */\r
- public int getLength() {\r
- return _nodeList.getLength();\r
- }\r
-\r
-\r
-}\r
-\r
-class NodeListIterator implements Iterator<Node>\r
-{\r
- NodeList _nodeList;\r
- int _index = 0;\r
- int _length = 0;\r
- public NodeListIterator(org.w3c.dom.NodeList nodeList)\r
- {\r
- _nodeList = nodeList;\r
- _index = 0;\r
- _length = _nodeList.getLength();\r
- }\r
- public boolean hasNext() {\r
- return _index < _length;\r
- }\r
- public void remove() {\r
- throw new UnsupportedOperationException("remove method for NodeList is not supported");\r
- }\r
- public Node next() {\r
- return _nodeList.item(_index++);\r
- }\r
-}\r
-\r
-\r
-\r
-//--------------------------------------\r
-// $Log$\r
-//--------------------------------------
\ No newline at end of file