blob: 000703950a1ca8d4fa4fbd7f3f80a8e931b3ba85 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2001, 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.wst.dtd.core.internal.emf.impl;
import org.eclipse.wst.dtd.core.internal.emf.DTDElementContent;
import org.eclipse.wst.dtd.core.internal.emf.DTDElementReferenceContent;
import org.eclipse.wst.dtd.core.internal.emf.DTDEmptyContent;
import org.eclipse.wst.dtd.core.internal.emf.DTDEntityReferenceContent;
import org.eclipse.wst.dtd.core.internal.emf.DTDGroupContent;
import org.eclipse.wst.dtd.core.internal.emf.DTDPCDataContent;
public class DTDIdHelper {
public DTDIdHelper() {
}
public String computeContentId(DTDElementContent content) {
String id = ""; //$NON-NLS-1$
if (content instanceof DTDEmptyContent) {
id = "#EMPTY"; //$NON-NLS-1$
}
else if (content instanceof DTDPCDataContent) {
id = "#PCDATA"; //$NON-NLS-1$
}
else if (content instanceof DTDEmptyContent) {
id = "#EMPTY"; //$NON-NLS-1$
}
else if (content instanceof DTDElementReferenceContent) {
id = "#" + ((DTDElementReferenceContent) content).getReferencedElement().getName(); //$NON-NLS-1$
}
else if (content instanceof DTDEntityReferenceContent) {
id = "#" + ((DTDEntityReferenceContent) content).getElementReferencedEntity().getName(); //$NON-NLS-1$
}
else if (content instanceof DTDGroupContent) {
id = computeGroupId((DTDGroupContent) content);
}
return id;
}
public String computeGroupId(DTDGroupContent grp) {
String groupId = "_"; //$NON-NLS-1$
return groupId;
}
/**
* @generated
*/
protected String computeContentIdGen(DTDElementContent content) {
String id = ""; //$NON-NLS-1$
if (content instanceof DTDEmptyContent) {
id = "#EMPTY"; //$NON-NLS-1$
}
else if (content instanceof DTDPCDataContent) {
id = "#PCDATA"; //$NON-NLS-1$
}
else if (content instanceof DTDEmptyContent) {
id = "#EMPTY"; //$NON-NLS-1$
}
else if (content instanceof DTDElementReferenceContent) {
id = "#" + ((DTDElementReferenceContent) content).getReferencedElement().getName(); //$NON-NLS-1$
}
else if (content instanceof DTDEntityReferenceContent) {
id = "#" + ((DTDEntityReferenceContent) content).getElementReferencedEntity().getName(); //$NON-NLS-1$
}
else if (content instanceof DTDGroupContent) {
id = computeGroupId((DTDGroupContent) content);
}
return id;
}
/**
* @generated
*/
protected String computeGroupIdGen(DTDGroupContent grp) {
String groupId = "_"; //$NON-NLS-1$
return groupId;
}
}