| /******************************************************************************* |
| * Copyright (c) 2015 TU Wien. |
| * 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: |
| * Alexander Bergmayr (TU Wien) - initial API and implementation |
| * |
| * Initially developed in the context of ARTIST EU project www.artist-project.eu |
| *******************************************************************************/ |
| /** |
| */ |
| package org.eclipse.upr.platform.trace.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.EObject; |
| |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| import org.eclipse.emf.ecore.impl.EObjectImpl; |
| |
| import org.eclipse.emf.ecore.util.EObjectResolvingEList; |
| |
| import org.eclipse.upr.platform.trace.TraceLink; |
| import org.eclipse.upr.platform.trace.TracePackage; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Link</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.upr.platform.trace.impl.TraceLinkImpl#getSourceElements <em>Source Elements</em>}</li> |
| * <li>{@link org.eclipse.upr.platform.trace.impl.TraceLinkImpl#getTargetElements <em>Target Elements</em>}</li> |
| * <li>{@link org.eclipse.upr.platform.trace.impl.TraceLinkImpl#getRuleName <em>Rule Name</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class TraceLinkImpl extends EObjectImpl implements TraceLink { |
| /** |
| * The cached value of the '{@link #getSourceElements() <em>Source Elements</em>}' reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getSourceElements() |
| * @generated |
| * @ordered |
| */ |
| protected EList<EObject> sourceElements; |
| |
| /** |
| * The cached value of the '{@link #getTargetElements() <em>Target Elements</em>}' reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getTargetElements() |
| * @generated |
| * @ordered |
| */ |
| protected EList<EObject> targetElements; |
| |
| /** |
| * The default value of the '{@link #getRuleName() <em>Rule Name</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getRuleName() |
| * @generated |
| * @ordered |
| */ |
| protected static final String RULE_NAME_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getRuleName() <em>Rule Name</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getRuleName() |
| * @generated |
| * @ordered |
| */ |
| protected String ruleName = RULE_NAME_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected TraceLinkImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return TracePackage.Literals.TRACE_LINK; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<EObject> getSourceElements() { |
| if (sourceElements == null) { |
| sourceElements = new EObjectResolvingEList<EObject>(EObject.class, this, TracePackage.TRACE_LINK__SOURCE_ELEMENTS); |
| } |
| return sourceElements; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<EObject> getTargetElements() { |
| if (targetElements == null) { |
| targetElements = new EObjectResolvingEList<EObject>(EObject.class, this, TracePackage.TRACE_LINK__TARGET_ELEMENTS); |
| } |
| return targetElements; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getRuleName() { |
| return ruleName; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setRuleName(String newRuleName) { |
| String oldRuleName = ruleName; |
| ruleName = newRuleName; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, TracePackage.TRACE_LINK__RULE_NAME, oldRuleName, ruleName)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case TracePackage.TRACE_LINK__SOURCE_ELEMENTS: |
| return getSourceElements(); |
| case TracePackage.TRACE_LINK__TARGET_ELEMENTS: |
| return getTargetElements(); |
| case TracePackage.TRACE_LINK__RULE_NAME: |
| return getRuleName(); |
| } |
| 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 TracePackage.TRACE_LINK__SOURCE_ELEMENTS: |
| getSourceElements().clear(); |
| getSourceElements().addAll((Collection<? extends EObject>)newValue); |
| return; |
| case TracePackage.TRACE_LINK__TARGET_ELEMENTS: |
| getTargetElements().clear(); |
| getTargetElements().addAll((Collection<? extends EObject>)newValue); |
| return; |
| case TracePackage.TRACE_LINK__RULE_NAME: |
| setRuleName((String)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case TracePackage.TRACE_LINK__SOURCE_ELEMENTS: |
| getSourceElements().clear(); |
| return; |
| case TracePackage.TRACE_LINK__TARGET_ELEMENTS: |
| getTargetElements().clear(); |
| return; |
| case TracePackage.TRACE_LINK__RULE_NAME: |
| setRuleName(RULE_NAME_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case TracePackage.TRACE_LINK__SOURCE_ELEMENTS: |
| return sourceElements != null && !sourceElements.isEmpty(); |
| case TracePackage.TRACE_LINK__TARGET_ELEMENTS: |
| return targetElements != null && !targetElements.isEmpty(); |
| case TracePackage.TRACE_LINK__RULE_NAME: |
| return RULE_NAME_EDEFAULT == null ? ruleName != null : !RULE_NAME_EDEFAULT.equals(ruleName); |
| } |
| 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(" (ruleName: "); |
| result.append(ruleName); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //TraceLinkImpl |