/** | |
* ******************************************************************************* | |
* Copyright (c) 2008 Hatha Systems. | |
* 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: | |
* Nikolai Mansourov (Hatha Systems) - initial API and implementation | |
* ******************************************************************************* | |
* | |
* $Id$ | |
*/ | |
package org.eclipse.gmt.modisco.omg.kdm.data.impl; | |
import java.util.Collection; | |
import org.eclipse.emf.common.notify.Notification; | |
import org.eclipse.emf.common.util.EList; | |
import org.eclipse.emf.ecore.EClass; | |
import org.eclipse.emf.ecore.impl.ENotificationImpl; | |
import org.eclipse.emf.ecore.util.EObjectResolvingEList; | |
import org.eclipse.gmt.modisco.omg.kdm.data.ComplexContentType; | |
import org.eclipse.gmt.modisco.omg.kdm.data.DataPackage; | |
import org.eclipse.gmt.modisco.omg.kdm.data.SimpleContentType; | |
/** | |
* <!-- begin-user-doc --> | |
* An implementation of the model object '<em><b>Simple Content Type</b></em>'. | |
* <!-- end-user-doc --> | |
* <p> | |
* The following features are implemented: | |
* <ul> | |
* <li>{@link org.eclipse.gmt.modisco.omg.kdm.data.impl.SimpleContentTypeImpl#getType <em>Type</em>}</li> | |
* <li>{@link org.eclipse.gmt.modisco.omg.kdm.data.impl.SimpleContentTypeImpl#getKind <em>Kind</em>}</li> | |
* </ul> | |
* </p> | |
* | |
* @generated | |
*/ | |
public class SimpleContentTypeImpl extends ComplexContentTypeImpl implements SimpleContentType { | |
/** | |
* The cached value of the '{@link #getType() <em>Type</em>}' reference list. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getType() | |
* @generated | |
* @ordered | |
*/ | |
protected EList<ComplexContentType> type; | |
/** | |
* The default value of the '{@link #getKind() <em>Kind</em>}' attribute. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getKind() | |
* @generated | |
* @ordered | |
*/ | |
protected static final String KIND_EDEFAULT = null; | |
/** | |
* The cached value of the '{@link #getKind() <em>Kind</em>}' attribute. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getKind() | |
* @generated | |
* @ordered | |
*/ | |
protected String kind = KIND_EDEFAULT; | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
protected SimpleContentTypeImpl() { | |
super(); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
protected EClass eStaticClass() { | |
return DataPackage.Literals.SIMPLE_CONTENT_TYPE; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public EList<ComplexContentType> getType() { | |
if (type == null) { | |
type = new EObjectResolvingEList<ComplexContentType>(ComplexContentType.class, this, DataPackage.SIMPLE_CONTENT_TYPE__TYPE); | |
} | |
return type; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public String getKind() { | |
return kind; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public void setKind(String newKind) { | |
String oldKind = kind; | |
kind = newKind; | |
if (eNotificationRequired()) | |
eNotify(new ENotificationImpl(this, Notification.SET, DataPackage.SIMPLE_CONTENT_TYPE__KIND, oldKind, kind)); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public Object eGet(int featureID, boolean resolve, boolean coreType) { | |
switch (featureID) { | |
case DataPackage.SIMPLE_CONTENT_TYPE__TYPE: | |
return getType(); | |
case DataPackage.SIMPLE_CONTENT_TYPE__KIND: | |
return getKind(); | |
} | |
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 DataPackage.SIMPLE_CONTENT_TYPE__TYPE: | |
getType().clear(); | |
getType().addAll((Collection<? extends ComplexContentType>)newValue); | |
return; | |
case DataPackage.SIMPLE_CONTENT_TYPE__KIND: | |
setKind((String)newValue); | |
return; | |
} | |
super.eSet(featureID, newValue); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public void eUnset(int featureID) { | |
switch (featureID) { | |
case DataPackage.SIMPLE_CONTENT_TYPE__TYPE: | |
getType().clear(); | |
return; | |
case DataPackage.SIMPLE_CONTENT_TYPE__KIND: | |
setKind(KIND_EDEFAULT); | |
return; | |
} | |
super.eUnset(featureID); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public boolean eIsSet(int featureID) { | |
switch (featureID) { | |
case DataPackage.SIMPLE_CONTENT_TYPE__TYPE: | |
return type != null && !type.isEmpty(); | |
case DataPackage.SIMPLE_CONTENT_TYPE__KIND: | |
return KIND_EDEFAULT == null ? kind != null : !KIND_EDEFAULT.equals(kind); | |
} | |
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(" (kind: "); //$NON-NLS-1$ | |
result.append(kind); | |
result.append(')'); | |
return result.toString(); | |
} | |
} //SimpleContentTypeImpl |