blob: f76559ef24ac16f5284d7563a2aedf2b64e13b95 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2015 David Carlson and others.
* 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:
* David Carlson (Clinical Cloud Solutions, LLC) - initial API and implementation
*******************************************************************************/
/**
*/
package org.eclipse.mdht.uml.aml.constraint.impl;
import java.lang.reflect.InvocationTargetException;
import java.util.Map;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.BasicDiagnostic;
import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.emf.common.util.DiagnosticChain;
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.impl.MinimalEObjectImpl;
import org.eclipse.emf.ecore.plugin.EcorePlugin;
import org.eclipse.emf.ecore.util.EObjectValidator;
import org.eclipse.mdht.uml.aml.constraint.Constrains;
import org.eclipse.mdht.uml.aml.constraint.ConstraintPackage;
import org.eclipse.mdht.uml.aml.constraint.util.ConstraintValidator;
import org.eclipse.uml2.uml.Generalization;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Constrains</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.mdht.uml.aml.constraint.impl.ConstrainsImpl#getBase_Generalization <em>Base Generalization</em>}</li>
* </ul>
*
* @generated
*/
public class ConstrainsImpl extends MinimalEObjectImpl.Container implements Constrains {
/**
* The cached value of the '{@link #getBase_Generalization() <em>Base Generalization</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getBase_Generalization()
* @generated
* @ordered
*/
protected Generalization base_Generalization;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ConstrainsImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return ConstraintPackage.Literals.CONSTRAINS;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Generalization getBase_Generalization() {
if (base_Generalization != null && base_Generalization.eIsProxy()) {
InternalEObject oldBase_Generalization = (InternalEObject)base_Generalization;
base_Generalization = (Generalization)eResolveProxy(oldBase_Generalization);
if (base_Generalization != oldBase_Generalization) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, ConstraintPackage.CONSTRAINS__BASE_GENERALIZATION, oldBase_Generalization, base_Generalization));
}
}
return base_Generalization;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Generalization basicGetBase_Generalization() {
return base_Generalization;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setBase_Generalization(Generalization newBase_Generalization) {
Generalization oldBase_Generalization = base_Generalization;
base_Generalization = newBase_Generalization;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ConstraintPackage.CONSTRAINS__BASE_GENERALIZATION, oldBase_Generalization, base_Generalization));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean validateSpecificObjectConstraint(DiagnosticChain diagnostics, Map<Object, Object> context) {
// TODO: implement this method
// -> specify the condition that violates the invariant
// -> verify the details of the diagnostic, including severity and message
// Ensure that you remove @generated or mark it @generated NOT
if (false) {
if (diagnostics != null) {
diagnostics.add
(new BasicDiagnostic
(Diagnostic.ERROR,
ConstraintValidator.DIAGNOSTIC_SOURCE,
ConstraintValidator.CONSTRAINS__SPECIFIC_OBJECT_CONSTRAINT,
EcorePlugin.INSTANCE.getString("_UI_GenericInvariant_diagnostic", new Object[] { "validateSpecificObjectConstraint", EObjectValidator.getObjectLabel(this, context) }),
new Object [] { this }));
}
return false;
}
return true;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean validateConstrainsRMElement(DiagnosticChain diagnostics, Map<Object, Object> context) {
// TODO: implement this method
// -> specify the condition that violates the invariant
// -> verify the details of the diagnostic, including severity and message
// Ensure that you remove @generated or mark it @generated NOT
if (false) {
if (diagnostics != null) {
diagnostics.add
(new BasicDiagnostic
(Diagnostic.ERROR,
ConstraintValidator.DIAGNOSTIC_SOURCE,
ConstraintValidator.CONSTRAINS__CONSTRAINS_RM_ELEMENT,
EcorePlugin.INSTANCE.getString("_UI_GenericInvariant_diagnostic", new Object[] { "validateConstrainsRMElement", EObjectValidator.getObjectLabel(this, context) }),
new Object [] { this }));
}
return false;
}
return true;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case ConstraintPackage.CONSTRAINS__BASE_GENERALIZATION:
if (resolve) return getBase_Generalization();
return basicGetBase_Generalization();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case ConstraintPackage.CONSTRAINS__BASE_GENERALIZATION:
setBase_Generalization((Generalization)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case ConstraintPackage.CONSTRAINS__BASE_GENERALIZATION:
setBase_Generalization((Generalization)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case ConstraintPackage.CONSTRAINS__BASE_GENERALIZATION:
return base_Generalization != null;
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
@SuppressWarnings("unchecked")
public Object eInvoke(int operationID, EList<?> arguments) throws InvocationTargetException {
switch (operationID) {
case ConstraintPackage.CONSTRAINS___VALIDATE_SPECIFIC_OBJECT_CONSTRAINT__DIAGNOSTICCHAIN_MAP:
return validateSpecificObjectConstraint((DiagnosticChain)arguments.get(0), (Map<Object, Object>)arguments.get(1));
case ConstraintPackage.CONSTRAINS___VALIDATE_CONSTRAINS_RM_ELEMENT__DIAGNOSTICCHAIN_MAP:
return validateConstrainsRMElement((DiagnosticChain)arguments.get(0), (Map<Object, Object>)arguments.get(1));
}
return super.eInvoke(operationID, arguments);
}
} //ConstrainsImpl