blob: 75173dec611cd867df20447f6f33c3b51a6d244c [file] [log] [blame]
/**
* Copyright (c) 2016 CEA LIST and others.
*
* 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:
* CEA LIST - Initial API and implementation
*
*/
package org.eclipse.papyrus.interoperability.rpy.geometry.rpygeometry.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.papyrus.interoperability.rpy.geometry.rpygeometry.Position;
import org.eclipse.papyrus.interoperability.rpy.geometry.rpygeometry.RpyGeometryPackage;
import org.eclipse.papyrus.interoperability.rpy.geometry.rpygeometry.RpyPort;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Rpy Port</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.papyrus.interoperability.rpy.geometry.rpygeometry.impl.RpyPortImpl#getPosition <em>Position</em>}</li>
* </ul>
*
* @generated
*/
public class RpyPortImpl extends RpyShapeImpl implements RpyPort {
/**
* The default value of the '{@link #getPosition() <em>Position</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPosition()
* @generated
* @ordered
*/
protected static final Position POSITION_EDEFAULT = Position.NORTH;
/**
* The cached value of the '{@link #getPosition() <em>Position</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPosition()
* @generated
* @ordered
*/
protected Position position = POSITION_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected RpyPortImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return RpyGeometryPackage.Literals.RPY_PORT;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Position getPosition() {
return position;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setPosition(Position newPosition) {
Position oldPosition = position;
position = newPosition == null ? POSITION_EDEFAULT : newPosition;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, RpyGeometryPackage.RPY_PORT__POSITION, oldPosition, position));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case RpyGeometryPackage.RPY_PORT__POSITION:
return getPosition();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case RpyGeometryPackage.RPY_PORT__POSITION:
setPosition((Position)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case RpyGeometryPackage.RPY_PORT__POSITION:
setPosition(POSITION_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case RpyGeometryPackage.RPY_PORT__POSITION:
return position != POSITION_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(" (position: "); //$NON-NLS-1$
result.append(position);
result.append(')');
return result.toString();
}
} //RpyPortImpl