/** | |
* ******************************************************************************* | |
* Copyright (c) 2017-2020 Robert Bosch GmbH and others. | |
* | |
* This program and the accompanying materials are made | |
* available under the terms of the Eclipse Public License 2.0 | |
* which is available at https://www.eclipse.org/legal/epl-2.0/ | |
* | |
* SPDX-License-Identifier: EPL-2.0 | |
* | |
* Generated using Eclipse EMF | |
* | |
* ******************************************************************************* | |
*/ | |
package org.eclipse.app4mc.sca2amalthea.ir.scair.impl; | |
import java.util.Collection; | |
import org.eclipse.app4mc.sca2amalthea.ir.scair.Function; | |
import org.eclipse.app4mc.sca2amalthea.ir.scair.scairPackage; | |
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.impl.MinimalEObjectImpl; | |
import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList; | |
import org.eclipse.emf.ecore.util.InternalEList; | |
/** | |
* <!-- begin-user-doc --> | |
* An implementation of the model object '<em><b>Container</b></em>'. | |
* <!-- end-user-doc --> | |
* <p> | |
* The following features are implemented: | |
* </p> | |
* <ul> | |
* <li>{@link org.eclipse.app4mc.sca2amalthea.ir.scair.impl.ContainerImpl#getName <em>Name</em>}</li> | |
* <li>{@link org.eclipse.app4mc.sca2amalthea.ir.scair.impl.ContainerImpl#getLocation <em>Location</em>}</li> | |
* <li>{@link org.eclipse.app4mc.sca2amalthea.ir.scair.impl.ContainerImpl#getFunctions <em>Functions</em>}</li> | |
* </ul> | |
* | |
* @generated | |
*/ | |
public class ContainerImpl extends MinimalEObjectImpl.Container implements org.eclipse.app4mc.sca2amalthea.ir.scair.Container { | |
/** | |
* The default value of the '{@link #getName() <em>Name</em>}' attribute. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getName() | |
* @generated | |
* @ordered | |
*/ | |
protected static final String NAME_EDEFAULT = null; | |
/** | |
* The cached value of the '{@link #getName() <em>Name</em>}' attribute. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getName() | |
* @generated | |
* @ordered | |
*/ | |
protected String name = NAME_EDEFAULT; | |
/** | |
* The default value of the '{@link #getLocation() <em>Location</em>}' attribute. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getLocation() | |
* @generated | |
* @ordered | |
*/ | |
protected static final String LOCATION_EDEFAULT = null; | |
/** | |
* The cached value of the '{@link #getLocation() <em>Location</em>}' attribute. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getLocation() | |
* @generated | |
* @ordered | |
*/ | |
protected String location = LOCATION_EDEFAULT; | |
/** | |
* The cached value of the '{@link #getFunctions() <em>Functions</em>}' containment reference list. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getFunctions() | |
* @generated | |
* @ordered | |
*/ | |
protected EList<Function> functions; | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
protected ContainerImpl() { | |
super(); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
protected EClass eStaticClass() { | |
return scairPackage.Literals.CONTAINER; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public String getName() { | |
return name; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public void setName(String newName) { | |
String oldName = name; | |
name = newName; | |
if (eNotificationRequired()) | |
eNotify(new ENotificationImpl(this, Notification.SET, scairPackage.CONTAINER__NAME, oldName, name)); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public String getLocation() { | |
return location; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public void setLocation(String newLocation) { | |
String oldLocation = location; | |
location = newLocation; | |
if (eNotificationRequired()) | |
eNotify(new ENotificationImpl(this, Notification.SET, scairPackage.CONTAINER__LOCATION, oldLocation, location)); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public EList<Function> getFunctions() { | |
if (functions == null) { | |
functions = new EObjectContainmentWithInverseEList<Function>(Function.class, this, scairPackage.CONTAINER__FUNCTIONS, scairPackage.FUNCTION__CONTAINER); | |
} | |
return functions; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@SuppressWarnings("unchecked") | |
@Override | |
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { | |
switch (featureID) { | |
case scairPackage.CONTAINER__FUNCTIONS: | |
return ((InternalEList<InternalEObject>)(InternalEList<?>)getFunctions()).basicAdd(otherEnd, msgs); | |
} | |
return super.eInverseAdd(otherEnd, featureID, msgs); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { | |
switch (featureID) { | |
case scairPackage.CONTAINER__FUNCTIONS: | |
return ((InternalEList<?>)getFunctions()).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 scairPackage.CONTAINER__NAME: | |
return getName(); | |
case scairPackage.CONTAINER__LOCATION: | |
return getLocation(); | |
case scairPackage.CONTAINER__FUNCTIONS: | |
return getFunctions(); | |
} | |
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 scairPackage.CONTAINER__NAME: | |
setName((String)newValue); | |
return; | |
case scairPackage.CONTAINER__LOCATION: | |
setLocation((String)newValue); | |
return; | |
case scairPackage.CONTAINER__FUNCTIONS: | |
getFunctions().clear(); | |
getFunctions().addAll((Collection<? extends Function>)newValue); | |
return; | |
} | |
super.eSet(featureID, newValue); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public void eUnset(int featureID) { | |
switch (featureID) { | |
case scairPackage.CONTAINER__NAME: | |
setName(NAME_EDEFAULT); | |
return; | |
case scairPackage.CONTAINER__LOCATION: | |
setLocation(LOCATION_EDEFAULT); | |
return; | |
case scairPackage.CONTAINER__FUNCTIONS: | |
getFunctions().clear(); | |
return; | |
} | |
super.eUnset(featureID); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public boolean eIsSet(int featureID) { | |
switch (featureID) { | |
case scairPackage.CONTAINER__NAME: | |
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); | |
case scairPackage.CONTAINER__LOCATION: | |
return LOCATION_EDEFAULT == null ? location != null : !LOCATION_EDEFAULT.equals(location); | |
case scairPackage.CONTAINER__FUNCTIONS: | |
return functions != null && !functions.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(" (name: "); | |
result.append(name); | |
result.append(", location: "); | |
result.append(location); | |
result.append(')'); | |
return result.toString(); | |
} | |
} //ContainerImpl |