/*******************************************************************************
* Copyright (c) 2014 Willink Transformations and others.
* 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:
* E.D.Willink - initial API and implementation
*******************************************************************************/
package org.eclipse.ocl.examples.xtext2lpg.XBNF.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.ocl.examples.xtext2lpg.XBNF.Conjunction;
import org.eclipse.ocl.examples.xtext2lpg.XBNF.Disjunction;
import org.eclipse.ocl.examples.xtext2lpg.XBNF.XBNFPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Disjunction</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.ocl.examples.xtext2lpg.XBNF.impl.DisjunctionImpl#getConjunctions <em>Conjunctions</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class DisjunctionImpl extends AbstractElementImpl implements Disjunction {
/**
* The cached value of the '{@link #getConjunctions() <em>Conjunctions</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getConjunctions()
* @generated
* @ordered
*/
protected EList<Conjunction> conjunctions;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected DisjunctionImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return XBNFPackage.Literals.DISJUNCTION;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Conjunction> getConjunctions() {
if (conjunctions == null) {
conjunctions = new EObjectContainmentEList<Conjunction>(Conjunction.class, this, XBNFPackage.DISJUNCTION__CONJUNCTIONS);
}
return conjunctions;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case XBNFPackage.DISJUNCTION__CONJUNCTIONS:
return ((InternalEList<?>)getConjunctions()).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 XBNFPackage.DISJUNCTION__CONJUNCTIONS:
return getConjunctions();
}
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 XBNFPackage.DISJUNCTION__CONJUNCTIONS:
getConjunctions().clear();
getConjunctions().addAll((Collection<? extends Conjunction>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case XBNFPackage.DISJUNCTION__CONJUNCTIONS:
getConjunctions().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case XBNFPackage.DISJUNCTION__CONJUNCTIONS:
return conjunctions != null && !conjunctions.isEmpty();
}
return super.eIsSet(featureID);
}
} //DisjunctionImpl