| /** |
| * <copyright> |
| * |
| * Copyright (c) 2008 E.D.Willink 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: |
| * E.D.Willink - initial API and implementation |
| * |
| * </copyright> |
| * |
| * $Id: AbstractNodeImpl.java,v 1.1 2008/08/24 18:56:21 ewillink Exp $ |
| */ |
| package org.eclipse.qvt.declarative.editor.impl; |
| |
| 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.EObjectContainmentEList; |
| import org.eclipse.emf.ecore.util.InternalEList; |
| import org.eclipse.qvt.declarative.editor.AbstractNode; |
| import org.eclipse.qvt.declarative.editor.Behavior; |
| import org.eclipse.qvt.declarative.editor.EditorPackage; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Abstract Node</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.qvt.declarative.editor.impl.AbstractNodeImpl#getBehavior <em>Behavior</em>}</li> |
| * <li>{@link org.eclipse.qvt.declarative.editor.impl.AbstractNodeImpl#getBase <em>Base</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public abstract class AbstractNodeImpl extends EObjectImpl implements AbstractNode { |
| /** |
| * The cached value of the '{@link #getBehavior() <em>Behavior</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getBehavior() |
| * @generated |
| * @ordered |
| */ |
| protected EList<Behavior> behavior; |
| |
| /** |
| * The cached value of the '{@link #getBase() <em>Base</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getBase() |
| * @generated |
| * @ordered |
| */ |
| protected AbstractNode base; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected AbstractNodeImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return EditorPackage.Literals.ABSTRACT_NODE; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<Behavior> getBehavior() { |
| if (behavior == null) { |
| behavior = new EObjectContainmentEList<Behavior>(Behavior.class, this, EditorPackage.ABSTRACT_NODE__BEHAVIOR); |
| } |
| return behavior; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public AbstractNode getBase() { |
| if (base != null && base.eIsProxy()) { |
| InternalEObject oldBase = (InternalEObject)base; |
| base = (AbstractNode)eResolveProxy(oldBase); |
| if (base != oldBase) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, EditorPackage.ABSTRACT_NODE__BASE, oldBase, base)); |
| } |
| } |
| return base; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public AbstractNode basicGetBase() { |
| return base; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setBase(AbstractNode newBase) { |
| AbstractNode oldBase = base; |
| base = newBase; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, EditorPackage.ABSTRACT_NODE__BASE, oldBase, base)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case EditorPackage.ABSTRACT_NODE__BEHAVIOR: |
| return ((InternalEList<?>)getBehavior()).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 EditorPackage.ABSTRACT_NODE__BEHAVIOR: |
| return getBehavior(); |
| case EditorPackage.ABSTRACT_NODE__BASE: |
| if (resolve) return getBase(); |
| return basicGetBase(); |
| } |
| 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 EditorPackage.ABSTRACT_NODE__BEHAVIOR: |
| getBehavior().clear(); |
| getBehavior().addAll((Collection<? extends Behavior>)newValue); |
| return; |
| case EditorPackage.ABSTRACT_NODE__BASE: |
| setBase((AbstractNode)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case EditorPackage.ABSTRACT_NODE__BEHAVIOR: |
| getBehavior().clear(); |
| return; |
| case EditorPackage.ABSTRACT_NODE__BASE: |
| setBase((AbstractNode)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case EditorPackage.ABSTRACT_NODE__BEHAVIOR: |
| return behavior != null && !behavior.isEmpty(); |
| case EditorPackage.ABSTRACT_NODE__BASE: |
| return base != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| } //AbstractNodeImpl |