blob: 7f0e70c3a6fc3bfbe8ac3c3e762893acca833efa [file] [log] [blame]
/**
* 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.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.m2m.atl.common.OCL.Iterator;
import org.eclipse.m2m.atl.common.OCL.OclExpression;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>For Stat</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* </p>
* <ul>
* <li>{@link org.eclipse.m2m.atl.common.ATL.ForStat#getIterator <em>Iterator</em>}</li>
* <li>{@link org.eclipse.m2m.atl.common.ATL.ForStat#getCollection <em>Collection</em>}</li>
* <li>{@link org.eclipse.m2m.atl.common.ATL.ForStat#getStatements <em>Statements</em>}</li>
* </ul>
*
* @see org.eclipse.m2m.atl.common.ATL.ATLPackage#getForStat()
* @model kind="class"
* @generated
*/
public class ForStat extends Statement {
/**
* The cached value of the '{@link #getIterator() <em>Iterator</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getIterator()
* @generated
* @ordered
*/
protected Iterator iterator;
/**
* The cached value of the '{@link #getCollection() <em>Collection</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getCollection()
* @generated
* @ordered
*/
protected OclExpression collection;
/**
* The cached value of the '{@link #getStatements() <em>Statements</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getStatements()
* @generated
* @ordered
*/
protected EList<Statement> statements;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ForStat() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return ATLPackage.Literals.FOR_STAT;
}
/**
* Returns the value of the '<em><b>Iterator</b></em>' containment reference.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Iterator</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>Iterator</em>' containment reference.
* @see #setIterator(Iterator)
* @see org.eclipse.m2m.atl.common.ATL.ATLPackage#getForStat_Iterator()
* @model containment="true" required="true" ordered="false"
* @generated
*/
public Iterator getIterator() {
return iterator;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetIterator(Iterator newIterator, NotificationChain msgs) {
Iterator oldIterator = iterator;
iterator = newIterator;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ATLPackage.FOR_STAT__ITERATOR, oldIterator, newIterator);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* Sets the value of the '{@link org.eclipse.m2m.atl.common.ATL.ForStat#getIterator <em>Iterator</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Iterator</em>' containment reference.
* @see #getIterator()
* @generated
*/
public void setIterator(Iterator newIterator) {
if (newIterator != iterator) {
NotificationChain msgs = null;
if (iterator != null)
msgs = ((InternalEObject)iterator).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ATLPackage.FOR_STAT__ITERATOR, null, msgs);
if (newIterator != null)
msgs = ((InternalEObject)newIterator).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ATLPackage.FOR_STAT__ITERATOR, null, msgs);
msgs = basicSetIterator(newIterator, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ATLPackage.FOR_STAT__ITERATOR, newIterator, newIterator));
}
/**
* Returns the value of the '<em><b>Collection</b></em>' containment reference.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Collection</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>Collection</em>' containment reference.
* @see #setCollection(OclExpression)
* @see org.eclipse.m2m.atl.common.ATL.ATLPackage#getForStat_Collection()
* @model containment="true" required="true" ordered="false"
* @generated
*/
public OclExpression getCollection() {
return collection;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetCollection(OclExpression newCollection, NotificationChain msgs) {
OclExpression oldCollection = collection;
collection = newCollection;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ATLPackage.FOR_STAT__COLLECTION, oldCollection, newCollection);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* Sets the value of the '{@link org.eclipse.m2m.atl.common.ATL.ForStat#getCollection <em>Collection</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Collection</em>' containment reference.
* @see #getCollection()
* @generated
*/
public void setCollection(OclExpression newCollection) {
if (newCollection != collection) {
NotificationChain msgs = null;
if (collection != null)
msgs = ((InternalEObject)collection).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ATLPackage.FOR_STAT__COLLECTION, null, msgs);
if (newCollection != null)
msgs = ((InternalEObject)newCollection).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ATLPackage.FOR_STAT__COLLECTION, null, msgs);
msgs = basicSetCollection(newCollection, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ATLPackage.FOR_STAT__COLLECTION, newCollection, newCollection));
}
/**
* Returns the value of the '<em><b>Statements</b></em>' containment reference list.
* The list contents are of type {@link org.eclipse.m2m.atl.common.ATL.Statement}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Statements</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>Statements</em>' containment reference list.
* @see org.eclipse.m2m.atl.common.ATL.ATLPackage#getForStat_Statements()
* @model containment="true"
* @generated
*/
public EList<Statement> getStatements() {
if (statements == null) {
statements = new EObjectContainmentEList<Statement>(Statement.class, this, ATLPackage.FOR_STAT__STATEMENTS);
}
return statements;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case ATLPackage.FOR_STAT__ITERATOR:
return basicSetIterator(null, msgs);
case ATLPackage.FOR_STAT__COLLECTION:
return basicSetCollection(null, msgs);
case ATLPackage.FOR_STAT__STATEMENTS:
return ((InternalEList<?>)getStatements()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case ATLPackage.FOR_STAT__ITERATOR:
return getIterator();
case ATLPackage.FOR_STAT__COLLECTION:
return getCollection();
case ATLPackage.FOR_STAT__STATEMENTS:
return getStatements();
}
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.FOR_STAT__ITERATOR:
setIterator((Iterator)newValue);
return;
case ATLPackage.FOR_STAT__COLLECTION:
setCollection((OclExpression)newValue);
return;
case ATLPackage.FOR_STAT__STATEMENTS:
getStatements().clear();
getStatements().addAll((Collection<? extends Statement>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case ATLPackage.FOR_STAT__ITERATOR:
setIterator((Iterator)null);
return;
case ATLPackage.FOR_STAT__COLLECTION:
setCollection((OclExpression)null);
return;
case ATLPackage.FOR_STAT__STATEMENTS:
getStatements().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case ATLPackage.FOR_STAT__ITERATOR:
return iterator != null;
case ATLPackage.FOR_STAT__COLLECTION:
return collection != null;
case ATLPackage.FOR_STAT__STATEMENTS:
return statements != null && !statements.isEmpty();
}
return super.eIsSet(featureID);
}
} // ForStat