| /******************************************************************************* |
| * Copyright (c) 2013 CEA LIST. |
| * 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: |
| * Cedric Dumoulin - cedric.dumoulin@lifl.fr |
| ******************************************************************************/ |
| /** |
| */ |
| package org.eclipse.papyrus.layers.stackmodel.layers.impl; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| 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.papyrus.layers.stackmodel.layers.LayersPackage; |
| import org.eclipse.papyrus.layers.stackmodel.layers.Property; |
| import org.eclipse.papyrus.layers.stackmodel.layers.PropertyIndex; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Property Index</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.papyrus.layers.stackmodel.layers.impl.PropertyIndexImpl#getProperty <em>Property</em>}</li> |
| * <li>{@link org.eclipse.papyrus.layers.stackmodel.layers.impl.PropertyIndexImpl#getIndex <em>Index</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class PropertyIndexImpl extends MinimalEObjectImpl.Container implements PropertyIndex { |
| /** |
| * The cached value of the '{@link #getProperty() <em>Property</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @see #getProperty() |
| * @generated |
| * @ordered |
| */ |
| protected Property property; |
| |
| /** |
| * The default value of the '{@link #getIndex() <em>Index</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @see #getIndex() |
| * @generated |
| * @ordered |
| */ |
| protected static final int INDEX_EDEFAULT = 0; |
| |
| /** |
| * The cached value of the '{@link #getIndex() <em>Index</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @see #getIndex() |
| * @generated |
| * @ordered |
| */ |
| protected int index = INDEX_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| protected PropertyIndexImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return LayersPackage.Literals.PROPERTY_INDEX; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public Property getProperty() { |
| if (property != null && property.eIsProxy()) { |
| InternalEObject oldProperty = (InternalEObject) property; |
| property = (Property) eResolveProxy(oldProperty); |
| if (property != oldProperty) { |
| if (eNotificationRequired()) { |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, LayersPackage.PROPERTY_INDEX__PROPERTY, oldProperty, property)); |
| } |
| } |
| } |
| return property; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public Property basicGetProperty() { |
| return property; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public void setProperty(Property newProperty) { |
| Property oldProperty = property; |
| property = newProperty; |
| if (eNotificationRequired()) { |
| eNotify(new ENotificationImpl(this, Notification.SET, LayersPackage.PROPERTY_INDEX__PROPERTY, oldProperty, property)); |
| } |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public int getIndex() { |
| return index; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public void setIndex(int newIndex) { |
| int oldIndex = index; |
| index = newIndex; |
| if (eNotificationRequired()) { |
| eNotify(new ENotificationImpl(this, Notification.SET, LayersPackage.PROPERTY_INDEX__INDEX, oldIndex, index)); |
| } |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case LayersPackage.PROPERTY_INDEX__PROPERTY: |
| if (resolve) { |
| return getProperty(); |
| } |
| return basicGetProperty(); |
| case LayersPackage.PROPERTY_INDEX__INDEX: |
| return getIndex(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case LayersPackage.PROPERTY_INDEX__PROPERTY: |
| setProperty((Property) newValue); |
| return; |
| case LayersPackage.PROPERTY_INDEX__INDEX: |
| setIndex((Integer) newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case LayersPackage.PROPERTY_INDEX__PROPERTY: |
| setProperty((Property) null); |
| return; |
| case LayersPackage.PROPERTY_INDEX__INDEX: |
| setIndex(INDEX_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case LayersPackage.PROPERTY_INDEX__PROPERTY: |
| return property != null; |
| case LayersPackage.PROPERTY_INDEX__INDEX: |
| return index != INDEX_EDEFAULT; |
| } |
| 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(" (index: "); |
| result.append(index); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } // PropertyIndexImpl |