/******************************************************************************* * 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.ide.snapshot.internal.ui.SnapshotMetaData.impl; import gov.redhawk.ide.snapshot.internal.ui.SnapshotMetaData.Simple; import gov.redhawk.ide.snapshot.internal.ui.SnapshotMetaData.SnapshotMetadataPackage; import gov.redhawk.ide.snapshot.internal.ui.SnapshotMetaData.Struct; 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.impl.EObjectImpl; import org.eclipse.emf.ecore.util.BasicFeatureMap; import org.eclipse.emf.ecore.util.FeatureMap; import org.eclipse.emf.ecore.util.InternalEList; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Struct</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link gov.redhawk.ide.snapshot.internal.ui.SnapshotMetaData.impl.StructImpl#getId <em>Id</em>}</li> * <li>{@link gov.redhawk.ide.snapshot.internal.ui.SnapshotMetaData.impl.StructImpl#getMixed <em>Mixed</em>}</li> * <li>{@link gov.redhawk.ide.snapshot.internal.ui.SnapshotMetaData.impl.StructImpl#getSimple <em>Simple</em>}</li> * </ul> * </p> * * @generated */ public class StructImpl extends EObjectImpl implements Struct { /** * The default value of the '{@link #getId() <em>Id</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getId() * @generated * @ordered */ protected static final String ID_EDEFAULT = null; /** * The cached value of the '{@link #getId() <em>Id</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getId() * @generated * @ordered */ protected String id = ID_EDEFAULT; /** * The cached value of the '{@link #getMixed() <em>Mixed</em>}' attribute list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getMixed() * @generated * @ordered */ protected FeatureMap mixed; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected StructImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return SnapshotMetadataPackage.Literals.STRUCT; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getId() { return id; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setId(String newId) { String oldId = id; id = newId; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, SnapshotMetadataPackage.STRUCT__ID, oldId, id)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public FeatureMap getMixed() { if (mixed == null) { mixed = new BasicFeatureMap(this, SnapshotMetadataPackage.STRUCT__MIXED); } return mixed; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<Simple> getSimple() { return getMixed().list(SnapshotMetadataPackage.Literals.STRUCT__SIMPLE); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case SnapshotMetadataPackage.STRUCT__MIXED: return ((InternalEList<?>)getMixed()).basicRemove(otherEnd, msgs); case SnapshotMetadataPackage.STRUCT__SIMPLE: return ((InternalEList<?>)getSimple()).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 SnapshotMetadataPackage.STRUCT__ID: return getId(); case SnapshotMetadataPackage.STRUCT__MIXED: if (coreType) return getMixed(); return ((FeatureMap.Internal)getMixed()).getWrapper(); case SnapshotMetadataPackage.STRUCT__SIMPLE: return getSimple(); } 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 SnapshotMetadataPackage.STRUCT__ID: setId((String)newValue); return; case SnapshotMetadataPackage.STRUCT__MIXED: ((FeatureMap.Internal)getMixed()).set(newValue); return; case SnapshotMetadataPackage.STRUCT__SIMPLE: getSimple().clear(); getSimple().addAll((Collection<? extends Simple>)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case SnapshotMetadataPackage.STRUCT__ID: setId(ID_EDEFAULT); return; case SnapshotMetadataPackage.STRUCT__MIXED: getMixed().clear(); return; case SnapshotMetadataPackage.STRUCT__SIMPLE: getSimple().clear(); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case SnapshotMetadataPackage.STRUCT__ID: return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id); case SnapshotMetadataPackage.STRUCT__MIXED: return mixed != null && !mixed.isEmpty(); case SnapshotMetadataPackage.STRUCT__SIMPLE: return !getSimple().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(" (id: "); result.append(id); result.append(", mixed: "); result.append(mixed); result.append(')'); return result.toString(); } } //StructImpl