[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 |
|
---|
| 28 | public class MyNodeList implements NodeList {
|
---|
| 29 | private ArrayList node_list = null;
|
---|
| 30 |
|
---|
| 31 | public MyNodeList() {
|
---|
| 32 | node_list = new ArrayList();
|
---|
| 33 | }
|
---|
| 34 | public int getLength() {
|
---|
| 35 | return node_list.size();
|
---|
| 36 | }
|
---|
| 37 |
|
---|
| 38 | public Node item(int i) {
|
---|
| 39 | if (i<0 || i >= node_list.size()) return null;
|
---|
| 40 | return (Node)node_list.get(i);
|
---|
| 41 | }
|
---|
| 42 |
|
---|
| 43 | public void addNode(Node n) {
|
---|
| 44 | node_list.add(n);
|
---|
| 45 | }
|
---|
| 46 | }
|
---|