| 1 | /** |
| 2 | * <copyright> |
| 3 | * </copyright> |
| 4 | * |
| 5 | * $Id$ |
| 6 | */ |
| 7 | package de.uka.ipd.sdq.featureconfig.impl; |
| 8 | |
| 9 | import de.uka.ipd.sdq.featureconfig.StringAttributeValue; |
| 10 | import de.uka.ipd.sdq.featureconfig.featureconfigPackage; |
| 11 | |
| 12 | import de.uka.ipd.sdq.featureconfig.util.featureconfigValidator; |
| 13 | |
| 14 | import java.util.Map; |
| 15 | |
| 16 | import org.eclipse.emf.common.util.BasicDiagnostic; |
| 17 | import org.eclipse.emf.common.util.Diagnostic; |
| 18 | import org.eclipse.emf.common.util.DiagnosticChain; |
| 19 | |
| 20 | import org.eclipse.emf.ecore.EClass; |
| 21 | |
| 22 | import org.eclipse.emf.ecore.plugin.EcorePlugin; |
| 23 | |
| 24 | import org.eclipse.emf.ecore.util.EObjectValidator; |
| 25 | |
| 26 | import org.eclipse.ocl.ParserException; |
| 27 | |
| 28 | import org.eclipse.ocl.ecore.Constraint; |
| 29 | import org.eclipse.ocl.ecore.OCL; |
| 30 | |
| 31 | /** |
| 32 | * <!-- begin-user-doc --> |
| 33 | * An implementation of the model object '<em><b>String Attribute Value</b></em>'. |
| 34 | * <!-- end-user-doc --> |
| 35 | * <p> |
| 36 | * </p> |
| 37 | * |
| 38 | * @generated |
| 39 | */ |
| 40 | public class StringAttributeValueImpl extends AttributeValueImpl implements StringAttributeValue { |
| 41 | /** |
| 42 | * <!-- begin-user-doc --> |
| 43 | * <!-- end-user-doc --> |
| 44 | * @generated |
| 45 | */ |
| 46 | protected StringAttributeValueImpl() { |
| 47 | super(); |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * <!-- begin-user-doc --> |
| 52 | * <!-- end-user-doc --> |
| 53 | * @generated |
| 54 | */ |
| 55 | @Override |
| 56 | protected EClass eStaticClass() { |
| 57 | return featureconfigPackage.Literals.STRING_ATTRIBUTE_VALUE; |
| 58 | } |
| 59 | |
| 60 | /** |
| 61 | * The cached OCL expression body for the '{@link #AttributeValueIsDefinedInFeatureAndEqualsTypeString(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Attribute Value Is Defined In Feature And Equals Type String</em>}' operation. |
| 62 | * <!-- begin-user-doc --> |
| 63 | * <!-- end-user-doc --> |
| 64 | * @see #AttributeValueIsDefinedInFeatureAndEqualsTypeString(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) |
| 65 | * @generated |
| 66 | * @ordered |
| 67 | */ |
| 68 | protected static final String ATTRIBUTE_VALUE_IS_DEFINED_IN_FEATURE_AND_EQUALS_TYPE_STRING__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP = "self.confignode.origin.attributes->one(a | a.name = self.name)"+ |
| 69 | " and"+ |
| 70 | " self.confignode.origin.attributes->any(a | a.name = self.name).oclIsTypeOf(featuremodel::StringAttribute)"; |
| 71 | |
| 72 | /** |
| 73 | * The cached OCL invariant for the '{@link #AttributeValueIsDefinedInFeatureAndEqualsTypeString(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Attribute Value Is Defined In Feature And Equals Type String</em>}' invariant operation. |
| 74 | * <!-- begin-user-doc --> |
| 75 | * <!-- end-user-doc --> |
| 76 | * @see #AttributeValueIsDefinedInFeatureAndEqualsTypeString(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) |
| 77 | * @generated |
| 78 | * @ordered |
| 79 | */ |
| 80 | protected static Constraint ATTRIBUTE_VALUE_IS_DEFINED_IN_FEATURE_AND_EQUALS_TYPE_STRING__DIAGNOSTIC_CHAIN_MAP__EOCL_INV; |
| 81 | |
| 82 | /** |
| 83 | * <!-- begin-user-doc --> |
| 84 | * <!-- end-user-doc --> |
| 85 | * @generated |
| 86 | */ |
| 87 | public boolean AttributeValueIsDefinedInFeatureAndEqualsTypeString(DiagnosticChain diagnostics, Map<Object, Object> context) { |
| 88 | if (ATTRIBUTE_VALUE_IS_DEFINED_IN_FEATURE_AND_EQUALS_TYPE_STRING__DIAGNOSTIC_CHAIN_MAP__EOCL_INV == null) { |
| 89 | OCL.Helper helper = EOCL_ENV.createOCLHelper(); |
| 90 | helper.setContext(featureconfigPackage.Literals.STRING_ATTRIBUTE_VALUE); |
| 91 | try { |
| 92 | ATTRIBUTE_VALUE_IS_DEFINED_IN_FEATURE_AND_EQUALS_TYPE_STRING__DIAGNOSTIC_CHAIN_MAP__EOCL_INV = helper.createInvariant(ATTRIBUTE_VALUE_IS_DEFINED_IN_FEATURE_AND_EQUALS_TYPE_STRING__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP); |
| 93 | } |
| 94 | catch (ParserException pe) { |
| 95 | throw new UnsupportedOperationException(pe.getLocalizedMessage()); |
| 96 | } |
| 97 | } |
| 98 | if (!EOCL_ENV.createQuery(ATTRIBUTE_VALUE_IS_DEFINED_IN_FEATURE_AND_EQUALS_TYPE_STRING__DIAGNOSTIC_CHAIN_MAP__EOCL_INV).check(this)) { |
| 99 | if (diagnostics != null) { |
| 100 | diagnostics.add |
| 101 | (new BasicDiagnostic |
| 102 | (Diagnostic.ERROR, |
| 103 | featureconfigValidator.DIAGNOSTIC_SOURCE, |
| 104 | featureconfigValidator.STRING_ATTRIBUTE_VALUE__ATTRIBUTE_VALUE_IS_DEFINED_IN_FEATURE_AND_EQUALS_TYPE_STRING, |
| 105 | EcorePlugin.INSTANCE.getString("_UI_GenericInvariant_diagnostic", new Object[] { "AttributeValueIsDefinedInFeatureAndEqualsTypeString", EObjectValidator.getObjectLabel(this, context) }), |
| 106 | new Object [] { this })); |
| 107 | } |
| 108 | return false; |
| 109 | } |
| 110 | return true; |
| 111 | } |
| 112 | |
| 113 | /** |
| 114 | * The cached environment for evaluating OCL expressions. |
| 115 | * <!-- begin-user-doc --> |
| 116 | * <!-- end-user-doc --> |
| 117 | * @generated |
| 118 | * @ordered |
| 119 | */ |
| 120 | protected static final OCL EOCL_ENV = OCL.newInstance(); |
| 121 | |
| 122 | } //StringAttributeValueImpl |