blob: 9205120b769bab34f596ba6fe1214b40b632df22 [file] [log] [blame]
/**
* <copyright>
*
* Copyright (c) 2018, 2019 Willink Transformations and others.
* 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:
* E.D.Willink - Initial API and implementation
*
* </copyright>
*/
package org.eclipse.qvtd.xml.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.qvtd.xml.DataTypeAttribute;
import org.eclipse.qvtd.xml.Element;
import org.eclipse.qvtd.xml.Node;
import org.eclipse.qvtd.xml.XMLmodelPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Element</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.qvtd.xml.impl.ElementImpl#getLocalName <em>Local Name</em>}</li>
* <li>{@link org.eclipse.qvtd.xml.impl.ElementImpl#getQName <em>QName</em>}</li>
* <li>{@link org.eclipse.qvtd.xml.impl.ElementImpl#getUri <em>Uri</em>}</li>
* <li>{@link org.eclipse.qvtd.xml.impl.ElementImpl#getEcoreClassifier <em>Ecore Classifier</em>}</li>
* </ul>
*
* @generated
*/
public class ElementImpl extends NodeImpl implements Element {
/**
* The number of structural features of the '<em>Element</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public static final int ELEMENT_FEATURE_COUNT = NodeImpl.NODE_FEATURE_COUNT + 4;
/**
* The number of operations of the '<em>Element</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public static final int ELEMENT_OPERATION_COUNT = NodeImpl.NODE_OPERATION_COUNT + 0;
/**
* The default value of the '{@link #getLocalName() <em>Local Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLocalName()
* @generated
* @ordered
*/
protected static final String LOCAL_NAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getLocalName() <em>Local Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLocalName()
* @generated
* @ordered
*/
protected String localName = LOCAL_NAME_EDEFAULT;
/**
* The default value of the '{@link #getQName() <em>QName</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getQName()
* @generated
* @ordered
*/
protected static final String QNAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getQName() <em>QName</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getQName()
* @generated
* @ordered
*/
protected String qName = QNAME_EDEFAULT;
/**
* The default value of the '{@link #getUri() <em>Uri</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getUri()
* @generated
* @ordered
*/
protected static final String URI_EDEFAULT = null;
/**
* The cached value of the '{@link #getUri() <em>Uri</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getUri()
* @generated
* @ordered
*/
protected String uri = URI_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ElementImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return XMLmodelPackage.Literals.ELEMENT;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String getLocalName() {
return localName;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setLocalName(String newLocalName) {
String oldLocalName = localName;
localName = newLocalName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, 1, oldLocalName, localName));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String getQName() {
return qName;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setQName(String newQName) {
String oldQName = qName;
qName = newQName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, 2, oldQName, qName));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String getUri() {
return uri;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setUri(String newUri) {
String oldUri = uri;
uri = newUri;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, 3, oldUri, uri));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case 1:
return getLocalName();
case 2:
return getQName();
case 3:
return getUri();
case 4:
return getEcoreClassifier();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case 1:
setLocalName((String)newValue);
return;
case 2:
setQName((String)newValue);
return;
case 3:
setUri((String)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case 1:
setLocalName(LOCAL_NAME_EDEFAULT);
return;
case 2:
setQName(QNAME_EDEFAULT);
return;
case 3:
setUri(URI_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case 1:
return LOCAL_NAME_EDEFAULT == null ? localName != null : !LOCAL_NAME_EDEFAULT.equals(localName);
case 2:
return QNAME_EDEFAULT == null ? qName != null : !QNAME_EDEFAULT.equals(qName);
case 3:
return URI_EDEFAULT == null ? uri != null : !URI_EDEFAULT.equals(uri);
case 4:
return getEcoreClassifier() != null;
}
return super.eIsSet(featureID);
}
@Override
public EClassifier getEcoreClassifier() {
return null;
}
@Override
public String toString() {
StringBuilder s = new StringBuilder();
s.append("<");
s.append(qName);
for (@NonNull Node node : children) {
if (node instanceof DataTypeAttribute) {
s.append(" ");
s.append(node.toString());
}
}
s.append(" ... />");
return s.toString();
}
} //ElementImpl