/**
* Copyright (c) 2011 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
*/
package org.obeonetwork.dsl.database.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.obeonetwork.dsl.database.Constraint;
import org.obeonetwork.dsl.database.DatabasePackage;
import org.obeonetwork.dsl.database.Table;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Constraint</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.obeonetwork.dsl.database.impl.ConstraintImpl#getExpression <em>Expression</em>}</li>
* <li>{@link org.obeonetwork.dsl.database.impl.ConstraintImpl#getOwner <em>Owner</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class ConstraintImpl extends NamedElementImpl implements Constraint {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static final String copyright = "Copyright (c) 2011 Obeo.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Obeo - initial API and implementation";
/**
* The default value of the '{@link #getExpression() <em>Expression</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getExpression()
* @generated
* @ordered
*/
protected static final String EXPRESSION_EDEFAULT = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ConstraintImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return DatabasePackage.Literals.CONSTRAINT;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getExpression() {
return (String)eDynamicGet(DatabasePackage.CONSTRAINT__EXPRESSION, DatabasePackage.Literals.CONSTRAINT__EXPRESSION, true, true);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setExpression(String newExpression) {
eDynamicSet(DatabasePackage.CONSTRAINT__EXPRESSION, DatabasePackage.Literals.CONSTRAINT__EXPRESSION, newExpression);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Table getOwner() {
return (Table)eDynamicGet(DatabasePackage.CONSTRAINT__OWNER, DatabasePackage.Literals.CONSTRAINT__OWNER, true, true);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetOwner(Table newOwner, NotificationChain msgs) {
msgs = eBasicSetContainer((InternalEObject)newOwner, DatabasePackage.CONSTRAINT__OWNER, msgs);
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setOwner(Table newOwner) {
eDynamicSet(DatabasePackage.CONSTRAINT__OWNER, DatabasePackage.Literals.CONSTRAINT__OWNER, newOwner);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case DatabasePackage.CONSTRAINT__OWNER:
if (eInternalContainer() != null)
msgs = eBasicRemoveFromContainer(msgs);
return basicSetOwner((Table)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 DatabasePackage.CONSTRAINT__OWNER:
return basicSetOwner(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) {
switch (eContainerFeatureID()) {
case DatabasePackage.CONSTRAINT__OWNER:
return eInternalContainer().eInverseRemove(this, DatabasePackage.TABLE__CONSTRAINTS, Table.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 DatabasePackage.CONSTRAINT__EXPRESSION:
return getExpression();
case DatabasePackage.CONSTRAINT__OWNER:
return getOwner();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case DatabasePackage.CONSTRAINT__EXPRESSION:
setExpression((String)newValue);
return;
case DatabasePackage.CONSTRAINT__OWNER:
setOwner((Table)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case DatabasePackage.CONSTRAINT__EXPRESSION:
setExpression(EXPRESSION_EDEFAULT);
return;
case DatabasePackage.CONSTRAINT__OWNER:
setOwner((Table)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case DatabasePackage.CONSTRAINT__EXPRESSION:
return EXPRESSION_EDEFAULT == null ? getExpression() != null : !EXPRESSION_EDEFAULT.equals(getExpression());
case DatabasePackage.CONSTRAINT__OWNER:
return getOwner() != null;
}
return super.eIsSet(featureID);
}
} //ConstraintImpl