| /******************************************************************************* |
| * Copyright (c) 2012, 2019 Willink Transformations and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v2.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v20.html |
| * |
| * Contributors: |
| * E.D.Willink - Initial API and implementation |
| *******************************************************************************/ |
| package org.eclipse.ocl.xtext.basecs.impl; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| import org.eclipse.jdt.annotation.NonNull; |
| import org.eclipse.ocl.xtext.basecs.BaseCSPackage; |
| import org.eclipse.ocl.xtext.basecs.MultiplicityBoundsCS; |
| import org.eclipse.ocl.xtext.basecs.util.BaseCSVisitor; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Integer Multiplicity CS</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.ocl.xtext.basecs.impl.MultiplicityBoundsCSImpl#getLowerBound <em>Lower Bound</em>}</li> |
| * <li>{@link org.eclipse.ocl.xtext.basecs.impl.MultiplicityBoundsCSImpl#getUpperBound <em>Upper Bound</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class MultiplicityBoundsCSImpl extends MultiplicityCSImpl implements MultiplicityBoundsCS |
| { |
| /** |
| * The number of structural features of the '<em>Multiplicity Bounds CS</em>' class. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| * @ordered |
| */ |
| public static final int MULTIPLICITY_BOUNDS_CS_FEATURE_COUNT = MultiplicityCSImpl.MULTIPLICITY_CS_FEATURE_COUNT + 2; |
| |
| /** |
| * The default value of the '{@link #getLowerBound() <em>Lower Bound</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getLowerBound() |
| * @generated |
| * @ordered |
| */ |
| protected static final int LOWER_BOUND_EDEFAULT = 1; |
| |
| /** |
| * The cached value of the '{@link #getLowerBound() <em>Lower Bound</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getLowerBound() |
| * @generated |
| * @ordered |
| */ |
| protected int lowerBound = LOWER_BOUND_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #getUpperBound() <em>Upper Bound</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getUpperBound() |
| * @generated |
| * @ordered |
| */ |
| protected static final Integer UPPER_BOUND_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getUpperBound() <em>Upper Bound</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getUpperBound() |
| * @generated |
| * @ordered |
| */ |
| protected Integer upperBound = UPPER_BOUND_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected MultiplicityBoundsCSImpl() |
| { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() |
| { |
| return BaseCSPackage.Literals.MULTIPLICITY_BOUNDS_CS; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public int getLowerBound() |
| { |
| return lowerBound; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setLowerBound(int newLowerBound) |
| { |
| int oldLowerBound = lowerBound; |
| lowerBound = newLowerBound; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, 3, oldLowerBound, lowerBound)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Integer getUpperBound() |
| { |
| return upperBound; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setUpperBound(Integer newUpperBound) |
| { |
| Integer oldUpperBound = upperBound; |
| upperBound = newUpperBound; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, 4, oldUpperBound, upperBound)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated NOT |
| */ |
| @Override |
| public String toString() { |
| return super.toString(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) |
| { |
| switch (featureID) |
| { |
| case 3: |
| return getLowerBound(); |
| case 4: |
| return getUpperBound(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) |
| { |
| switch (featureID) |
| { |
| case 3: |
| setLowerBound((Integer)newValue); |
| return; |
| case 4: |
| setUpperBound((Integer)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) |
| { |
| switch (featureID) |
| { |
| case 3: |
| setLowerBound(LOWER_BOUND_EDEFAULT); |
| return; |
| case 4: |
| setUpperBound(UPPER_BOUND_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) |
| { |
| switch (featureID) |
| { |
| case 3: |
| return lowerBound != LOWER_BOUND_EDEFAULT; |
| case 4: |
| return UPPER_BOUND_EDEFAULT == null ? upperBound != null : !UPPER_BOUND_EDEFAULT.equals(upperBound); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * {@inheritDoc} |
| * @generated |
| */ |
| @Override |
| public <R> R accept(@NonNull BaseCSVisitor<R> visitor) { |
| return visitor.visitMultiplicityBoundsCS(this); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated NOT |
| */ |
| @Override |
| public int getLower() |
| { |
| return lowerBound; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated NOT |
| */ |
| @Override |
| public int getUpper() |
| { |
| return upperBound != null ? upperBound : lowerBound; |
| } |
| } //IntegerMultiplicityCSImpl |