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

org.eclipse.ocl.expressions.impl.LoopExpImpl Maven / Gradle / Ivy

/**
 * 
 * 
 * Copyright (c) 2006, 2008 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: LoopExpImpl.java,v 1.8 2008/10/12 01:09:49 cdamus Exp $
 */
package org.eclipse.ocl.expressions.impl;

import java.util.Collection;

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.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.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.ocl.expressions.ExpressionsPackage;
import org.eclipse.ocl.expressions.LoopExp;
import org.eclipse.ocl.expressions.OCLExpression;
import org.eclipse.ocl.expressions.Variable;
import org.eclipse.ocl.expressions.operations.LoopExpOperations;

/**
 * 
 * An implementation of the model object 'Loop Exp'.
 * 
 * 

* The following features are implemented: *

    *
  • {@link org.eclipse.ocl.expressions.impl.LoopExpImpl#getBody Body}
  • *
  • {@link org.eclipse.ocl.expressions.impl.LoopExpImpl#getIterator Iterator}
  • *
*

* * @generated */ public abstract class LoopExpImpl extends CallExpImpl implements LoopExp { /** * The cached value of the '{@link #getBody() Body}' containment reference. * * * @see #getBody() * @generated * @ordered */ protected OCLExpression body; /** * The cached value of the '{@link #getIterator() Iterator}' containment reference list. * * * @see #getIterator() * @generated * @ordered */ protected EList> iterator; /** * * * @generated */ protected LoopExpImpl() { super(); } /** * * * @generated */ @Override protected EClass eStaticClass() { return ExpressionsPackage.Literals.LOOP_EXP; } /** * * * @generated */ public OCLExpression getBody() { return body; } /** * * * @generated */ public NotificationChain basicSetBody(OCLExpression newBody, NotificationChain msgs) { OCLExpression oldBody = body; body = newBody; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ExpressionsPackage.LOOP_EXP__BODY, oldBody, newBody); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * * * @generated */ public void setBody(OCLExpression newBody) { if (newBody != body) { NotificationChain msgs = null; if (body != null) msgs = ((InternalEObject) body).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ExpressionsPackage.LOOP_EXP__BODY, null, msgs); if (newBody != null) msgs = ((InternalEObject) newBody).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ExpressionsPackage.LOOP_EXP__BODY, null, msgs); msgs = basicSetBody(newBody, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, ExpressionsPackage.LOOP_EXP__BODY, newBody, newBody)); } /** * * * @generated */ public EList> getIterator() { if (iterator == null) { iterator = new EObjectContainmentEList>( Variable.class, this, ExpressionsPackage.LOOP_EXP__ITERATOR); } return iterator; } /** * * * @generated */ public boolean checkSourceCollection(DiagnosticChain diagnostics, Map context) { return LoopExpOperations.checkSourceCollection(this, diagnostics, context); } /** * * * @generated */ public boolean checkLoopVariableInit(DiagnosticChain diagnostics, Map context) { return LoopExpOperations.checkLoopVariableInit(this, diagnostics, context); } /** * * * @generated */ public boolean checkLoopVariableType(DiagnosticChain diagnostics, Map context) { return LoopExpOperations.checkLoopVariableType(this, diagnostics, context); } /** * * * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case ExpressionsPackage.LOOP_EXP__BODY : return basicSetBody(null, msgs); case ExpressionsPackage.LOOP_EXP__ITERATOR : return ((InternalEList) getIterator()).basicRemove(otherEnd, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * * * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case ExpressionsPackage.LOOP_EXP__BODY : return getBody(); case ExpressionsPackage.LOOP_EXP__ITERATOR : return getIterator(); } return super.eGet(featureID, resolve, coreType); } /** * * * @generated */ @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case ExpressionsPackage.LOOP_EXP__BODY : setBody((OCLExpression) newValue); return; case ExpressionsPackage.LOOP_EXP__ITERATOR : getIterator().clear(); getIterator().addAll( (Collection>) newValue); return; } super.eSet(featureID, newValue); } /** * * * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case ExpressionsPackage.LOOP_EXP__BODY : setBody((OCLExpression) null); return; case ExpressionsPackage.LOOP_EXP__ITERATOR : getIterator().clear(); return; } super.eUnset(featureID); } /** * * * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case ExpressionsPackage.LOOP_EXP__BODY : return body != null; case ExpressionsPackage.LOOP_EXP__ITERATOR : return iterator != null && !iterator.isEmpty(); } return super.eIsSet(featureID); } } //LoopExpImpl




© 2015 - 2024 Weber Informatics LLC | Privacy Policy