org.jnario.impl.ExampleRowImpl Maven / Gradle / Ivy
/*******************************************************************************
* Copyright (c) 2012 BMW Car IT 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
*******************************************************************************/
package org.jnario.impl;
import java.util.Collection;
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.impl.EObjectImpl;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecore.util.InternalEList;
import org.jnario.ExampleCell;
import org.eclipse.xtext.xbase.XExpression;
import org.jnario.ExampleRow;
import org.jnario.ExampleTable;
import org.jnario.JnarioPackage;
/**
*
* An implementation of the model object 'Example Row'.
*
*
* The following features are implemented:
*
* - {@link org.jnario.impl.ExampleRowImpl#getCells Cells}
* - {@link org.jnario.impl.ExampleRowImpl#getTable Table}
*
*
*
* @generated
*/
public class ExampleRowImpl extends EObjectImpl implements ExampleRow {
/**
* The cached value of the '{@link #getCells() Cells}' containment reference list.
*
*
* @see #getCells()
* @generated
* @ordered
*/
protected EList cells;
/**
*
*
* @generated
*/
protected ExampleRowImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return JnarioPackage.Literals.EXAMPLE_ROW;
}
/**
*
*
* @generated
*/
public EList getCells() {
if (cells == null) {
cells = new EObjectContainmentEList(ExampleCell.class, this, JnarioPackage.EXAMPLE_ROW__CELLS);
}
return cells;
}
/**
*
*
* @generated
*/
public ExampleTable getTable() {
if (eContainerFeatureID() != JnarioPackage.EXAMPLE_ROW__TABLE) return null;
return (ExampleTable)eInternalContainer();
}
/**
*
*
* @generated
*/
public NotificationChain basicSetTable(ExampleTable newTable, NotificationChain msgs) {
msgs = eBasicSetContainer((InternalEObject)newTable, JnarioPackage.EXAMPLE_ROW__TABLE, msgs);
return msgs;
}
/**
*
*
* @generated
*/
public void setTable(ExampleTable newTable) {
if (newTable != eInternalContainer() || (eContainerFeatureID() != JnarioPackage.EXAMPLE_ROW__TABLE && newTable != null)) {
if (EcoreUtil.isAncestor(this, newTable))
throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
NotificationChain msgs = null;
if (eInternalContainer() != null)
msgs = eBasicRemoveFromContainer(msgs);
if (newTable != null)
msgs = ((InternalEObject)newTable).eInverseAdd(this, JnarioPackage.EXAMPLE_TABLE__ROWS, ExampleTable.class, msgs);
msgs = basicSetTable(newTable, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, JnarioPackage.EXAMPLE_ROW__TABLE, newTable, newTable));
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case JnarioPackage.EXAMPLE_ROW__TABLE:
if (eInternalContainer() != null)
msgs = eBasicRemoveFromContainer(msgs);
return basicSetTable((ExampleTable)otherEnd, msgs);
}
return super.eInverseAdd(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case JnarioPackage.EXAMPLE_ROW__CELLS:
return ((InternalEList>)getCells()).basicRemove(otherEnd, msgs);
case JnarioPackage.EXAMPLE_ROW__TABLE:
return basicSetTable(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) {
switch (eContainerFeatureID()) {
case JnarioPackage.EXAMPLE_ROW__TABLE:
return eInternalContainer().eInverseRemove(this, JnarioPackage.EXAMPLE_TABLE__ROWS, ExampleTable.class, msgs);
}
return super.eBasicRemoveFromContainerFeature(msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case JnarioPackage.EXAMPLE_ROW__CELLS:
return getCells();
case JnarioPackage.EXAMPLE_ROW__TABLE:
return getTable();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case JnarioPackage.EXAMPLE_ROW__CELLS:
getCells().clear();
getCells().addAll((Collection extends ExampleCell>)newValue);
return;
case JnarioPackage.EXAMPLE_ROW__TABLE:
setTable((ExampleTable)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case JnarioPackage.EXAMPLE_ROW__CELLS:
getCells().clear();
return;
case JnarioPackage.EXAMPLE_ROW__TABLE:
setTable((ExampleTable)null);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case JnarioPackage.EXAMPLE_ROW__CELLS:
return cells != null && !cells.isEmpty();
case JnarioPackage.EXAMPLE_ROW__TABLE:
return getTable() != null;
}
return super.eIsSet(featureID);
}
} //ExampleRowImpl
© 2015 - 2025 Weber Informatics LLC | Privacy Policy