/** * This file is protected by Copyright. * Please refer to the COPYRIGHT file distributed with this source distribution. * * This file is part of REDHAWK IDE. * * 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. * */ // BEGIN GENERATED CODE package gov.redhawk.eclipsecorba.idl.types.impl; import gov.redhawk.eclipsecorba.idl.IdlType; import gov.redhawk.eclipsecorba.idl.impl.FileRegionImpl; import gov.redhawk.eclipsecorba.idl.types.Case; import gov.redhawk.eclipsecorba.idl.types.Switch; import gov.redhawk.eclipsecorba.idl.types.TypesPackage; 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; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Switch</b></em>'. * @since 6.0 * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link gov.redhawk.eclipsecorba.idl.types.impl.SwitchImpl#getType <em>Type</em>}</li> * <li>{@link gov.redhawk.eclipsecorba.idl.types.impl.SwitchImpl#getCases <em>Cases</em>}</li> * </ul> * </p> * * @generated */ public class SwitchImpl extends FileRegionImpl implements Switch { /** * The cached value of the '{@link #getType() <em>Type</em>}' reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getType() * @generated * @ordered */ protected IdlType type; /** * The cached value of the '{@link #getCases() <em>Cases</em>}' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getCases() * @generated * @ordered */ protected EList<Case> cases; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected SwitchImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return TypesPackage.Literals.SWITCH; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public IdlType getType() { if (type != null && type.eIsProxy()) { InternalEObject oldType = (InternalEObject)type; type = (IdlType)eResolveProxy(oldType); if (type != oldType) { if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, TypesPackage.SWITCH__TYPE, oldType, type)); } } return type; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public IdlType basicGetType() { return type; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setType(IdlType newType) { IdlType oldType = type; type = newType; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, TypesPackage.SWITCH__TYPE, oldType, type)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<Case> getCases() { if (cases == null) { cases = new EObjectContainmentEList<Case>(Case.class, this, TypesPackage.SWITCH__CASES); } return cases; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case TypesPackage.SWITCH__CASES: return ((InternalEList<?>)getCases()).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 TypesPackage.SWITCH__TYPE: if (resolve) return getType(); return basicGetType(); case TypesPackage.SWITCH__CASES: return getCases(); } 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 TypesPackage.SWITCH__TYPE: setType((IdlType)newValue); return; case TypesPackage.SWITCH__CASES: getCases().clear(); getCases().addAll((Collection<? extends Case>)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case TypesPackage.SWITCH__TYPE: setType((IdlType)null); return; case TypesPackage.SWITCH__CASES: getCases().clear(); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case TypesPackage.SWITCH__TYPE: return type != null; case TypesPackage.SWITCH__CASES: return cases != null && !cases.isEmpty(); } return super.eIsSet(featureID); } } //SwitchImpl