blob: 4e842e396422897cdcf88029ae8c99720987c9f0 [file] [log] [blame]
/**
*
* Copyright (c) 2009-2010 Thales Corporate Services S.A.S.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Thales Corporate Services S.A.S - initial API and implementation
*
*/
package org.eclipse.egf.model.fprod.impl;
import java.util.Collection;
import org.eclipse.egf.model.fcore.Activity;
import org.eclipse.egf.model.fcore.Invocation;
import org.eclipse.egf.model.fcore.impl.OrchestrationImpl;
import org.eclipse.egf.model.fprod.FprodPackage;
import org.eclipse.egf.model.fprod.ProductionPlan;
import org.eclipse.egf.model.fprod.ProductionPlanInvocation;
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.resource.Resource;
import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList;
import org.eclipse.emf.ecore.util.InternalEList;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Production Plan</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.egf.model.fprod.impl.ProductionPlanImpl#getInvocations <em>Invocations</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class ProductionPlanImpl extends OrchestrationImpl implements ProductionPlan {
/**
* A set of bit flags representing the values of boolean attributes and whether unsettable features have been set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
protected int flags = 0;
/**
* The cached value of the '{@link #getInvocations() <em>Invocations</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getInvocations()
* @generated
* @ordered
*/
protected EList<ProductionPlanInvocation> invocations;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ProductionPlanImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return FprodPackage.Literals.PRODUCTION_PLAN;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
@Override
public EList<Activity> getActivities() {
EList<Activity> activities = super.getActivities();
for (Invocation invocation : getInvocations()) {
activities.addAll(invocation.getActivities());
}
return activities;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
@Override
public EList<Resource> getResources() {
EList<Resource> resources = super.getResources();
for (Invocation invocation : getInvocations()) {
resources.addAll(invocation.getResources());
}
return resources;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public EList<ProductionPlanInvocation> getInvocations() {
if (invocations == null) {
invocations = new EObjectContainmentWithInverseEList<ProductionPlanInvocation>(ProductionPlanInvocation.class, this, FprodPackage.PRODUCTION_PLAN__INVOCATIONS, FprodPackage.PRODUCTION_PLAN_INVOCATION__PRODUCTION_PLAN);
}
return invocations;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case FprodPackage.PRODUCTION_PLAN__INVOCATIONS:
return ((InternalEList<InternalEObject>) (InternalEList<?>) getInvocations()).basicAdd(otherEnd, msgs);
}
return super.eInverseAdd(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case FprodPackage.PRODUCTION_PLAN__INVOCATIONS:
return ((InternalEList<?>) getInvocations()).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 FprodPackage.PRODUCTION_PLAN__INVOCATIONS:
return getInvocations();
}
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 FprodPackage.PRODUCTION_PLAN__INVOCATIONS:
getInvocations().clear();
getInvocations().addAll((Collection<? extends ProductionPlanInvocation>) newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case FprodPackage.PRODUCTION_PLAN__INVOCATIONS:
getInvocations().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case FprodPackage.PRODUCTION_PLAN__INVOCATIONS:
return invocations != null && !invocations.isEmpty();
}
return super.eIsSet(featureID);
}
} // ProductionPlanImpl