diff options
Diffstat (limited to 'plugins/org.eclipse.m2m.atl.common/src/org/eclipse/m2m/atl/common/ATL/InPattern.java')
-rw-r--r-- | plugins/org.eclipse.m2m.atl.common/src/org/eclipse/m2m/atl/common/ATL/InPattern.java | 354 |
1 files changed, 354 insertions, 0 deletions
diff --git a/plugins/org.eclipse.m2m.atl.common/src/org/eclipse/m2m/atl/common/ATL/InPattern.java b/plugins/org.eclipse.m2m.atl.common/src/org/eclipse/m2m/atl/common/ATL/InPattern.java new file mode 100644 index 00000000..1a43ea5e --- /dev/null +++ b/plugins/org.eclipse.m2m.atl.common/src/org/eclipse/m2m/atl/common/ATL/InPattern.java @@ -0,0 +1,354 @@ +/** + * Copyright (c) 2008, 2012, 2015 Obeo. + * 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: + * Obeo - initial API and implementation + * Dennis Wagelaar (Vrije Universiteit Brussel) + */ +package org.eclipse.m2m.atl.common.ATL; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.Notification; +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.impl.ENotificationImpl; + +import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.ecore.util.InternalEList; + +import org.eclipse.m2m.atl.common.OCL.OclExpression; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>In Pattern</b></em>'. + * <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * </p> + * <ul> + * <li>{@link org.eclipse.m2m.atl.common.ATL.InPattern#getElements <em>Elements</em>}</li> + * <li>{@link org.eclipse.m2m.atl.common.ATL.InPattern#getRule <em>Rule</em>}</li> + * <li>{@link org.eclipse.m2m.atl.common.ATL.InPattern#getFilter <em>Filter</em>}</li> + * </ul> + * + * @see org.eclipse.m2m.atl.common.ATL.ATLPackage#getInPattern() + * @model kind="class" + * @generated + */ +public class InPattern extends LocatedElement { + /** + * The cached value of the '{@link #getElements() <em>Elements</em>}' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getElements() + * @generated + * @ordered + */ + protected EList<InPatternElement> elements; + + /** + * The cached value of the '{@link #getFilter() <em>Filter</em>}' containment reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getFilter() + * @generated + * @ordered + */ + protected OclExpression filter; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected InPattern() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return ATLPackage.Literals.IN_PATTERN; + } + + /** + * Returns the value of the '<em><b>Elements</b></em>' containment reference list. + * The list contents are of type {@link org.eclipse.m2m.atl.common.ATL.InPatternElement}. + * It is bidirectional and its opposite is '{@link org.eclipse.m2m.atl.common.ATL.InPatternElement#getInPattern <em>In Pattern</em>}'. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Elements</em>' containment reference list isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Elements</em>' containment reference list. + * @see org.eclipse.m2m.atl.common.ATL.ATLPackage#getInPattern_Elements() + * @see org.eclipse.m2m.atl.common.ATL.InPatternElement#getInPattern + * @model opposite="inPattern" containment="true" required="true" ordered="false" + * @generated + */ + public EList<InPatternElement> getElements() { + if (elements == null) { + elements = new EObjectContainmentWithInverseEList<InPatternElement>(InPatternElement.class, this, ATLPackage.IN_PATTERN__ELEMENTS, ATLPackage.IN_PATTERN_ELEMENT__IN_PATTERN); + } + return elements; + } + + /** + * Returns the value of the '<em><b>Rule</b></em>' container reference. + * It is bidirectional and its opposite is '{@link org.eclipse.m2m.atl.common.ATL.MatchedRule#getInPattern <em>In Pattern</em>}'. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Rule</em>' container reference isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Rule</em>' container reference. + * @see #setRule(MatchedRule) + * @see org.eclipse.m2m.atl.common.ATL.ATLPackage#getInPattern_Rule() + * @see org.eclipse.m2m.atl.common.ATL.MatchedRule#getInPattern + * @model opposite="inPattern" required="true" transient="false" ordered="false" + * @generated + */ + public MatchedRule getRule() { + if (eContainerFeatureID() != ATLPackage.IN_PATTERN__RULE) return null; + return (MatchedRule)eInternalContainer(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public NotificationChain basicSetRule(MatchedRule newRule, NotificationChain msgs) { + msgs = eBasicSetContainer((InternalEObject)newRule, ATLPackage.IN_PATTERN__RULE, msgs); + return msgs; + } + + /** + * Sets the value of the '{@link org.eclipse.m2m.atl.common.ATL.InPattern#getRule <em>Rule</em>}' container reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Rule</em>' container reference. + * @see #getRule() + * @generated + */ + public void setRule(MatchedRule newRule) { + if (newRule != eInternalContainer() || (eContainerFeatureID() != ATLPackage.IN_PATTERN__RULE && newRule != null)) { + if (EcoreUtil.isAncestor(this, newRule)) + throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); + NotificationChain msgs = null; + if (eInternalContainer() != null) + msgs = eBasicRemoveFromContainer(msgs); + if (newRule != null) + msgs = ((InternalEObject)newRule).eInverseAdd(this, ATLPackage.MATCHED_RULE__IN_PATTERN, MatchedRule.class, msgs); + msgs = basicSetRule(newRule, msgs); + if (msgs != null) msgs.dispatch(); + } + else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, ATLPackage.IN_PATTERN__RULE, newRule, newRule)); + } + + /** + * Returns the value of the '<em><b>Filter</b></em>' containment reference. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Filter</em>' containment reference isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Filter</em>' containment reference. + * @see #setFilter(OclExpression) + * @see org.eclipse.m2m.atl.common.ATL.ATLPackage#getInPattern_Filter() + * @model containment="true" ordered="false" + * @generated + */ + public OclExpression getFilter() { + return filter; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public NotificationChain basicSetFilter(OclExpression newFilter, NotificationChain msgs) { + OclExpression oldFilter = filter; + filter = newFilter; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ATLPackage.IN_PATTERN__FILTER, oldFilter, newFilter); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * Sets the value of the '{@link org.eclipse.m2m.atl.common.ATL.InPattern#getFilter <em>Filter</em>}' containment reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Filter</em>' containment reference. + * @see #getFilter() + * @generated + */ + public void setFilter(OclExpression newFilter) { + if (newFilter != filter) { + NotificationChain msgs = null; + if (filter != null) + msgs = ((InternalEObject)filter).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ATLPackage.IN_PATTERN__FILTER, null, msgs); + if (newFilter != null) + msgs = ((InternalEObject)newFilter).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ATLPackage.IN_PATTERN__FILTER, null, msgs); + msgs = basicSetFilter(newFilter, msgs); + if (msgs != null) msgs.dispatch(); + } + else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, ATLPackage.IN_PATTERN__FILTER, newFilter, newFilter)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case ATLPackage.IN_PATTERN__ELEMENTS: + return ((InternalEList<InternalEObject>)(InternalEList<?>)getElements()).basicAdd(otherEnd, msgs); + case ATLPackage.IN_PATTERN__RULE: + if (eInternalContainer() != null) + msgs = eBasicRemoveFromContainer(msgs); + return basicSetRule((MatchedRule)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 ATLPackage.IN_PATTERN__ELEMENTS: + return ((InternalEList<?>)getElements()).basicRemove(otherEnd, msgs); + case ATLPackage.IN_PATTERN__RULE: + return basicSetRule(null, msgs); + case ATLPackage.IN_PATTERN__FILTER: + return basicSetFilter(null, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { + switch (eContainerFeatureID()) { + case ATLPackage.IN_PATTERN__RULE: + return eInternalContainer().eInverseRemove(this, ATLPackage.MATCHED_RULE__IN_PATTERN, MatchedRule.class, msgs); + } + return super.eBasicRemoveFromContainerFeature(msgs); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case ATLPackage.IN_PATTERN__ELEMENTS: + return getElements(); + case ATLPackage.IN_PATTERN__RULE: + return getRule(); + case ATLPackage.IN_PATTERN__FILTER: + return getFilter(); + } + 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 ATLPackage.IN_PATTERN__ELEMENTS: + getElements().clear(); + getElements().addAll((Collection<? extends InPatternElement>)newValue); + return; + case ATLPackage.IN_PATTERN__RULE: + setRule((MatchedRule)newValue); + return; + case ATLPackage.IN_PATTERN__FILTER: + setFilter((OclExpression)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case ATLPackage.IN_PATTERN__ELEMENTS: + getElements().clear(); + return; + case ATLPackage.IN_PATTERN__RULE: + setRule((MatchedRule)null); + return; + case ATLPackage.IN_PATTERN__FILTER: + setFilter((OclExpression)null); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case ATLPackage.IN_PATTERN__ELEMENTS: + return elements != null && !elements.isEmpty(); + case ATLPackage.IN_PATTERN__RULE: + return getRule() != null; + case ATLPackage.IN_PATTERN__FILTER: + return filter != null; + } + return super.eIsSet(featureID); + } + +} // InPattern |