blob: ddcdb1c05450ba02687b9ea532173b8bc4729a1e [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 *******************************************************************************/
david_williams56777022005-04-11 06:21:55 +000011package org.eclipse.wst.html.core.internal.contentmodel;
nitind958d79a2004-11-23 19:23:00 +000012
13
14
david_williamsc06c86f2005-03-18 18:23:41 +000015import org.eclipse.wst.xml.core.internal.contentmodel.CMNode;
16import org.eclipse.wst.xml.core.internal.contentmodel.CMNodeList;
nitind958d79a2004-11-23 19:23:00 +000017
18/**
19 * Analog of dom.NodeList for CM.
20 * So, the implementation is very similar to
david_williams47a33d22005-05-28 01:26:57 +000021 * NodeListImpl<br>
nitind958d79a2004-11-23 19:23:00 +000022 */
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 /**
david_williamsc06c86f2005-03-18 18:23:41 +000036 * @return org.eclipse.wst.xml.core.internal.contentmodel.CMNode
37 * @param node org.eclipse.wst.xml.core.internal.contentmodel.CMNode
nitind958d79a2004-11-23 19:23:00 +000038 */
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}