blob: 823b2cf0446628abd6d13585abe1873b6ed380f8 [file] [log] [blame]
nitindd6e591d2005-03-14 22:21:57 +00001/*******************************************************************************
2 * Copyright (c) 2001, 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 *******************************************************************************/
11
12package org.eclipse.wst.dtd.core.internal.saxparser;
13
14import java.util.Enumeration;
15import java.util.Vector;
16
17public class CMGroupNode extends CMRepeatableNode {
18 private int type = CMNodeType.GROUP;
19 private int groupKind = CMNodeType.GROUP_SEQUENCE;
20 private Vector children = new Vector();
21
22 public CMGroupNode() {
david_williams38046012005-04-08 19:04:29 +000023 super("GROUP"); //$NON-NLS-1$
nitindd6e591d2005-03-14 22:21:57 +000024 }
25
26 public int getType() {
27 return type;
28 }
29
30 // implement super class
31 public void setType(int type) {
32 // can't change - only one type allows
33 }
34
35 public int getGroupKind() {
36 return groupKind;
37 }
38
39 public void setGroupKind(int kind) {
40 groupKind = kind;
41 }
42
43 public Vector getChildren() {
44 return children;
45 }
46
47 public void addChild(CMNode child) {
48 children.addElement(child);
49 }
50
51 public String toString() {
david_williams38046012005-04-08 19:04:29 +000052 String result = "Group ( - kind: " + getGroupKind() + " OccType: " + getOccurrence() + "\n"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
nitindd6e591d2005-03-14 22:21:57 +000053
54 Enumeration en = children.elements();
55 while (en.hasMoreElements()) {
david_williams38046012005-04-08 19:04:29 +000056 result += " " + en.nextElement(); //$NON-NLS-1$
nitindd6e591d2005-03-14 22:21:57 +000057 }
58
david_williams38046012005-04-08 19:04:29 +000059 result += "Group )"; //$NON-NLS-1$
nitindd6e591d2005-03-14 22:21:57 +000060 return result;
61 }
62}