blob: 49f600af12bfafb2c550320d63817eb22ada9d4f [file] [log] [blame]
/**
* *******************************************************************************
* Copyright (c) 2015-2021 Robert Bosch GmbH and others.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Generated using Eclipse EMF
*
* *******************************************************************************
*/
package org.eclipse.app4mc.amalthea.model.impl;
import java.util.Collection;
import org.eclipse.app4mc.amalthea.model.AmaltheaPackage;
import org.eclipse.app4mc.amalthea.model.EventChain;
import org.eclipse.app4mc.amalthea.model.EventChainSynchronizationConstraint;
import org.eclipse.app4mc.amalthea.model.SynchronizationType;
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.util.EObjectResolvingEList;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Event Chain Synchronization Constraint</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.app4mc.amalthea.model.impl.EventChainSynchronizationConstraintImpl#getScope <em>Scope</em>}</li>
* <li>{@link org.eclipse.app4mc.amalthea.model.impl.EventChainSynchronizationConstraintImpl#getType <em>Type</em>}</li>
* </ul>
*
* @generated
*/
public class EventChainSynchronizationConstraintImpl extends SynchronizationConstraintImpl implements EventChainSynchronizationConstraint {
/**
* The cached value of the '{@link #getScope() <em>Scope</em>}' reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getScope()
* @generated
* @ordered
*/
protected EList<EventChain> scope;
/**
* The default value of the '{@link #getType() <em>Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getType()
* @generated
* @ordered
*/
protected static final SynchronizationType TYPE_EDEFAULT = SynchronizationType._UNDEFINED_;
/**
* The cached value of the '{@link #getType() <em>Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getType()
* @generated
* @ordered
*/
protected SynchronizationType type = TYPE_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected EventChainSynchronizationConstraintImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return AmaltheaPackage.eINSTANCE.getEventChainSynchronizationConstraint();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EList<EventChain> getScope() {
if (scope == null) {
scope = new EObjectResolvingEList<EventChain>(EventChain.class, this, AmaltheaPackage.EVENT_CHAIN_SYNCHRONIZATION_CONSTRAINT__SCOPE);
}
return scope;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public SynchronizationType getType() {
return type;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setType(SynchronizationType newType) {
SynchronizationType oldType = type;
type = newType == null ? TYPE_EDEFAULT : newType;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AmaltheaPackage.EVENT_CHAIN_SYNCHRONIZATION_CONSTRAINT__TYPE, oldType, type));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case AmaltheaPackage.EVENT_CHAIN_SYNCHRONIZATION_CONSTRAINT__SCOPE:
return getScope();
case AmaltheaPackage.EVENT_CHAIN_SYNCHRONIZATION_CONSTRAINT__TYPE:
return getType();
}
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 AmaltheaPackage.EVENT_CHAIN_SYNCHRONIZATION_CONSTRAINT__SCOPE:
getScope().clear();
getScope().addAll((Collection<? extends EventChain>)newValue);
return;
case AmaltheaPackage.EVENT_CHAIN_SYNCHRONIZATION_CONSTRAINT__TYPE:
setType((SynchronizationType)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case AmaltheaPackage.EVENT_CHAIN_SYNCHRONIZATION_CONSTRAINT__SCOPE:
getScope().clear();
return;
case AmaltheaPackage.EVENT_CHAIN_SYNCHRONIZATION_CONSTRAINT__TYPE:
setType(TYPE_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case AmaltheaPackage.EVENT_CHAIN_SYNCHRONIZATION_CONSTRAINT__SCOPE:
return scope != null && !scope.isEmpty();
case AmaltheaPackage.EVENT_CHAIN_SYNCHRONIZATION_CONSTRAINT__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();
StringBuilder result = new StringBuilder(super.toString());
result.append(" (type: ");
result.append(type);
result.append(')');
return result.toString();
}
} //EventChainSynchronizationConstraintImpl