/**
*/
package hu.bme.mit.incquery.cep.metamodels.cep.impl;
import hu.bme.mit.incquery.cep.metamodels.cep.CepPackage;
import hu.bme.mit.incquery.cep.metamodels.cep.EventPattern;
import hu.bme.mit.incquery.cep.metamodels.internalsm.InternalsmPackage;
import hu.bme.mit.incquery.cep.metamodels.internalsm.StateMachine;
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.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Event Pattern</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link hu.bme.mit.incquery.cep.metamodels.cep.impl.EventPatternImpl#getStateMachine <em>State Machine</em>}</li>
* <li>{@link hu.bme.mit.incquery.cep.metamodels.cep.impl.EventPatternImpl#getId <em>Id</em>}</li>
* <li>{@link hu.bme.mit.incquery.cep.metamodels.cep.impl.EventPatternImpl#getHoldingTime <em>Holding Time</em>}</li>
* <li>{@link hu.bme.mit.incquery.cep.metamodels.cep.impl.EventPatternImpl#getPriority <em>Priority</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public abstract class EventPatternImpl extends EObjectImpl implements EventPattern {
/**
* The cached value of the '{@link #getStateMachine() <em>State Machine</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getStateMachine()
* @generated
* @ordered
*/
protected StateMachine stateMachine;
/**
* The default value of the '{@link #getId() <em>Id</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getId()
* @generated
* @ordered
*/
protected static final String ID_EDEFAULT = null;
/**
* The cached value of the '{@link #getId() <em>Id</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getId()
* @generated
* @ordered
*/
protected String id = ID_EDEFAULT;
/**
* The default value of the '{@link #getHoldingTime() <em>Holding Time</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getHoldingTime()
* @generated
* @ordered
*/
protected static final long HOLDING_TIME_EDEFAULT = 0L;
/**
* The cached value of the '{@link #getHoldingTime() <em>Holding Time</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getHoldingTime()
* @generated
* @ordered
*/
protected long holdingTime = HOLDING_TIME_EDEFAULT;
/**
* The default value of the '{@link #getPriority() <em>Priority</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPriority()
* @generated
* @ordered
*/
protected static final int PRIORITY_EDEFAULT = 0;
/**
* The cached value of the '{@link #getPriority() <em>Priority</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPriority()
* @generated
* @ordered
*/
protected int priority = PRIORITY_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected EventPatternImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return CepPackage.Literals.EVENT_PATTERN;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public StateMachine getStateMachine() {
if (stateMachine != null && stateMachine.eIsProxy()) {
InternalEObject oldStateMachine = (InternalEObject)stateMachine;
stateMachine = (StateMachine)eResolveProxy(oldStateMachine);
if (stateMachine != oldStateMachine) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, CepPackage.EVENT_PATTERN__STATE_MACHINE, oldStateMachine, stateMachine));
}
}
return stateMachine;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public StateMachine basicGetStateMachine() {
return stateMachine;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetStateMachine(StateMachine newStateMachine, NotificationChain msgs) {
StateMachine oldStateMachine = stateMachine;
stateMachine = newStateMachine;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, CepPackage.EVENT_PATTERN__STATE_MACHINE, oldStateMachine, newStateMachine);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setStateMachine(StateMachine newStateMachine) {
if (newStateMachine != stateMachine) {
NotificationChain msgs = null;
if (stateMachine != null)
msgs = ((InternalEObject)stateMachine).eInverseRemove(this, InternalsmPackage.STATE_MACHINE__EVENT_PATTERN, StateMachine.class, msgs);
if (newStateMachine != null)
msgs = ((InternalEObject)newStateMachine).eInverseAdd(this, InternalsmPackage.STATE_MACHINE__EVENT_PATTERN, StateMachine.class, msgs);
msgs = basicSetStateMachine(newStateMachine, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, CepPackage.EVENT_PATTERN__STATE_MACHINE, newStateMachine, newStateMachine));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getId() {
return id;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setId(String newId) {
String oldId = id;
id = newId;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, CepPackage.EVENT_PATTERN__ID, oldId, id));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public long getHoldingTime() {
return holdingTime;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setHoldingTime(long newHoldingTime) {
long oldHoldingTime = holdingTime;
holdingTime = newHoldingTime;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, CepPackage.EVENT_PATTERN__HOLDING_TIME, oldHoldingTime, holdingTime));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int getPriority() {
return priority;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setPriority(int newPriority) {
int oldPriority = priority;
priority = newPriority;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, CepPackage.EVENT_PATTERN__PRIORITY, oldPriority, priority));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case CepPackage.EVENT_PATTERN__STATE_MACHINE:
if (stateMachine != null)
msgs = ((InternalEObject)stateMachine).eInverseRemove(this, InternalsmPackage.STATE_MACHINE__EVENT_PATTERN, StateMachine.class, msgs);
return basicSetStateMachine((StateMachine)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 CepPackage.EVENT_PATTERN__STATE_MACHINE:
return basicSetStateMachine(null, 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 CepPackage.EVENT_PATTERN__STATE_MACHINE:
if (resolve) return getStateMachine();
return basicGetStateMachine();
case CepPackage.EVENT_PATTERN__ID:
return getId();
case CepPackage.EVENT_PATTERN__HOLDING_TIME:
return getHoldingTime();
case CepPackage.EVENT_PATTERN__PRIORITY:
return getPriority();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case CepPackage.EVENT_PATTERN__STATE_MACHINE:
setStateMachine((StateMachine)newValue);
return;
case CepPackage.EVENT_PATTERN__ID:
setId((String)newValue);
return;
case CepPackage.EVENT_PATTERN__HOLDING_TIME:
setHoldingTime((Long)newValue);
return;
case CepPackage.EVENT_PATTERN__PRIORITY:
setPriority((Integer)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case CepPackage.EVENT_PATTERN__STATE_MACHINE:
setStateMachine((StateMachine)null);
return;
case CepPackage.EVENT_PATTERN__ID:
setId(ID_EDEFAULT);
return;
case CepPackage.EVENT_PATTERN__HOLDING_TIME:
setHoldingTime(HOLDING_TIME_EDEFAULT);
return;
case CepPackage.EVENT_PATTERN__PRIORITY:
setPriority(PRIORITY_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case CepPackage.EVENT_PATTERN__STATE_MACHINE:
return stateMachine != null;
case CepPackage.EVENT_PATTERN__ID:
return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id);
case CepPackage.EVENT_PATTERN__HOLDING_TIME:
return holdingTime != HOLDING_TIME_EDEFAULT;
case CepPackage.EVENT_PATTERN__PRIORITY:
return priority != PRIORITY_EDEFAULT;
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (id: ");
result.append(id);
result.append(", holdingTime: ");
result.append(holdingTime);
result.append(", priority: ");
result.append(priority);
result.append(')');
return result.toString();
}
} //EventPatternImpl