blob: 3ccab01b8dd0d16317222ef59c97507d24f8fdd6 [file] [log] [blame]
/**
*
* Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
*
* 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:
* Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation
*
*/
package org.eclipse.osbp.ecview.core.common.model.core.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.osbp.ecview.core.common.model.binding.impl.YValueBindingEndpointImpl;
import org.eclipse.osbp.ecview.core.common.model.core.CoreModelPackage;
import org.eclipse.osbp.ecview.core.common.model.core.YActivateable;
import org.eclipse.osbp.ecview.core.common.model.core.YActivatedEndpoint;
import org.eclipse.osbp.ecview.core.common.model.core.YElement;
import org.eclipse.osbp.ecview.core.common.model.core.util.BindingIdUtil;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>YActivated Endpoint</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.osbp.ecview.core.common.model.core.impl.YActivatedEndpointImpl#getElement <em>Element</em>}</li>
* </ul>
*
* @generated
*/
public class YActivatedEndpointImpl extends YValueBindingEndpointImpl implements YActivatedEndpoint {
/**
* The cached value of the '{@link #getElement() <em>Element</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getElement()
* @generated
* @ordered
*/
protected YActivateable element;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected YActivatedEndpointImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return CoreModelPackage.Literals.YACTIVATED_ENDPOINT;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public YActivateable getElement() {
if (element != null && element.eIsProxy()) {
InternalEObject oldElement = (InternalEObject)element;
element = (YActivateable)eResolveProxy(oldElement);
if (element != oldElement) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, CoreModelPackage.YACTIVATED_ENDPOINT__ELEMENT, oldElement, element));
}
}
return element;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public YActivateable basicGetElement() {
return element;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setElement(YActivateable newElement) {
YActivateable oldElement = element;
element = newElement;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, CoreModelPackage.YACTIVATED_ENDPOINT__ELEMENT, oldElement, element));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case CoreModelPackage.YACTIVATED_ENDPOINT__ELEMENT:
if (resolve) return getElement();
return basicGetElement();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case CoreModelPackage.YACTIVATED_ENDPOINT__ELEMENT:
setElement((YActivateable)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case CoreModelPackage.YACTIVATED_ENDPOINT__ELEMENT:
setElement((YActivateable)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case CoreModelPackage.YACTIVATED_ENDPOINT__ELEMENT:
return element != null;
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated NOT
*/
public boolean isBindsElement(YElement element) {
return element == getElement();
}
@Override
public String getBindingIdString() {
if (!(getElement() instanceof YElement)) {
throw new IllegalArgumentException(
"not a valid element to create a binding id string");
}
YElement yElement = (YElement) getElement();
return BindingIdUtil.getActivatedId(yElement.getId());
}
} //YActivatedEndpointImpl