mirror of
http://172.16.200.102/MOISE/Pattern-Instanciation-On-System-Engineering-Model.git
synced 2025-12-18 14:13:57 +01:00
Added mapping metamodel and generated code.
This commit is contained in:
@@ -0,0 +1,174 @@
|
||||
/**
|
||||
*/
|
||||
package com.irtsaintexupery.pseim.mapping.util;
|
||||
|
||||
import com.irtsaintexupery.pseim.mapping.*;
|
||||
|
||||
import org.eclipse.emf.common.notify.Adapter;
|
||||
import org.eclipse.emf.common.notify.Notifier;
|
||||
|
||||
import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
|
||||
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* The <b>Adapter Factory</b> for the model.
|
||||
* It provides an adapter <code>createXXX</code> method for each class of the model.
|
||||
* <!-- end-user-doc -->
|
||||
* @see com.irtsaintexupery.pseim.mapping.MappingPackage
|
||||
* @generated
|
||||
*/
|
||||
public class MappingAdapterFactory extends AdapterFactoryImpl {
|
||||
/**
|
||||
* The cached model package.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
protected static MappingPackage modelPackage;
|
||||
|
||||
/**
|
||||
* Creates an instance of the adapter factory.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public MappingAdapterFactory() {
|
||||
if (modelPackage == null) {
|
||||
modelPackage = MappingPackage.eINSTANCE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this factory is applicable for the type of the object.
|
||||
* <!-- begin-user-doc -->
|
||||
* This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model.
|
||||
* <!-- end-user-doc -->
|
||||
* @return whether this factory is applicable for the type of the object.
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
public boolean isFactoryForType(Object object) {
|
||||
if (object == modelPackage) {
|
||||
return true;
|
||||
}
|
||||
if (object instanceof EObject) {
|
||||
return ((EObject)object).eClass().getEPackage() == modelPackage;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* The switch that delegates to the <code>createXXX</code> methods.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
protected MappingSwitch<Adapter> modelSwitch =
|
||||
new MappingSwitch<Adapter>() {
|
||||
@Override
|
||||
public Adapter casePatternApplication(PatternApplication object) {
|
||||
return createPatternApplicationAdapter();
|
||||
}
|
||||
@Override
|
||||
public Adapter caseCardinalityValue(CardinalityValue object) {
|
||||
return createCardinalityValueAdapter();
|
||||
}
|
||||
@Override
|
||||
public Adapter casePortMapping(PortMapping object) {
|
||||
return createPortMappingAdapter();
|
||||
}
|
||||
@Override
|
||||
public Adapter caseGraphElementMapping(GraphElementMapping object) {
|
||||
return createGraphElementMappingAdapter();
|
||||
}
|
||||
@Override
|
||||
public Adapter defaultCase(EObject object) {
|
||||
return createEObjectAdapter();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates an adapter for the <code>target</code>.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @param target the object to adapt.
|
||||
* @return the adapter for the <code>target</code>.
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
public Adapter createAdapter(Notifier target) {
|
||||
return modelSwitch.doSwitch((EObject)target);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new adapter for an object of class '{@link com.irtsaintexupery.pseim.mapping.PatternApplication <em>Pattern Application</em>}'.
|
||||
* <!-- begin-user-doc -->
|
||||
* This default implementation returns null so that we can easily ignore cases;
|
||||
* it's useful to ignore a case when inheritance will catch all the cases anyway.
|
||||
* <!-- end-user-doc -->
|
||||
* @return the new adapter.
|
||||
* @see com.irtsaintexupery.pseim.mapping.PatternApplication
|
||||
* @generated
|
||||
*/
|
||||
public Adapter createPatternApplicationAdapter() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new adapter for an object of class '{@link com.irtsaintexupery.pseim.mapping.CardinalityValue <em>Cardinality Value</em>}'.
|
||||
* <!-- begin-user-doc -->
|
||||
* This default implementation returns null so that we can easily ignore cases;
|
||||
* it's useful to ignore a case when inheritance will catch all the cases anyway.
|
||||
* <!-- end-user-doc -->
|
||||
* @return the new adapter.
|
||||
* @see com.irtsaintexupery.pseim.mapping.CardinalityValue
|
||||
* @generated
|
||||
*/
|
||||
public Adapter createCardinalityValueAdapter() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new adapter for an object of class '{@link com.irtsaintexupery.pseim.mapping.PortMapping <em>Port Mapping</em>}'.
|
||||
* <!-- begin-user-doc -->
|
||||
* This default implementation returns null so that we can easily ignore cases;
|
||||
* it's useful to ignore a case when inheritance will catch all the cases anyway.
|
||||
* <!-- end-user-doc -->
|
||||
* @return the new adapter.
|
||||
* @see com.irtsaintexupery.pseim.mapping.PortMapping
|
||||
* @generated
|
||||
*/
|
||||
public Adapter createPortMappingAdapter() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new adapter for an object of class '{@link com.irtsaintexupery.pseim.mapping.GraphElementMapping <em>Graph Element Mapping</em>}'.
|
||||
* <!-- begin-user-doc -->
|
||||
* This default implementation returns null so that we can easily ignore cases;
|
||||
* it's useful to ignore a case when inheritance will catch all the cases anyway.
|
||||
* <!-- end-user-doc -->
|
||||
* @return the new adapter.
|
||||
* @see com.irtsaintexupery.pseim.mapping.GraphElementMapping
|
||||
* @generated
|
||||
*/
|
||||
public Adapter createGraphElementMappingAdapter() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new adapter for the default case.
|
||||
* <!-- begin-user-doc -->
|
||||
* This default implementation returns null.
|
||||
* <!-- end-user-doc -->
|
||||
* @return the new adapter.
|
||||
* @generated
|
||||
*/
|
||||
public Adapter createEObjectAdapter() {
|
||||
return null;
|
||||
}
|
||||
|
||||
} //MappingAdapterFactory
|
||||
@@ -0,0 +1,173 @@
|
||||
/**
|
||||
*/
|
||||
package com.irtsaintexupery.pseim.mapping.util;
|
||||
|
||||
import com.irtsaintexupery.pseim.mapping.*;
|
||||
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.emf.ecore.EPackage;
|
||||
|
||||
import org.eclipse.emf.ecore.util.Switch;
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* The <b>Switch</b> for the model's inheritance hierarchy.
|
||||
* It supports the call {@link #doSwitch(EObject) doSwitch(object)}
|
||||
* to invoke the <code>caseXXX</code> method for each class of the model,
|
||||
* starting with the actual class of the object
|
||||
* and proceeding up the inheritance hierarchy
|
||||
* until a non-null result is returned,
|
||||
* which is the result of the switch.
|
||||
* <!-- end-user-doc -->
|
||||
* @see com.irtsaintexupery.pseim.mapping.MappingPackage
|
||||
* @generated
|
||||
*/
|
||||
public class MappingSwitch<T> extends Switch<T> {
|
||||
/**
|
||||
* The cached model package
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
protected static MappingPackage modelPackage;
|
||||
|
||||
/**
|
||||
* Creates an instance of the switch.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public MappingSwitch() {
|
||||
if (modelPackage == null) {
|
||||
modelPackage = MappingPackage.eINSTANCE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether this is a switch for the given package.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @param ePackage the package in question.
|
||||
* @return whether this is a switch for the given package.
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
protected boolean isSwitchFor(EPackage ePackage) {
|
||||
return ePackage == modelPackage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @return the first non-null result returned by a <code>caseXXX</code> call.
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
protected T doSwitch(int classifierID, EObject theEObject) {
|
||||
switch (classifierID) {
|
||||
case MappingPackage.PATTERN_APPLICATION: {
|
||||
PatternApplication patternApplication = (PatternApplication)theEObject;
|
||||
T result = casePatternApplication(patternApplication);
|
||||
if (result == null) result = defaultCase(theEObject);
|
||||
return result;
|
||||
}
|
||||
case MappingPackage.CARDINALITY_VALUE: {
|
||||
CardinalityValue cardinalityValue = (CardinalityValue)theEObject;
|
||||
T result = caseCardinalityValue(cardinalityValue);
|
||||
if (result == null) result = defaultCase(theEObject);
|
||||
return result;
|
||||
}
|
||||
case MappingPackage.PORT_MAPPING: {
|
||||
PortMapping portMapping = (PortMapping)theEObject;
|
||||
T result = casePortMapping(portMapping);
|
||||
if (result == null) result = defaultCase(theEObject);
|
||||
return result;
|
||||
}
|
||||
case MappingPackage.GRAPH_ELEMENT_MAPPING: {
|
||||
GraphElementMapping graphElementMapping = (GraphElementMapping)theEObject;
|
||||
T result = caseGraphElementMapping(graphElementMapping);
|
||||
if (result == null) result = defaultCase(theEObject);
|
||||
return result;
|
||||
}
|
||||
default: return defaultCase(theEObject);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the result of interpreting the object as an instance of '<em>Pattern Application</em>'.
|
||||
* <!-- begin-user-doc -->
|
||||
* This implementation returns null;
|
||||
* returning a non-null result will terminate the switch.
|
||||
* <!-- end-user-doc -->
|
||||
* @param object the target of the switch.
|
||||
* @return the result of interpreting the object as an instance of '<em>Pattern Application</em>'.
|
||||
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
|
||||
* @generated
|
||||
*/
|
||||
public T casePatternApplication(PatternApplication object) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the result of interpreting the object as an instance of '<em>Cardinality Value</em>'.
|
||||
* <!-- begin-user-doc -->
|
||||
* This implementation returns null;
|
||||
* returning a non-null result will terminate the switch.
|
||||
* <!-- end-user-doc -->
|
||||
* @param object the target of the switch.
|
||||
* @return the result of interpreting the object as an instance of '<em>Cardinality Value</em>'.
|
||||
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
|
||||
* @generated
|
||||
*/
|
||||
public T caseCardinalityValue(CardinalityValue object) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the result of interpreting the object as an instance of '<em>Port Mapping</em>'.
|
||||
* <!-- begin-user-doc -->
|
||||
* This implementation returns null;
|
||||
* returning a non-null result will terminate the switch.
|
||||
* <!-- end-user-doc -->
|
||||
* @param object the target of the switch.
|
||||
* @return the result of interpreting the object as an instance of '<em>Port Mapping</em>'.
|
||||
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
|
||||
* @generated
|
||||
*/
|
||||
public T casePortMapping(PortMapping object) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the result of interpreting the object as an instance of '<em>Graph Element Mapping</em>'.
|
||||
* <!-- begin-user-doc -->
|
||||
* This implementation returns null;
|
||||
* returning a non-null result will terminate the switch.
|
||||
* <!-- end-user-doc -->
|
||||
* @param object the target of the switch.
|
||||
* @return the result of interpreting the object as an instance of '<em>Graph Element Mapping</em>'.
|
||||
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
|
||||
* @generated
|
||||
*/
|
||||
public T caseGraphElementMapping(GraphElementMapping object) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
|
||||
* <!-- begin-user-doc -->
|
||||
* This implementation returns null;
|
||||
* returning a non-null result will terminate the switch, but this is the last case anyway.
|
||||
* <!-- end-user-doc -->
|
||||
* @param object the target of the switch.
|
||||
* @return the result of interpreting the object as an instance of '<em>EObject</em>'.
|
||||
* @see #doSwitch(org.eclipse.emf.ecore.EObject)
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
public T defaultCase(EObject object) {
|
||||
return null;
|
||||
}
|
||||
|
||||
} //MappingSwitch
|
||||
@@ -0,0 +1,240 @@
|
||||
/**
|
||||
*/
|
||||
package com.irtsaintexupery.pseim.mapping.util;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
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.common.util.ResourceLocator;
|
||||
import org.eclipse.emf.common.util.TreeIterator;
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.emf.ecore.EPackage;
|
||||
import org.eclipse.emf.ecore.util.EObjectValidator;
|
||||
|
||||
import com.irtsaintexupery.pseim.mapping.CardinalityValue;
|
||||
import com.irtsaintexupery.pseim.mapping.GraphElementMapping;
|
||||
import com.irtsaintexupery.pseim.mapping.MappingPackage;
|
||||
import com.irtsaintexupery.pseim.mapping.PatternApplication;
|
||||
import com.irtsaintexupery.pseim.mapping.PortMapping;
|
||||
import com.irtsaintexupery.pseim.pseim.Pattern;
|
||||
import com.irtsaintexupery.pseim.seim.*;
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* The <b>Validator</b> for the model.
|
||||
* <!-- end-user-doc -->
|
||||
* @see com.irtsaintexupery.pseim.mapping.MappingPackage
|
||||
* @generated
|
||||
*/
|
||||
public class MappingValidator extends EObjectValidator {
|
||||
/**
|
||||
* The cached model package
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public static final MappingValidator INSTANCE = new MappingValidator();
|
||||
|
||||
/**
|
||||
* A constant for the {@link org.eclipse.emf.common.util.Diagnostic#getSource() source} of diagnostic {@link org.eclipse.emf.common.util.Diagnostic#getCode() codes} from this package.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @see org.eclipse.emf.common.util.Diagnostic#getSource()
|
||||
* @see org.eclipse.emf.common.util.Diagnostic#getCode()
|
||||
* @generated
|
||||
*/
|
||||
public static final String DIAGNOSTIC_SOURCE = "com.irtsaintexupery.pseim.mapping";
|
||||
|
||||
/**
|
||||
* A constant with a fixed name that can be used as the base value for additional hand written constants.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
private static final int GENERATED_DIAGNOSTIC_CODE_COUNT = 0;
|
||||
|
||||
/**
|
||||
* A constant with a fixed name that can be used as the base value for additional hand written constants in a derived class.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
protected static final int DIAGNOSTIC_CODE_COUNT = GENERATED_DIAGNOSTIC_CODE_COUNT;
|
||||
|
||||
/**
|
||||
* Creates an instance of the switch.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public MappingValidator() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the package of this validator switch.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
protected EPackage getEPackage() {
|
||||
return MappingPackage.eINSTANCE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls <code>validateXXX</code> for the corresponding classifier of the model.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
protected boolean validate(int classifierID, Object value, DiagnosticChain diagnostics, Map<Object, Object> context) {
|
||||
switch (classifierID) {
|
||||
case MappingPackage.PATTERN_APPLICATION:
|
||||
return validatePatternApplication((PatternApplication)value, diagnostics, context);
|
||||
case MappingPackage.CARDINALITY_VALUE:
|
||||
return validateCardinalityValue((CardinalityValue)value, diagnostics, context);
|
||||
case MappingPackage.PORT_MAPPING:
|
||||
return validatePortMapping((PortMapping)value, diagnostics, context);
|
||||
case MappingPackage.GRAPH_ELEMENT_MAPPING:
|
||||
return validateGraphElementMapping((GraphElementMapping)value, diagnostics, context);
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public boolean validatePatternApplication(PatternApplication patternApplication, DiagnosticChain diagnostics, Map<Object, Object> context) {
|
||||
if (!validate_NoCircularContainment(patternApplication, diagnostics, context)) return false;
|
||||
boolean result = validate_EveryMultiplicityConforms(patternApplication, diagnostics, context);
|
||||
if (result || diagnostics != null) result &= validate_EveryDataValueConforms(patternApplication, diagnostics, context);
|
||||
if (result || diagnostics != null) result &= validate_EveryReferenceIsContained(patternApplication, diagnostics, context);
|
||||
if (result || diagnostics != null) result &= validate_EveryBidirectionalReferenceIsPaired(patternApplication, diagnostics, context);
|
||||
if (result || diagnostics != null) result &= validate_EveryProxyResolves(patternApplication, diagnostics, context);
|
||||
if (result || diagnostics != null) result &= validate_UniqueID(patternApplication, diagnostics, context);
|
||||
if (result || diagnostics != null) result &= validate_EveryKeyUnique(patternApplication, diagnostics, context);
|
||||
if (result || diagnostics != null) result &= validate_EveryMapEntryUnique(patternApplication, diagnostics, context);
|
||||
if (result || diagnostics != null) result &= validatePatternApplication_InvariantName(patternApplication, diagnostics, context);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* The cached validation expression for the InvariantName constraint of '<em>Pattern Application</em>'.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
protected static final String PATTERN_APPLICATION__INVARIANT_NAME__EEXPRESSION = "true";
|
||||
|
||||
/**
|
||||
* Validates the InvariantName constraint of '<em>Pattern Application</em>'.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public boolean validatePatternApplication_InvariantName(PatternApplication patternApplication, DiagnosticChain diagnostics, Map<Object, Object> context) {
|
||||
return
|
||||
validate
|
||||
(MappingPackage.Literals.PATTERN_APPLICATION,
|
||||
patternApplication,
|
||||
diagnostics,
|
||||
context,
|
||||
"http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot",
|
||||
"InvariantName",
|
||||
PATTERN_APPLICATION__INVARIANT_NAME__EEXPRESSION,
|
||||
Diagnostic.ERROR,
|
||||
DIAGNOSTIC_SOURCE,
|
||||
0);
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
public boolean validateCardinalityValue(CardinalityValue cardinalityValue, DiagnosticChain diagnostics, Map<Object, Object> context) {
|
||||
return validate_EveryDefaultConstraint(cardinalityValue, diagnostics, context);
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated NOT
|
||||
*/
|
||||
public boolean validatePortMapping(PortMapping portMapping, DiagnosticChain diagnostics, Map<Object, Object> context) {
|
||||
Model matchedModel = ((PatternApplication)portMapping.eContainer()).getModel();
|
||||
TreeIterator<EObject> itM = matchedModel.eAllContents();
|
||||
EList<BorderElement> ports = portMapping.getModelPort();
|
||||
while (itM.hasNext()) {
|
||||
Element current = (Element) itM.next();
|
||||
if (ports.contains(current)) {
|
||||
ports.remove(current);
|
||||
}
|
||||
}
|
||||
Pattern matchedPattern = ((PatternApplication)portMapping.eContainer()).getPattern();
|
||||
TreeIterator<EObject> itP = matchedPattern.eAllContents();
|
||||
boolean patternFound = false;
|
||||
while (itP.hasNext()) {
|
||||
if (itP.next().equals(portMapping.getPatternPort())) {
|
||||
patternFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (patternFound && ports.isEmpty())
|
||||
return validate_EveryDefaultConstraint(portMapping, diagnostics, context);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated NOT
|
||||
*/
|
||||
public boolean validateGraphElementMapping(GraphElementMapping graphElementMapping, DiagnosticChain diagnostics, Map<Object, Object> context) {
|
||||
Model matchedModel = ((PatternApplication)graphElementMapping.eContainer()).getModel();
|
||||
TreeIterator<EObject> itM = matchedModel.eAllContents();
|
||||
EList<GraphElement> elements = graphElementMapping.getModelGraphElement();
|
||||
while (itM.hasNext()) {
|
||||
Element current = (Element) itM.next();
|
||||
if (elements.contains(current)) {
|
||||
elements.remove(current);
|
||||
}
|
||||
}
|
||||
Pattern matchedPattern = ((PatternApplication)graphElementMapping.eContainer()).getPattern();
|
||||
TreeIterator<EObject> itP = matchedPattern.eAllContents();
|
||||
boolean patternFound = false;
|
||||
while (itP.hasNext()) {
|
||||
if (itP.next().equals(graphElementMapping.getPatternGraphElement())) {
|
||||
patternFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (patternFound && elements.isEmpty())
|
||||
return validate_EveryDefaultConstraint(graphElementMapping, diagnostics, context);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the resource locator that will be used to fetch messages for this validator's diagnostics.
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated
|
||||
*/
|
||||
@Override
|
||||
public ResourceLocator getResourceLocator() {
|
||||
// TODO
|
||||
// Specialize this to return a resource locator for messages specific to this validator.
|
||||
// Ensure that you remove @generated or mark it @generated NOT
|
||||
return super.getResourceLocator();
|
||||
}
|
||||
|
||||
} //MappingValidator
|
||||
Reference in New Issue
Block a user