org.eclipse.ocl.expressions.impl.CollectionItemImpl Maven / Gradle / Ivy
/**
*
*
* Copyright (c) 2006, 2009 IBM Corporation, Zeligsoft Inc., 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:
* IBM - Initial API and implementation
* Zeligsoft - Bug 207365
*
*
*
* $Id: CollectionItemImpl.java,v 1.8 2009/01/23 17:16:04 cdamus Exp $
*/
package org.eclipse.ocl.expressions.impl;
import java.util.Map;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.DiagnosticChain;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.ocl.expressions.CollectionItem;
import org.eclipse.ocl.expressions.ExpressionsPackage;
import org.eclipse.ocl.expressions.OCLExpression;
import org.eclipse.ocl.expressions.operations.CollectionItemOperations;
import org.eclipse.ocl.utilities.Visitor;
/**
*
* An implementation of the model object 'Collection Item'.
*
*
* The following features are implemented:
*
* - {@link org.eclipse.ocl.expressions.impl.CollectionItemImpl#getItem Item}
*
*
*
* @generated
*/
public class CollectionItemImpl
extends CollectionLiteralPartImpl
implements CollectionItem {
/**
* The cached value of the '{@link #getItem() Item}' containment reference.
*
*
* @see #getItem()
* @generated
* @ordered
*/
protected OCLExpression item;
/**
*
*
* @generated
*/
protected CollectionItemImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return ExpressionsPackage.Literals.COLLECTION_ITEM;
}
/**
*
*
* @generated
*/
public OCLExpression getItem() {
return item;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetItem(OCLExpression newItem,
NotificationChain msgs) {
OCLExpression oldItem = item;
item = newItem;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this,
Notification.SET, ExpressionsPackage.COLLECTION_ITEM__ITEM,
oldItem, newItem);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
public void setItem(OCLExpression newItem) {
if (newItem != item) {
NotificationChain msgs = null;
if (item != null)
msgs = ((InternalEObject) item).eInverseRemove(this,
EOPPOSITE_FEATURE_BASE
- ExpressionsPackage.COLLECTION_ITEM__ITEM, null, msgs);
if (newItem != null)
msgs = ((InternalEObject) newItem).eInverseAdd(this,
EOPPOSITE_FEATURE_BASE
- ExpressionsPackage.COLLECTION_ITEM__ITEM, null, msgs);
msgs = basicSetItem(newItem, msgs);
if (msgs != null)
msgs.dispatch();
} else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET,
ExpressionsPackage.COLLECTION_ITEM__ITEM, newItem, newItem));
}
/**
*
*
* @generated
*/
public boolean checkItemType(DiagnosticChain diagnostics,
Map