/******************************************************************************* * Copyright (c) 2012, 2015 Willink Transformations 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: * 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 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, BaseCSPackage.MULTIPLICITY_BOUNDS_CS__LOWER_BOUND, 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, BaseCSPackage.MULTIPLICITY_BOUNDS_CS__UPPER_BOUND, oldUpperBound, upperBound)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @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 BaseCSPackage.MULTIPLICITY_BOUNDS_CS__LOWER_BOUND: return getLowerBound(); case BaseCSPackage.MULTIPLICITY_BOUNDS_CS__UPPER_BOUND: 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 BaseCSPackage.MULTIPLICITY_BOUNDS_CS__LOWER_BOUND: setLowerBound((Integer)newValue); return; case BaseCSPackage.MULTIPLICITY_BOUNDS_CS__UPPER_BOUND: setUpperBound((Integer)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case BaseCSPackage.MULTIPLICITY_BOUNDS_CS__LOWER_BOUND: setLowerBound(LOWER_BOUND_EDEFAULT); return; case BaseCSPackage.MULTIPLICITY_BOUNDS_CS__UPPER_BOUND: setUpperBound(UPPER_BOUND_EDEFAULT); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case BaseCSPackage.MULTIPLICITY_BOUNDS_CS__LOWER_BOUND: return lowerBound != LOWER_BOUND_EDEFAULT; case BaseCSPackage.MULTIPLICITY_BOUNDS_CS__UPPER_BOUND: 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