| /** |
| * Copyright (c) 2010, 2012 Obeo. |
| * 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: |
| * Obeo - initial API and implementation |
| */ |
| package org.eclipse.mylyn.docs.intent.bridge.java.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.util.EDataTypeUniqueEList; |
| import org.eclipse.emf.ecore.util.EObjectContainmentEList; |
| import org.eclipse.emf.ecore.util.InternalEList; |
| |
| import org.eclipse.mylyn.docs.intent.bridge.java.Classifier; |
| import org.eclipse.mylyn.docs.intent.bridge.java.ClassifierKind; |
| import org.eclipse.mylyn.docs.intent.bridge.java.Field; |
| import org.eclipse.mylyn.docs.intent.bridge.java.JavaPackage; |
| import org.eclipse.mylyn.docs.intent.bridge.java.Method; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Classifier</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.mylyn.docs.intent.bridge.java.impl.ClassifierImpl#getKind <em>Kind</em>}</li> |
| * <li>{@link org.eclipse.mylyn.docs.intent.bridge.java.impl.ClassifierImpl#getExtends <em>Extends</em>}</li> |
| * <li>{@link org.eclipse.mylyn.docs.intent.bridge.java.impl.ClassifierImpl#getImplements <em>Implements</em>}</li> |
| * <li>{@link org.eclipse.mylyn.docs.intent.bridge.java.impl.ClassifierImpl#getFields <em>Fields</em>}</li> |
| * <li>{@link org.eclipse.mylyn.docs.intent.bridge.java.impl.ClassifierImpl#getMethods <em>Methods</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class ClassifierImpl extends AbstractCapableElementImpl implements Classifier { |
| /** |
| * The default value of the '{@link #getKind() <em>Kind</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getKind() |
| * @generated |
| * @ordered |
| */ |
| protected static final ClassifierKind KIND_EDEFAULT = ClassifierKind.CLASS; |
| |
| /** |
| * The cached value of the '{@link #getKind() <em>Kind</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getKind() |
| * @generated |
| * @ordered |
| */ |
| protected ClassifierKind kind = KIND_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #getExtends() <em>Extends</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getExtends() |
| * @generated |
| * @ordered |
| */ |
| protected static final String EXTENDS_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getExtends() <em>Extends</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getExtends() |
| * @generated |
| * @ordered |
| */ |
| protected String extends_ = EXTENDS_EDEFAULT; |
| |
| /** |
| * The cached value of the '{@link #getImplements() <em>Implements</em>}' attribute list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getImplements() |
| * @generated |
| * @ordered |
| */ |
| protected EList<String> implements_; |
| |
| /** |
| * The cached value of the '{@link #getFields() <em>Fields</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getFields() |
| * @generated |
| * @ordered |
| */ |
| protected EList<Field> fields; |
| |
| /** |
| * The cached value of the '{@link #getMethods() <em>Methods</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getMethods() |
| * @generated |
| * @ordered |
| */ |
| protected EList<Method> methods; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected ClassifierImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return JavaPackage.Literals.CLASSIFIER; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public ClassifierKind getKind() { |
| return kind; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setKind(ClassifierKind newKind) { |
| ClassifierKind oldKind = kind; |
| kind = newKind == null ? KIND_EDEFAULT : newKind; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, JavaPackage.CLASSIFIER__KIND, oldKind, kind)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<Field> getFields() { |
| if (fields == null) { |
| fields = new EObjectContainmentEList<Field>(Field.class, this, JavaPackage.CLASSIFIER__FIELDS); |
| } |
| return fields; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<Method> getMethods() { |
| if (methods == null) { |
| methods = new EObjectContainmentEList<Method>(Method.class, this, JavaPackage.CLASSIFIER__METHODS); |
| } |
| return methods; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getExtends() { |
| return extends_; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setExtends(String newExtends) { |
| String oldExtends = extends_; |
| extends_ = newExtends; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, JavaPackage.CLASSIFIER__EXTENDS, oldExtends, extends_)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<String> getImplements() { |
| if (implements_ == null) { |
| implements_ = new EDataTypeUniqueEList<String>(String.class, this, JavaPackage.CLASSIFIER__IMPLEMENTS); |
| } |
| return implements_; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case JavaPackage.CLASSIFIER__FIELDS: |
| return ((InternalEList<?>)getFields()).basicRemove(otherEnd, msgs); |
| case JavaPackage.CLASSIFIER__METHODS: |
| return ((InternalEList<?>)getMethods()).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 JavaPackage.CLASSIFIER__KIND: |
| return getKind(); |
| case JavaPackage.CLASSIFIER__EXTENDS: |
| return getExtends(); |
| case JavaPackage.CLASSIFIER__IMPLEMENTS: |
| return getImplements(); |
| case JavaPackage.CLASSIFIER__FIELDS: |
| return getFields(); |
| case JavaPackage.CLASSIFIER__METHODS: |
| return getMethods(); |
| } |
| 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 JavaPackage.CLASSIFIER__KIND: |
| setKind((ClassifierKind)newValue); |
| return; |
| case JavaPackage.CLASSIFIER__EXTENDS: |
| setExtends((String)newValue); |
| return; |
| case JavaPackage.CLASSIFIER__IMPLEMENTS: |
| getImplements().clear(); |
| getImplements().addAll((Collection<? extends String>)newValue); |
| return; |
| case JavaPackage.CLASSIFIER__FIELDS: |
| getFields().clear(); |
| getFields().addAll((Collection<? extends Field>)newValue); |
| return; |
| case JavaPackage.CLASSIFIER__METHODS: |
| getMethods().clear(); |
| getMethods().addAll((Collection<? extends Method>)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case JavaPackage.CLASSIFIER__KIND: |
| setKind(KIND_EDEFAULT); |
| return; |
| case JavaPackage.CLASSIFIER__EXTENDS: |
| setExtends(EXTENDS_EDEFAULT); |
| return; |
| case JavaPackage.CLASSIFIER__IMPLEMENTS: |
| getImplements().clear(); |
| return; |
| case JavaPackage.CLASSIFIER__FIELDS: |
| getFields().clear(); |
| return; |
| case JavaPackage.CLASSIFIER__METHODS: |
| getMethods().clear(); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case JavaPackage.CLASSIFIER__KIND: |
| return kind != KIND_EDEFAULT; |
| case JavaPackage.CLASSIFIER__EXTENDS: |
| return EXTENDS_EDEFAULT == null ? extends_ != null : !EXTENDS_EDEFAULT.equals(extends_); |
| case JavaPackage.CLASSIFIER__IMPLEMENTS: |
| return implements_ != null && !implements_.isEmpty(); |
| case JavaPackage.CLASSIFIER__FIELDS: |
| return fields != null && !fields.isEmpty(); |
| case JavaPackage.CLASSIFIER__METHODS: |
| return methods != null && !methods.isEmpty(); |
| } |
| 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(" (kind: "); |
| result.append(kind); |
| result.append(", extends: "); |
| result.append(extends_); |
| result.append(", implements: "); |
| result.append(implements_); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //ClassifierImpl |