org.eclipse.ocl.expressions.impl.CollectionRangeImpl 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: CollectionRangeImpl.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.CollectionRange;
import org.eclipse.ocl.expressions.ExpressionsPackage;
import org.eclipse.ocl.expressions.OCLExpression;
import org.eclipse.ocl.expressions.operations.CollectionRangeOperations;
import org.eclipse.ocl.utilities.Visitor;
/**
*
* An implementation of the model object 'Collection Range'.
*
*
* The following features are implemented:
*
* - {@link org.eclipse.ocl.expressions.impl.CollectionRangeImpl#getFirst First}
* - {@link org.eclipse.ocl.expressions.impl.CollectionRangeImpl#getLast Last}
*
*
*
* @generated
*/
public class CollectionRangeImpl
extends CollectionLiteralPartImpl
implements CollectionRange {
/**
* The cached value of the '{@link #getFirst() First}' containment reference.
*
*
* @see #getFirst()
* @generated
* @ordered
*/
protected OCLExpression first;
/**
* The cached value of the '{@link #getLast() Last}' containment reference.
*
*
* @see #getLast()
* @generated
* @ordered
*/
protected OCLExpression last;
/**
*
*
* @generated
*/
protected CollectionRangeImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return ExpressionsPackage.Literals.COLLECTION_RANGE;
}
/**
*
*
* @generated
*/
public OCLExpression getFirst() {
return first;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetFirst(OCLExpression newFirst,
NotificationChain msgs) {
OCLExpression oldFirst = first;
first = newFirst;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this,
Notification.SET, ExpressionsPackage.COLLECTION_RANGE__FIRST,
oldFirst, newFirst);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
public void setFirst(OCLExpression newFirst) {
if (newFirst != first) {
NotificationChain msgs = null;
if (first != null)
msgs = ((InternalEObject) first).eInverseRemove(this,
EOPPOSITE_FEATURE_BASE
- ExpressionsPackage.COLLECTION_RANGE__FIRST, null,
msgs);
if (newFirst != null)
msgs = ((InternalEObject) newFirst).eInverseAdd(this,
EOPPOSITE_FEATURE_BASE
- ExpressionsPackage.COLLECTION_RANGE__FIRST, null,
msgs);
msgs = basicSetFirst(newFirst, msgs);
if (msgs != null)
msgs.dispatch();
} else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET,
ExpressionsPackage.COLLECTION_RANGE__FIRST, newFirst, newFirst));
}
/**
*
*
* @generated
*/
public OCLExpression getLast() {
return last;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetLast(OCLExpression newLast,
NotificationChain msgs) {
OCLExpression oldLast = last;
last = newLast;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this,
Notification.SET, ExpressionsPackage.COLLECTION_RANGE__LAST,
oldLast, newLast);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
public void setLast(OCLExpression newLast) {
if (newLast != last) {
NotificationChain msgs = null;
if (last != null)
msgs = ((InternalEObject) last)
.eInverseRemove(this, EOPPOSITE_FEATURE_BASE
- ExpressionsPackage.COLLECTION_RANGE__LAST, null, msgs);
if (newLast != null)
msgs = ((InternalEObject) newLast)
.eInverseAdd(this, EOPPOSITE_FEATURE_BASE
- ExpressionsPackage.COLLECTION_RANGE__LAST, null, msgs);
msgs = basicSetLast(newLast, msgs);
if (msgs != null)
msgs.dispatch();
} else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET,
ExpressionsPackage.COLLECTION_RANGE__LAST, newLast, newLast));
}
/**
*
*
* @generated
*/
public boolean checkRangeType(DiagnosticChain diagnostics,
Map