blob: a821fc51b9fa507da29b6eba7e95a05057724d77 [file] [log] [blame]
nitind958d79a2004-11-23 19:23:00 +00001/*******************************************************************************
2 * Copyright (c) 2004 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11package org.eclipse.wst.html.core.contentmodel;
12
13
14
15import org.eclipse.wst.common.contentmodel.CMNode;
16import org.eclipse.wst.common.contentmodel.CMNodeList;
17
18/**
19 * Analog of dom.NodeList for CM.
20 * So, the implementation is very similar to
21 * {@link com.ibm.sed.model.xml.NodeListImpl}.<br>
22 */
23class CMNodeListImpl implements CMNodeList {
24
25 private java.util.Vector nodes = null;
26
27 /**
28 * CMNodeListImpl constructor comment.
29 */
30 public CMNodeListImpl() {
31 super();
32 nodes = new java.util.Vector();
33 }
34
35 /**
36 * @return org.eclipse.wst.common.contentmodel.CMNode
37 * @param node org.eclipse.wst.common.contentmodel.CMNode
38 */
39 protected CMNode appendNode(CMNode node) {
40 nodes.addElement(node);
41 return node;
42 }
43
44 /**
45 * getLength method
46 * @return int
47 */
48 public int getLength() {
49 return nodes.size();
50 }
51
52 /**
53 * item method
54 * @return CMNode
55 * @param index int
56 */
57 public CMNode item(int index) {
58 if (index < 0 || index >= nodes.size())
59 return null;
60 return (CMNode) nodes.elementAt(index);
61 }
62}