/**
* <copyright>
* </copyright>
*
* $Id$
*/
package org.eclipse.papyrus.infra.constraints.impl;
import java.util.Collection;
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.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.papyrus.infra.constraints.CompositeConstraint;
import org.eclipse.papyrus.infra.constraints.ConstraintsPackage;
import org.eclipse.papyrus.infra.constraints.SimpleConstraint;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Composite Constraint</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.papyrus.infra.constraints.impl.CompositeConstraintImpl#getConstraints <em>Constraints</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class CompositeConstraintImpl extends ConstraintDescriptorImpl implements CompositeConstraint {
/**
* The cached value of the '{@link #getConstraints() <em>Constraints</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getConstraints()
* @generated
* @ordered
*/
protected EList<SimpleConstraint> constraints;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected CompositeConstraintImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return ConstraintsPackage.Literals.COMPOSITE_CONSTRAINT;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<SimpleConstraint> getConstraints() {
if (constraints == null) {
constraints = new EObjectContainmentEList<SimpleConstraint>(SimpleConstraint.class, this, ConstraintsPackage.COMPOSITE_CONSTRAINT__CONSTRAINTS);
}
return constraints;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case ConstraintsPackage.COMPOSITE_CONSTRAINT__CONSTRAINTS:
return ((InternalEList<?>)getConstraints()).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 ConstraintsPackage.COMPOSITE_CONSTRAINT__CONSTRAINTS:
return getConstraints();
}
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 ConstraintsPackage.COMPOSITE_CONSTRAINT__CONSTRAINTS:
getConstraints().clear();
getConstraints().addAll((Collection<? extends SimpleConstraint>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case ConstraintsPackage.COMPOSITE_CONSTRAINT__CONSTRAINTS:
getConstraints().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case ConstraintsPackage.COMPOSITE_CONSTRAINT__CONSTRAINTS:
return constraints != null && !constraints.isEmpty();
}
return super.eIsSet(featureID);
}
} //CompositeConstraintImpl