[9874] | 1 | /*
|
---|
| 2 | * MyNodeList.java
|
---|
| 3 | *
|
---|
| 4 |
|
---|
| 5 | * Copyright (C) 2005 New Zealand Digital Library, http://www.nzdl.org
|
---|
| 6 | *
|
---|
| 7 | * This program is free software; you can redistribute it and/or modify
|
---|
| 8 | * it under the terms of the GNU General Public License as published by
|
---|
| 9 | * the Free Software Foundation; either version 2 of the License, or
|
---|
| 10 | * (at your option) any later version.
|
---|
| 11 | *
|
---|
| 12 | * This program is distributed in the hope that it will be useful,
|
---|
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 15 | * GNU General Public License for more details.
|
---|
| 16 | *
|
---|
| 17 | * You should have received a copy of the GNU General Public License
|
---|
| 18 | * along with this program; if not, write to the Free Software
|
---|
| 19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
| 20 | */
|
---|
| 21 | package org.greenstone.gsdl3.util;
|
---|
| 22 |
|
---|
| 23 | import org.w3c.dom.Node;
|
---|
| 24 | import org.w3c.dom.NodeList;
|
---|
| 25 |
|
---|
| 26 | import java.util.ArrayList;
|
---|
| 27 |
|
---|
[25657] | 28 | public class MyNodeList implements NodeList
|
---|
| 29 | {
|
---|
| 30 | private ArrayList<Node> _nodeList = null;
|
---|
| 31 |
|
---|
| 32 | public MyNodeList()
|
---|
| 33 | {
|
---|
| 34 | _nodeList = new ArrayList<Node>();
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 | public int getLength()
|
---|
| 38 | {
|
---|
| 39 | return _nodeList.size();
|
---|
| 40 | }
|
---|
| 41 |
|
---|
| 42 | public Node item(int i)
|
---|
| 43 | {
|
---|
| 44 | if (i < 0 || i >= _nodeList.size())
|
---|
| 45 | return null;
|
---|
| 46 | return _nodeList.get(i);
|
---|
| 47 | }
|
---|
| 48 |
|
---|
| 49 | public void addNode(Node n)
|
---|
| 50 | {
|
---|
| 51 | _nodeList.add(n);
|
---|
| 52 | }
|
---|
| 53 |
|
---|
| 54 | public void addNodeList(NodeList nl)
|
---|
| 55 | {
|
---|
| 56 | for(int i = 0; i < nl.getLength(); i++)
|
---|
| 57 | {
|
---|
| 58 | _nodeList.add(nl.item(i));
|
---|
| 59 | }
|
---|
| 60 | }
|
---|
[9874] | 61 | }
|
---|