/**
*/
package org.eclipse.papyrus.eastadl.timing.timingconstraints.impl;
import java.util.Collection;
import org.eclipse.emf.common.notify.Notification;
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.EObjectResolvingEList;
import org.eclipse.papyrus.eastadl.timing.Event;
import org.eclipse.papyrus.eastadl.timing.TimingExpression;
import org.eclipse.papyrus.eastadl.timing.impl.TimingConstraintImpl;
import org.eclipse.papyrus.eastadl.timing.timingconstraints.ArbitraryConstraint;
import org.eclipse.papyrus.eastadl.timing.timingconstraints.TimingconstraintsPackage;
/**
*
* An implementation of the model object 'Arbitrary Constraint'.
*
*
* The following features are implemented:
*
* - {@link org.eclipse.papyrus.eastadl.timing.timingconstraints.impl.ArbitraryConstraintImpl#getMinimum Minimum}
* - {@link org.eclipse.papyrus.eastadl.timing.timingconstraints.impl.ArbitraryConstraintImpl#getMaximum Maximum}
* - {@link org.eclipse.papyrus.eastadl.timing.timingconstraints.impl.ArbitraryConstraintImpl#getEvent Event}
*
*
*
* @generated
*/
public class ArbitraryConstraintImpl extends TimingConstraintImpl implements ArbitraryConstraint {
/**
* The cached value of the '{@link #getMinimum() Minimum}' reference list.
*
*
*
* @see #getMinimum()
* @generated
* @ordered
*/
protected EList minimum;
/**
* The cached value of the '{@link #getMaximum() Maximum}' reference list.
*
*
*
* @see #getMaximum()
* @generated
* @ordered
*/
protected EList maximum;
/**
* The cached value of the '{@link #getEvent() Event}' reference.
*
*
*
* @see #getEvent()
* @generated
* @ordered
*/
protected Event event;
/**
*
*
*
* @generated
*/
protected ArbitraryConstraintImpl() {
super();
}
/**
*
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return TimingconstraintsPackage.Literals.ARBITRARY_CONSTRAINT;
}
/**
*
*
*
* @generated
*/
@Override
public EList getMinimum() {
if (minimum == null) {
minimum = new EObjectResolvingEList(TimingExpression.class, this, TimingconstraintsPackage.ARBITRARY_CONSTRAINT__MINIMUM);
}
return minimum;
}
/**
*
*
*
* @generated
*/
@Override
public EList getMaximum() {
if (maximum == null) {
maximum = new EObjectResolvingEList(TimingExpression.class, this, TimingconstraintsPackage.ARBITRARY_CONSTRAINT__MAXIMUM);
}
return maximum;
}
/**
*
*
*
* @generated
*/
@Override
public Event getEvent() {
if (event != null && event.eIsProxy()) {
InternalEObject oldEvent = (InternalEObject) event;
event = (Event) eResolveProxy(oldEvent);
if (event != oldEvent) {
if (eNotificationRequired()) {
eNotify(new ENotificationImpl(this, Notification.RESOLVE, TimingconstraintsPackage.ARBITRARY_CONSTRAINT__EVENT, oldEvent, event));
}
}
}
return event;
}
/**
*
*
*
* @generated
*/
public Event basicGetEvent() {
return event;
}
/**
*
*
*
* @generated
*/
@Override
public void setEvent(Event newEvent) {
Event oldEvent = event;
event = newEvent;
if (eNotificationRequired()) {
eNotify(new ENotificationImpl(this, Notification.SET, TimingconstraintsPackage.ARBITRARY_CONSTRAINT__EVENT, oldEvent, event));
}
}
/**
*
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case TimingconstraintsPackage.ARBITRARY_CONSTRAINT__MINIMUM:
return getMinimum();
case TimingconstraintsPackage.ARBITRARY_CONSTRAINT__MAXIMUM:
return getMaximum();
case TimingconstraintsPackage.ARBITRARY_CONSTRAINT__EVENT:
if (resolve) {
return getEvent();
}
return basicGetEvent();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case TimingconstraintsPackage.ARBITRARY_CONSTRAINT__MINIMUM:
getMinimum().clear();
getMinimum().addAll((Collection extends TimingExpression>) newValue);
return;
case TimingconstraintsPackage.ARBITRARY_CONSTRAINT__MAXIMUM:
getMaximum().clear();
getMaximum().addAll((Collection extends TimingExpression>) newValue);
return;
case TimingconstraintsPackage.ARBITRARY_CONSTRAINT__EVENT:
setEvent((Event) newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case TimingconstraintsPackage.ARBITRARY_CONSTRAINT__MINIMUM:
getMinimum().clear();
return;
case TimingconstraintsPackage.ARBITRARY_CONSTRAINT__MAXIMUM:
getMaximum().clear();
return;
case TimingconstraintsPackage.ARBITRARY_CONSTRAINT__EVENT:
setEvent((Event) null);
return;
}
super.eUnset(featureID);
}
/**
*
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case TimingconstraintsPackage.ARBITRARY_CONSTRAINT__MINIMUM:
return minimum != null && !minimum.isEmpty();
case TimingconstraintsPackage.ARBITRARY_CONSTRAINT__MAXIMUM:
return maximum != null && !maximum.isEmpty();
case TimingconstraintsPackage.ARBITRARY_CONSTRAINT__EVENT:
return event != null;
}
return super.eIsSet(featureID);
}
} // ArbitraryConstraintImpl