/***************************************************************************** * Copyright (c) 2011 CEA LIST. * * * 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.uml.alf.alf.impl; import java.util.Collection; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; import org.eclipse.emf.ecore.util.EDataTypeEList; import org.eclipse.papyrus.uml.alf.alf.AlfPackage; import org.eclipse.papyrus.uml.alf.alf.Annotation; import org.eclipse.papyrus.uml.alf.alf.AnnotationKind; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Annotation</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.eclipse.papyrus.uml.alf.alf.impl.AnnotationImpl#getKind <em>Kind</em>}</li> * <li>{@link org.eclipse.papyrus.uml.alf.alf.impl.AnnotationImpl#getArgs <em>Args</em>}</li> * </ul> * </p> * * @generated */ public class AnnotationImpl extends MinimalEObjectImpl.Container implements Annotation { /** * The default value of the '{@link #getKind() <em>Kind</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getKind() * @generated * @ordered */ protected static final AnnotationKind KIND_EDEFAULT = AnnotationKind.ISOLATED; /** * The cached value of the '{@link #getKind() <em>Kind</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getKind() * @generated * @ordered */ protected AnnotationKind kind = KIND_EDEFAULT; /** * The cached value of the '{@link #getArgs() <em>Args</em>}' attribute list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getArgs() * @generated * @ordered */ protected EList<String> args; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected AnnotationImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return AlfPackage.Literals.ANNOTATION; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public AnnotationKind getKind() { return kind; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setKind(AnnotationKind newKind) { AnnotationKind oldKind = kind; kind = newKind == null ? KIND_EDEFAULT : newKind; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, AlfPackage.ANNOTATION__KIND, oldKind, kind)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<String> getArgs() { if (args == null) { args = new EDataTypeEList<String>(String.class, this, AlfPackage.ANNOTATION__ARGS); } return args; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case AlfPackage.ANNOTATION__KIND: return getKind(); case AlfPackage.ANNOTATION__ARGS: return getArgs(); } 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 AlfPackage.ANNOTATION__KIND: setKind((AnnotationKind)newValue); return; case AlfPackage.ANNOTATION__ARGS: getArgs().clear(); getArgs().addAll((Collection<? extends String>)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case AlfPackage.ANNOTATION__KIND: setKind(KIND_EDEFAULT); return; case AlfPackage.ANNOTATION__ARGS: getArgs().clear(); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case AlfPackage.ANNOTATION__KIND: return kind != KIND_EDEFAULT; case AlfPackage.ANNOTATION__ARGS: return args != null && !args.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(", args: "); result.append(args); result.append(')'); return result.toString(); } } //AnnotationImpl