01: // You can redistribute this software and/or modify it under the terms of
02: // the Ozone Library License version 1 published by ozone-db.org.
03: //
04: // The original code and portions created by SMB are
05: // Copyright (C) 1997-@year@ by SMB GmbH. All rights reserved.
06: //
07: // $Id: ModifiableNodeList.java,v 1.1 2001/12/18 10:31:31 per_nyfelt Exp $
08:
09: package org.ozoneDB.xml.util;
10:
11: import java.util.Vector;
12:
13: import java.io.Serializable;
14:
15: import org.w3c.dom.Node;
16: import org.w3c.dom.NodeList;
17:
18: public final class ModifiableNodeList implements NodeList, Serializable {
19:
20: private Vector nodes = null;
21:
22: public ModifiableNodeList() {
23: this .nodes = new Vector();
24: }
25:
26: public ModifiableNodeList(int initialCapacity) {
27: this .nodes = new Vector(initialCapacity);
28: }
29:
30: public void addNode(Node node) {
31: this .nodes.add(node);
32: }
33:
34: public void removeNode(int index) {
35: this .nodes.remove(index);
36: }
37:
38: //
39: // org.w3c.dom.NodeList implementation
40: //
41:
42: public Node item(int index) {
43: return ((index >= 0) && (index < this .nodes.size())) ? (Node) this .nodes
44: .elementAt(index)
45: : null;
46: }
47:
48: public int getLength() {
49: return this.nodes.size();
50: }
51:
52: }
|