/** | |
* ******************************************************************************* | |
* Copyright (c) 2009 Mia-Software. | |
* All rights reserved. This program and the accompanying materials | |
* are made available under the terms of the Eclipse Public License v2.0 | |
* which accompanies this distribution, and is available at | |
* http://www.eclipse.org/legal/epl-v20.html | |
* | |
* Contributors: | |
* | |
* Fabien Giquel (Mia-Software) - initial API and implementation | |
* ******************************************************************************* | |
* | |
* $Id$ | |
*/ | |
package org.eclipse.modisco.java.emf.classic.impl; | |
import java.util.Collection; | |
import org.eclipse.emf.common.notify.Notification; | |
import org.eclipse.emf.common.notify.NotificationChain; | |
import org.eclipse.emf.common.util.EList; | |
import org.eclipse.emf.ecore.EClass; | |
import org.eclipse.emf.ecore.InternalEObject; | |
import org.eclipse.emf.ecore.impl.ENotificationImpl; | |
import org.eclipse.emf.ecore.util.EObjectContainmentEList; | |
import org.eclipse.emf.ecore.util.InternalEList; | |
import org.eclipse.modisco.java.ASTNode; | |
import org.eclipse.modisco.java.TagElement; | |
import org.eclipse.modisco.java.emf.classic.JavaPackage; | |
/** | |
* <!-- begin-user-doc --> | |
* An implementation of the model object '<em><b>Tag Element</b></em>'. | |
* <!-- end-user-doc --> | |
* <p> | |
* The following features are implemented: | |
* <ul> | |
* <li>{@link org.eclipse.modisco.java.emf.classic.impl.TagElementImpl#getTagName <em>Tag Name</em>}</li> | |
* <li>{@link org.eclipse.modisco.java.emf.classic.impl.TagElementImpl#getFragments <em>Fragments</em>}</li> | |
* </ul> | |
* </p> | |
* | |
* @generated | |
*/ | |
public class TagElementImpl extends ASTNodeImpl implements TagElement { | |
/** | |
* The default value of the '{@link #getTagName() <em>Tag Name</em>}' attribute. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getTagName() | |
* @generated | |
* @ordered | |
*/ | |
protected static final String TAG_NAME_EDEFAULT = null; | |
/** | |
* The cached value of the '{@link #getTagName() <em>Tag Name</em>}' attribute. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getTagName() | |
* @generated | |
* @ordered | |
*/ | |
protected String tagName = TAG_NAME_EDEFAULT; | |
/** | |
* The cached value of the '{@link #getFragments() <em>Fragments</em>}' containment reference list. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getFragments() | |
* @generated | |
* @ordered | |
*/ | |
protected EList<ASTNode> fragments; | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
protected TagElementImpl() { | |
super(); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
protected EClass eStaticClass() { | |
return JavaPackage.eINSTANCE.getTagElement(); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public String getTagName() { | |
return tagName; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public void setTagName(String newTagName) { | |
String oldTagName = tagName; | |
tagName = newTagName; | |
if (eNotificationRequired()) | |
eNotify(new ENotificationImpl(this, Notification.SET, JavaPackage.TAG_ELEMENT__TAG_NAME, oldTagName, tagName)); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public EList<ASTNode> getFragments() { | |
if (fragments == null) { | |
fragments = new EObjectContainmentEList<ASTNode>(ASTNode.class, this, JavaPackage.TAG_ELEMENT__FRAGMENTS); | |
} | |
return fragments; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { | |
switch (featureID) { | |
case JavaPackage.TAG_ELEMENT__FRAGMENTS: | |
return ((InternalEList<?>)getFragments()).basicRemove(otherEnd, msgs); | |
} | |
return super.eInverseRemove(otherEnd, featureID, msgs); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public Object eGet(int featureID, boolean resolve, boolean coreType) { | |
switch (featureID) { | |
case JavaPackage.TAG_ELEMENT__TAG_NAME: | |
return getTagName(); | |
case JavaPackage.TAG_ELEMENT__FRAGMENTS: | |
return getFragments(); | |
} | |
return super.eGet(featureID, resolve, coreType); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@SuppressWarnings("unchecked") | |
@Override | |
public void eSet(int featureID, Object newValue) { | |
switch (featureID) { | |
case JavaPackage.TAG_ELEMENT__TAG_NAME: | |
setTagName((String)newValue); | |
return; | |
case JavaPackage.TAG_ELEMENT__FRAGMENTS: | |
getFragments().clear(); | |
getFragments().addAll((Collection<? extends ASTNode>)newValue); | |
return; | |
} | |
super.eSet(featureID, newValue); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public void eUnset(int featureID) { | |
switch (featureID) { | |
case JavaPackage.TAG_ELEMENT__TAG_NAME: | |
setTagName(TAG_NAME_EDEFAULT); | |
return; | |
case JavaPackage.TAG_ELEMENT__FRAGMENTS: | |
getFragments().clear(); | |
return; | |
} | |
super.eUnset(featureID); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public boolean eIsSet(int featureID) { | |
switch (featureID) { | |
case JavaPackage.TAG_ELEMENT__TAG_NAME: | |
return TAG_NAME_EDEFAULT == null ? tagName != null : !TAG_NAME_EDEFAULT.equals(tagName); | |
case JavaPackage.TAG_ELEMENT__FRAGMENTS: | |
return fragments != null && !fragments.isEmpty(); | |
} | |
return super.eIsSet(featureID); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public String toString() { | |
if (eIsProxy()) return super.toString(); | |
StringBuffer result = new StringBuffer(super.toString()); | |
result.append(" (tagName: "); //$NON-NLS-1$ | |
result.append(tagName); | |
result.append(')'); | |
return result.toString(); | |
} | |
} //TagElementImpl |