| /******************************************************************************* |
| * <copyright> |
| * |
| * Copyright (c) 2013, 2013 SAP AG. |
| * 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: |
| * SAP AG - initial API, implementation and documentation |
| * |
| * </copyright> |
| * |
| *******************************************************************************/ |
| package org.eclipse.fmc.mm.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.fmc.mm.Comment; |
| import org.eclipse.fmc.mm.CommentType; |
| import org.eclipse.fmc.mm.FMCElement; |
| import org.eclipse.fmc.mm.FmcPackage; |
| import org.eclipse.fmc.mm.IFMCElementVisitor; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Comment</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.fmc.mm.impl.CommentImpl#getContent <em>Content</em>}</li> |
| * <li>{@link org.eclipse.fmc.mm.impl.CommentImpl#getCommentAssignment <em>Comment Assignment</em>}</li> |
| * <li>{@link org.eclipse.fmc.mm.impl.CommentImpl#getType <em>Type</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class CommentImpl extends FMCElementImpl implements Comment { |
| /** |
| * The default value of the '{@link #getContent() <em>Content</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getContent() |
| * @generated |
| * @ordered |
| */ |
| protected static final String CONTENT_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getContent() <em>Content</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getContent() |
| * @generated |
| * @ordered |
| */ |
| protected String content = CONTENT_EDEFAULT; |
| |
| /** |
| * The cached value of the '{@link #getCommentAssignment() <em>Comment Assignment</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getCommentAssignment() |
| * @generated |
| * @ordered |
| */ |
| protected FMCElement commentAssignment; |
| |
| /** |
| * The default value of the '{@link #getType() <em>Type</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getType() |
| * @generated |
| * @ordered |
| */ |
| protected static final CommentType TYPE_EDEFAULT = CommentType.TEXT; |
| |
| /** |
| * The cached value of the '{@link #getType() <em>Type</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getType() |
| * @generated |
| * @ordered |
| */ |
| protected CommentType type = TYPE_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected CommentImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return FmcPackage.Literals.COMMENT; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getContent() { |
| return content; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setContent(String newContent) { |
| String oldContent = content; |
| content = newContent; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FmcPackage.COMMENT__CONTENT, oldContent, content)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public FMCElement getCommentAssignment() { |
| if (commentAssignment != null && commentAssignment.eIsProxy()) { |
| InternalEObject oldCommentAssignment = (InternalEObject)commentAssignment; |
| commentAssignment = (FMCElement)eResolveProxy(oldCommentAssignment); |
| if (commentAssignment != oldCommentAssignment) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, FmcPackage.COMMENT__COMMENT_ASSIGNMENT, oldCommentAssignment, commentAssignment)); |
| } |
| } |
| return commentAssignment; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public FMCElement basicGetCommentAssignment() { |
| return commentAssignment; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setCommentAssignment(FMCElement newCommentAssignment) { |
| FMCElement oldCommentAssignment = commentAssignment; |
| commentAssignment = newCommentAssignment; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FmcPackage.COMMENT__COMMENT_ASSIGNMENT, oldCommentAssignment, commentAssignment)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public CommentType getType() { |
| return type; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setType(CommentType newType) { |
| CommentType oldType = type; |
| type = newType == null ? TYPE_EDEFAULT : newType; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FmcPackage.COMMENT__TYPE, oldType, type)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case FmcPackage.COMMENT__CONTENT: |
| return getContent(); |
| case FmcPackage.COMMENT__COMMENT_ASSIGNMENT: |
| if (resolve) return getCommentAssignment(); |
| return basicGetCommentAssignment(); |
| case FmcPackage.COMMENT__TYPE: |
| return getType(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case FmcPackage.COMMENT__CONTENT: |
| setContent((String)newValue); |
| return; |
| case FmcPackage.COMMENT__COMMENT_ASSIGNMENT: |
| setCommentAssignment((FMCElement)newValue); |
| return; |
| case FmcPackage.COMMENT__TYPE: |
| setType((CommentType)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case FmcPackage.COMMENT__CONTENT: |
| setContent(CONTENT_EDEFAULT); |
| return; |
| case FmcPackage.COMMENT__COMMENT_ASSIGNMENT: |
| setCommentAssignment((FMCElement)null); |
| return; |
| case FmcPackage.COMMENT__TYPE: |
| setType(TYPE_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case FmcPackage.COMMENT__CONTENT: |
| return CONTENT_EDEFAULT == null ? content != null : !CONTENT_EDEFAULT.equals(content); |
| case FmcPackage.COMMENT__COMMENT_ASSIGNMENT: |
| return commentAssignment != null; |
| case FmcPackage.COMMENT__TYPE: |
| return type != TYPE_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(" (content: "); |
| result.append(content); |
| result.append(", type: "); |
| result.append(type); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated NOT |
| */ |
| @Override |
| public Object accept(IFMCElementVisitor visitor, Object object) { |
| return visitor.visitComment(this, object); |
| } |
| |
| } //CommentImpl |