nitind | d6e591d | 2005-03-14 22:21:57 +0000 | [diff] [blame] | 1 | /******************************************************************************* |
| 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 | |
| 12 | package org.eclipse.wst.dtd.core.internal.saxparser; |
| 13 | |
| 14 | import java.util.Enumeration; |
| 15 | import java.util.Vector; |
| 16 | |
| 17 | public 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_williams | 3804601 | 2005-04-08 19:04:29 +0000 | [diff] [blame] | 23 | super("GROUP"); //$NON-NLS-1$ |
nitind | d6e591d | 2005-03-14 22:21:57 +0000 | [diff] [blame] | 24 | } |
| 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_williams | 3804601 | 2005-04-08 19:04:29 +0000 | [diff] [blame] | 52 | String result = "Group ( - kind: " + getGroupKind() + " OccType: " + getOccurrence() + "\n"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
nitind | d6e591d | 2005-03-14 22:21:57 +0000 | [diff] [blame] | 53 | |
| 54 | Enumeration en = children.elements(); |
| 55 | while (en.hasMoreElements()) { |
david_williams | 3804601 | 2005-04-08 19:04:29 +0000 | [diff] [blame] | 56 | result += " " + en.nextElement(); //$NON-NLS-1$ |
nitind | d6e591d | 2005-03-14 22:21:57 +0000 | [diff] [blame] | 57 | } |
| 58 | |
david_williams | 3804601 | 2005-04-08 19:04:29 +0000 | [diff] [blame] | 59 | result += "Group )"; //$NON-NLS-1$ |
nitind | d6e591d | 2005-03-14 22:21:57 +0000 | [diff] [blame] | 60 | return result; |
| 61 | } |
| 62 | } |