/** | |
* ******************************************************************************* | |
* 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 v2.0 | |
* which accompanies this distribution, and is available at | |
* http://www.eclipse.org/legal/epl-v20.html | |
* | |
* Contributors: | |
* Nikolai Mansourov (Hatha Systems) - initial API and implementation | |
* ******************************************************************************* | |
* | |
* $Id$ | |
*/ | |
package org.eclipse.modisco.omg.kdm.data.impl; | |
import java.util.Collection; | |
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.util.EObjectContainmentEList; | |
import org.eclipse.emf.ecore.util.InternalEList; | |
import org.eclipse.modisco.omg.kdm.action.ActionElement; | |
import org.eclipse.modisco.omg.kdm.core.impl.KDMEntityImpl; | |
import org.eclipse.modisco.omg.kdm.data.AbstractDataRelationship; | |
import org.eclipse.modisco.omg.kdm.data.DataPackage; | |
import org.eclipse.modisco.omg.kdm.data.DataResource; | |
import org.eclipse.modisco.omg.kdm.source.SourceRef; | |
/** | |
* <!-- begin-user-doc --> | |
* An implementation of the model object '<em><b>Resource</b></em>'. | |
* <!-- end-user-doc --> | |
* <p> | |
* The following features are implemented: | |
* <ul> | |
* <li>{@link org.eclipse.modisco.omg.kdm.data.impl.DataResourceImpl#getSource <em>Source</em>}</li> | |
* <li>{@link org.eclipse.modisco.omg.kdm.data.impl.DataResourceImpl#getDataRelation <em>Data Relation</em>}</li> | |
* <li>{@link org.eclipse.modisco.omg.kdm.data.impl.DataResourceImpl#getAbstraction <em>Abstraction</em>}</li> | |
* </ul> | |
* </p> | |
* | |
* @generated | |
*/ | |
public class DataResourceImpl extends KDMEntityImpl implements DataResource { | |
/** | |
* The cached value of the '{@link #getSource() <em>Source</em>}' containment reference list. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getSource() | |
* @generated | |
* @ordered | |
*/ | |
protected EList<SourceRef> source; | |
/** | |
* The cached value of the '{@link #getDataRelation() <em>Data Relation</em>}' containment reference list. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getDataRelation() | |
* @generated | |
* @ordered | |
*/ | |
protected EList<AbstractDataRelationship> dataRelation; | |
/** | |
* The cached value of the '{@link #getAbstraction() <em>Abstraction</em>}' containment reference list. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getAbstraction() | |
* @generated | |
* @ordered | |
*/ | |
protected EList<ActionElement> abstraction; | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
protected DataResourceImpl() { | |
super(); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
protected EClass eStaticClass() { | |
return DataPackage.Literals.DATA_RESOURCE; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public EList<SourceRef> getSource() { | |
if (source == null) { | |
source = new EObjectContainmentEList<SourceRef>(SourceRef.class, this, DataPackage.DATA_RESOURCE__SOURCE); | |
} | |
return source; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public EList<AbstractDataRelationship> getDataRelation() { | |
if (dataRelation == null) { | |
dataRelation = new EObjectContainmentEList<AbstractDataRelationship>(AbstractDataRelationship.class, this, DataPackage.DATA_RESOURCE__DATA_RELATION); | |
} | |
return dataRelation; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public EList<ActionElement> getAbstraction() { | |
if (abstraction == null) { | |
abstraction = new EObjectContainmentEList<ActionElement>(ActionElement.class, this, DataPackage.DATA_RESOURCE__ABSTRACTION); | |
} | |
return abstraction; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { | |
switch (featureID) { | |
case DataPackage.DATA_RESOURCE__SOURCE: | |
return ((InternalEList<?>)getSource()).basicRemove(otherEnd, msgs); | |
case DataPackage.DATA_RESOURCE__DATA_RELATION: | |
return ((InternalEList<?>)getDataRelation()).basicRemove(otherEnd, msgs); | |
case DataPackage.DATA_RESOURCE__ABSTRACTION: | |
return ((InternalEList<?>)getAbstraction()).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 DataPackage.DATA_RESOURCE__SOURCE: | |
return getSource(); | |
case DataPackage.DATA_RESOURCE__DATA_RELATION: | |
return getDataRelation(); | |
case DataPackage.DATA_RESOURCE__ABSTRACTION: | |
return getAbstraction(); | |
} | |
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.DATA_RESOURCE__SOURCE: | |
getSource().clear(); | |
getSource().addAll((Collection<? extends SourceRef>)newValue); | |
return; | |
case DataPackage.DATA_RESOURCE__DATA_RELATION: | |
getDataRelation().clear(); | |
getDataRelation().addAll((Collection<? extends AbstractDataRelationship>)newValue); | |
return; | |
case DataPackage.DATA_RESOURCE__ABSTRACTION: | |
getAbstraction().clear(); | |
getAbstraction().addAll((Collection<? extends ActionElement>)newValue); | |
return; | |
} | |
super.eSet(featureID, newValue); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public void eUnset(int featureID) { | |
switch (featureID) { | |
case DataPackage.DATA_RESOURCE__SOURCE: | |
getSource().clear(); | |
return; | |
case DataPackage.DATA_RESOURCE__DATA_RELATION: | |
getDataRelation().clear(); | |
return; | |
case DataPackage.DATA_RESOURCE__ABSTRACTION: | |
getAbstraction().clear(); | |
return; | |
} | |
super.eUnset(featureID); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public boolean eIsSet(int featureID) { | |
switch (featureID) { | |
case DataPackage.DATA_RESOURCE__SOURCE: | |
return source != null && !source.isEmpty(); | |
case DataPackage.DATA_RESOURCE__DATA_RELATION: | |
return dataRelation != null && !dataRelation.isEmpty(); | |
case DataPackage.DATA_RESOURCE__ABSTRACTION: | |
return abstraction != null && !abstraction.isEmpty(); | |
} | |
return super.eIsSet(featureID); | |
} | |
} //DataResourceImpl |