blob: d612e61cb46d9be871e1105934d9f10d9d55d29b [file] [log] [blame]
/**
*/
package laxcondition.impl;
import java.util.Collection;
import laxcondition.Formula;
import laxcondition.LaxCondition;
import laxcondition.LaxconditionPackage;
import laxcondition.Operator;
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.EObjectContainmentWithInverseEList;
import org.eclipse.emf.ecore.util.InternalEList;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Formula</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link laxcondition.impl.FormulaImpl#getOp <em>Op</em>}</li>
* <li>{@link laxcondition.impl.FormulaImpl#getArguments <em>Arguments</em>}</li>
* </ul>
*
* @generated
*/
public class FormulaImpl extends LaxConditionImpl implements Formula {
/**
* The default value of the '{@link #getOp() <em>Op</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOp()
* @generated
* @ordered
*/
protected static final Operator OP_EDEFAULT = Operator.NOT;
/**
* The cached value of the '{@link #getOp() <em>Op</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOp()
* @generated
* @ordered
*/
protected Operator op = OP_EDEFAULT;
/**
* The cached value of the '{@link #getArguments() <em>Arguments</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getArguments()
* @generated
* @ordered
*/
protected EList<LaxCondition> arguments;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected FormulaImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return LaxconditionPackage.Literals.FORMULA;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Operator getOp() {
return op;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setOp(Operator newOp) {
Operator oldOp = op;
op = newOp == null ? OP_EDEFAULT : newOp;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, LaxconditionPackage.FORMULA__OP, oldOp, op));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<LaxCondition> getArguments() {
if (arguments == null) {
arguments = new EObjectContainmentWithInverseEList<LaxCondition>(LaxCondition.class, this, LaxconditionPackage.FORMULA__ARGUMENTS, LaxconditionPackage.LAX_CONDITION__FORMULA);
}
return arguments;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case LaxconditionPackage.FORMULA__ARGUMENTS:
return ((InternalEList<InternalEObject>)(InternalEList<?>)getArguments()).basicAdd(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 LaxconditionPackage.FORMULA__ARGUMENTS:
return ((InternalEList<?>)getArguments()).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 LaxconditionPackage.FORMULA__OP:
return getOp();
case LaxconditionPackage.FORMULA__ARGUMENTS:
return getArguments();
}
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 LaxconditionPackage.FORMULA__OP:
setOp((Operator)newValue);
return;
case LaxconditionPackage.FORMULA__ARGUMENTS:
getArguments().clear();
getArguments().addAll((Collection<? extends LaxCondition>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case LaxconditionPackage.FORMULA__OP:
setOp(OP_EDEFAULT);
return;
case LaxconditionPackage.FORMULA__ARGUMENTS:
getArguments().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case LaxconditionPackage.FORMULA__OP:
return op != OP_EDEFAULT;
case LaxconditionPackage.FORMULA__ARGUMENTS:
return arguments != null && !arguments.isEmpty();
}
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(" (op: ");
result.append(op);
result.append(')');
return result.toString();
}
} //FormulaImpl