All Downloads are FREE. Search and download functionalities are using the official Maven repository.

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 context) { return CollectionRangeOperations.checkRangeType(this, diagnostics, context); } /** * @generated NOT */ @Override @SuppressWarnings("unchecked") public > T accept(U v) { return ((Visitor) v) .visitCollectionRange(this); } /** * * * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case ExpressionsPackage.COLLECTION_RANGE__FIRST : return basicSetFirst(null, msgs); case ExpressionsPackage.COLLECTION_RANGE__LAST : return basicSetLast(null, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * * * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case ExpressionsPackage.COLLECTION_RANGE__FIRST : return getFirst(); case ExpressionsPackage.COLLECTION_RANGE__LAST : return getLast(); } return super.eGet(featureID, resolve, coreType); } /** * * * @generated */ @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case ExpressionsPackage.COLLECTION_RANGE__FIRST : setFirst((OCLExpression) newValue); return; case ExpressionsPackage.COLLECTION_RANGE__LAST : setLast((OCLExpression) newValue); return; } super.eSet(featureID, newValue); } /** * * * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case ExpressionsPackage.COLLECTION_RANGE__FIRST : setFirst((OCLExpression) null); return; case ExpressionsPackage.COLLECTION_RANGE__LAST : setLast((OCLExpression) null); return; } super.eUnset(featureID); } /** * * * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case ExpressionsPackage.COLLECTION_RANGE__FIRST : return first != null; case ExpressionsPackage.COLLECTION_RANGE__LAST : return last != null; } return super.eIsSet(featureID); } } //CollectionRangeImpl




© 2015 - 2024 Weber Informatics LLC | Privacy Policy