blob: a76e79af88306bf2eefbefe0da546818109362fc [file] [log] [blame]
/******************************************************************************
* Copyright (c) 2004, 2006 IBM Corporation 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
*
* Contributors:
* IBM Corporation - initial API and implementation
****************************************************************************/
package org.eclipse.gmf.runtime.notation.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EMap;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EStructuralFeature;
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.EcoreEMap;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.gmf.runtime.notation.Guide;
import org.eclipse.gmf.runtime.notation.NotationPackage;
/**
* <!-- begin-user-doc --> An implementation of the model object
* '<em><b>Guide</b></em>'. <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.gmf.runtime.notation.impl.GuideImpl#getPosition
* <em>Position</em>}</li>
* <li>{@link org.eclipse.gmf.runtime.notation.impl.GuideImpl#getNodeMap
* <em>Node Map</em>}</li>
* </ul>
*
* @generated
*/
/*
* @canBeSeenBy org.eclipse.gmf.runtime.notation.*
*/
public class GuideImpl extends MinimalEObjectImpl.Container implements Guide {
/**
* The default value of the '{@link #getPosition() <em>Position</em>}'
* attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @see #getPosition()
* @generated
* @ordered
*/
protected static final int POSITION_EDEFAULT = 0;
/**
* The cached value of the '{@link #getPosition() <em>Position</em>}' attribute.
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @see #getPosition()
* @generated
* @ordered
*/
protected int position = POSITION_EDEFAULT;
/**
* The cached value of the '{@link #getNodeMap() <em>Node Map</em>}' map. <!--
* begin-user-doc --> <!-- end-user-doc -->
*
* @see #getNodeMap()
* @generated
* @ordered
*/
protected EMap nodeMap;
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
protected GuideImpl() {
super();
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
protected EClass eStaticClass() {
return NotationPackage.Literals.GUIDE;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public int getPosition() {
return position;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public void setPosition(int newPosition) {
int oldPosition = position;
position = newPosition;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, NotationPackage.GUIDE__POSITION, oldPosition,
position));
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public EMap getNodeMap() {
if (nodeMap == null) {
nodeMap = new EcoreEMap(NotationPackage.Literals.NODE_ENTRY, NodeEntryImpl.class, this,
NotationPackage.GUIDE__NODE_MAP);
}
return nodeMap;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case NotationPackage.GUIDE__NODE_MAP:
return ((InternalEList) getNodeMap()).basicRemove(otherEnd, msgs);
}
return eDynamicInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case NotationPackage.GUIDE__POSITION:
return new Integer(getPosition());
case NotationPackage.GUIDE__NODE_MAP:
if (coreType)
return getNodeMap();
else
return getNodeMap().map();
}
return eDynamicGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case NotationPackage.GUIDE__POSITION:
setPosition(((Integer) newValue).intValue());
return;
case NotationPackage.GUIDE__NODE_MAP:
((EStructuralFeature.Setting) getNodeMap()).set(newValue);
return;
}
eDynamicSet(featureID, newValue);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public void eUnset(int featureID) {
switch (featureID) {
case NotationPackage.GUIDE__POSITION:
setPosition(POSITION_EDEFAULT);
return;
case NotationPackage.GUIDE__NODE_MAP:
getNodeMap().clear();
return;
}
eDynamicUnset(featureID);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public boolean eIsSet(int featureID) {
switch (featureID) {
case NotationPackage.GUIDE__POSITION:
return position != POSITION_EDEFAULT;
case NotationPackage.GUIDE__NODE_MAP:
return nodeMap != null && !nodeMap.isEmpty();
}
return eDynamicIsSet(featureID);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public String toString() {
if (eIsProxy())
return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (position: "); //$NON-NLS-1$
result.append(position);
result.append(')');
return result.toString();
}
} // GuideImpl