/***************************************************************************** | |
* Copyright (c) 2011 - 2014 University of Padova, Intecs | |
* | |
* | |
* All rights reserved. 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 | |
* http://www.eclipse.org/legal/epl-v20.html | |
* | |
* | |
*****************************************************************************/ | |
package org.polarsys.chess.chessmlprofile.Dependability.StateBased.MaintenanceMonitoring.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.InternalEObject; | |
import org.eclipse.emf.ecore.impl.ENotificationImpl; | |
import org.eclipse.emf.ecore.util.EObjectResolvingEList; | |
import org.eclipse.uml2.uml.Property; | |
import org.eclipse.uml2.uml.Transition; | |
import org.eclipse.uml2.uml.Type; | |
import org.polarsys.chess.chessmlprofile.Dependability.StateBased.MaintenanceMonitoring.MaintenanceMonitoringPackage; | |
import org.polarsys.chess.chessmlprofile.Dependability.StateBased.MaintenanceMonitoring.Repair; | |
/** | |
* <!-- begin-user-doc --> | |
* An implementation of the model object '<em><b>Repair</b></em>'. | |
* <!-- end-user-doc --> | |
* <p> | |
* The following features are implemented: | |
* </p> | |
* <ul> | |
* <li>{@link org.polarsys.chess.chessmlprofile.Dependability.StateBased.MaintenanceMonitoring.impl.RepairImpl#getTargets <em>Targets</em>}</li> | |
* <li>{@link org.polarsys.chess.chessmlprofile.Dependability.StateBased.MaintenanceMonitoring.impl.RepairImpl#getBase_Transition <em>Base Transition</em>}</li> | |
* </ul> | |
* | |
* @generated | |
*/ | |
public class RepairImpl extends MMActivitiesImpl implements Repair { | |
/** | |
* The cached value of the '{@link #getTargets() <em>Targets</em>}' reference list. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getTargets() | |
* @generated | |
* @ordered | |
*/ | |
protected EList<Property> targets; | |
/** | |
* The cached value of the '{@link #getBase_Transition() <em>Base Transition</em>}' reference. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getBase_Transition() | |
* @generated | |
* @ordered | |
*/ | |
protected Transition base_Transition; | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
protected RepairImpl() { | |
super(); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
protected EClass eStaticClass() { | |
return MaintenanceMonitoringPackage.Literals.REPAIR; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public EList<Property> getTargets() { | |
if (targets == null) { | |
targets = new EObjectResolvingEList<Property>(Property.class, this, MaintenanceMonitoringPackage.REPAIR__TARGETS); | |
} | |
return targets; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public Property getTargets(String name, Type type) { | |
return getTargets(name, type, false, null); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public Property getTargets(String name, Type type, boolean ignoreCase, EClass eClass) { | |
targetsLoop: for (Property targets : getTargets()) { | |
if (eClass != null && !eClass.isInstance(targets)) | |
continue targetsLoop; | |
if (name != null && !(ignoreCase ? name.equalsIgnoreCase(targets.getName()) : name.equals(targets.getName()))) | |
continue targetsLoop; | |
if (type != null && !type.equals(targets.getType())) | |
continue targetsLoop; | |
return targets; | |
} | |
return null; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public Transition getBase_Transition() { | |
if (base_Transition != null && base_Transition.eIsProxy()) { | |
InternalEObject oldBase_Transition = (InternalEObject)base_Transition; | |
base_Transition = (Transition)eResolveProxy(oldBase_Transition); | |
if (base_Transition != oldBase_Transition) { | |
if (eNotificationRequired()) | |
eNotify(new ENotificationImpl(this, Notification.RESOLVE, MaintenanceMonitoringPackage.REPAIR__BASE_TRANSITION, oldBase_Transition, base_Transition)); | |
} | |
} | |
return base_Transition; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public Transition basicGetBase_Transition() { | |
return base_Transition; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public void setBase_Transition(Transition newBase_Transition) { | |
Transition oldBase_Transition = base_Transition; | |
base_Transition = newBase_Transition; | |
if (eNotificationRequired()) | |
eNotify(new ENotificationImpl(this, Notification.SET, MaintenanceMonitoringPackage.REPAIR__BASE_TRANSITION, oldBase_Transition, base_Transition)); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public Object eGet(int featureID, boolean resolve, boolean coreType) { | |
switch (featureID) { | |
case MaintenanceMonitoringPackage.REPAIR__TARGETS: | |
return getTargets(); | |
case MaintenanceMonitoringPackage.REPAIR__BASE_TRANSITION: | |
if (resolve) return getBase_Transition(); | |
return basicGetBase_Transition(); | |
} | |
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 MaintenanceMonitoringPackage.REPAIR__TARGETS: | |
getTargets().clear(); | |
getTargets().addAll((Collection<? extends Property>)newValue); | |
return; | |
case MaintenanceMonitoringPackage.REPAIR__BASE_TRANSITION: | |
setBase_Transition((Transition)newValue); | |
return; | |
} | |
super.eSet(featureID, newValue); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public void eUnset(int featureID) { | |
switch (featureID) { | |
case MaintenanceMonitoringPackage.REPAIR__TARGETS: | |
getTargets().clear(); | |
return; | |
case MaintenanceMonitoringPackage.REPAIR__BASE_TRANSITION: | |
setBase_Transition((Transition)null); | |
return; | |
} | |
super.eUnset(featureID); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public boolean eIsSet(int featureID) { | |
switch (featureID) { | |
case MaintenanceMonitoringPackage.REPAIR__TARGETS: | |
return targets != null && !targets.isEmpty(); | |
case MaintenanceMonitoringPackage.REPAIR__BASE_TRANSITION: | |
return base_Transition != null; | |
} | |
return super.eIsSet(featureID); | |
} | |
} //RepairImpl |