/*
 * This file has been developed at the University of Munich, Chair for Programming & Software Engineering.
 * 
 * This file is licensed under the Eclipse Public License (EPL) 1.0
 * 
 */
package eu.mdd4soa.smm.statik.impl;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

import eu.mdd4soa.smm.statik.ISMStatikPackage;
import eu.mdd4soa.smm.statik.SMMType;
import eu.mdd4soa.smm.statik.TypedMultiElement;

/**
 * <!-- begin-user-doc --> An implementation of the model object '
 * <em><b>Typed Multi Element</b></em>'. <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 * <li>{@link eu.mdd4soa.smm.statik.impl.TypedMultiElementImpl#getMin <em>Min
 * </em>}</li>
 * <li>{@link eu.mdd4soa.smm.statik.impl.TypedMultiElementImpl#getMax <em>Max
 * </em>}</li>
 * <li>{@link eu.mdd4soa.smm.statik.impl.TypedMultiElementImpl#isIsOrdered <em>
 * Is Ordered</em>}</li>
 * <li>{@link eu.mdd4soa.smm.statik.impl.TypedMultiElementImpl#getType <em>Type
 * </em>}</li>
 * </ul>
 * </p>
 * 
 * @generated
 */
public abstract class TypedMultiElementImpl extends EObjectImpl implements TypedMultiElement {
	/**
	 * The default value of the '{@link #getMin() <em>Min</em>}' attribute. <!--
	 * begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @see #getMin()
	 * @generated
	 * @ordered
	 */
	protected static final int MIN_EDEFAULT= 1;

	/**
	 * The cached value of the '{@link #getMin() <em>Min</em>}' attribute. <!--
	 * begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @see #getMin()
	 * @generated
	 * @ordered
	 */
	protected int min= MIN_EDEFAULT;

	/**
	 * The default value of the '{@link #getMax() <em>Max</em>}' attribute. <!--
	 * begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @see #getMax()
	 * @generated
	 * @ordered
	 */
	protected static final int MAX_EDEFAULT= 1;

	/**
	 * The cached value of the '{@link #getMax() <em>Max</em>}' attribute. <!--
	 * begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @see #getMax()
	 * @generated
	 * @ordered
	 */
	protected int max= MAX_EDEFAULT;

	/**
	 * The default value of the '{@link #isIsOrdered() <em>Is Ordered</em>}'
	 * attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @see #isIsOrdered()
	 * @generated
	 * @ordered
	 */
	protected static final boolean IS_ORDERED_EDEFAULT= false;

	/**
	 * The cached value of the '{@link #isIsOrdered() <em>Is Ordered</em>}'
	 * attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @see #isIsOrdered()
	 * @generated
	 * @ordered
	 */
	protected boolean isOrdered= IS_ORDERED_EDEFAULT;

	/**
	 * The cached value of the '{@link #getType() <em>Type</em>}' reference.
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @see #getType()
	 * @generated
	 * @ordered
	 */
	protected SMMType type;

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @generated
	 */
	protected TypedMultiElementImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return ISMStatikPackage.Literals.TYPED_MULTI_ELEMENT;
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @generated
	 */
	public int getMin() {
		return min;
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @generated
	 */
	public void setMin(int newMin) {
		int oldMin= min;
		min= newMin;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ISMStatikPackage.TYPED_MULTI_ELEMENT__MIN, oldMin, min));
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @generated
	 */
	public int getMax() {
		return max;
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @generated
	 */
	public void setMax(int newMax) {
		int oldMax= max;
		max= newMax;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ISMStatikPackage.TYPED_MULTI_ELEMENT__MAX, oldMax, max));
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @generated
	 */
	public boolean isIsOrdered() {
		return isOrdered;
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @generated
	 */
	public void setIsOrdered(boolean newIsOrdered) {
		boolean oldIsOrdered= isOrdered;
		isOrdered= newIsOrdered;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ISMStatikPackage.TYPED_MULTI_ELEMENT__IS_ORDERED, oldIsOrdered, isOrdered));
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @generated
	 */
	public SMMType getType() {
		if (type != null && type.eIsProxy()) {
			InternalEObject oldType= (InternalEObject) type;
			type= (SMMType) eResolveProxy(oldType);
			if (type != oldType) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, ISMStatikPackage.TYPED_MULTI_ELEMENT__TYPE, oldType, type));
			}
		}
		return type;
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @generated
	 */
	public SMMType basicGetType() {
		return type;
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @generated
	 */
	public void setType(SMMType newType) {
		SMMType oldType= type;
		type= newType;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ISMStatikPackage.TYPED_MULTI_ELEMENT__TYPE, oldType, type));
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case ISMStatikPackage.TYPED_MULTI_ELEMENT__MIN:
				return getMin();
			case ISMStatikPackage.TYPED_MULTI_ELEMENT__MAX:
				return getMax();
			case ISMStatikPackage.TYPED_MULTI_ELEMENT__IS_ORDERED:
				return isIsOrdered();
			case ISMStatikPackage.TYPED_MULTI_ELEMENT__TYPE:
				if (resolve)
					return getType();
				return basicGetType();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case ISMStatikPackage.TYPED_MULTI_ELEMENT__MIN:
				setMin((Integer) newValue);
				return;
			case ISMStatikPackage.TYPED_MULTI_ELEMENT__MAX:
				setMax((Integer) newValue);
				return;
			case ISMStatikPackage.TYPED_MULTI_ELEMENT__IS_ORDERED:
				setIsOrdered((Boolean) newValue);
				return;
			case ISMStatikPackage.TYPED_MULTI_ELEMENT__TYPE:
				setType((SMMType) newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case ISMStatikPackage.TYPED_MULTI_ELEMENT__MIN:
				setMin(MIN_EDEFAULT);
				return;
			case ISMStatikPackage.TYPED_MULTI_ELEMENT__MAX:
				setMax(MAX_EDEFAULT);
				return;
			case ISMStatikPackage.TYPED_MULTI_ELEMENT__IS_ORDERED:
				setIsOrdered(IS_ORDERED_EDEFAULT);
				return;
			case ISMStatikPackage.TYPED_MULTI_ELEMENT__TYPE:
				setType((SMMType) null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case ISMStatikPackage.TYPED_MULTI_ELEMENT__MIN:
				return min != MIN_EDEFAULT;
			case ISMStatikPackage.TYPED_MULTI_ELEMENT__MAX:
				return max != MAX_EDEFAULT;
			case ISMStatikPackage.TYPED_MULTI_ELEMENT__IS_ORDERED:
				return isOrdered != IS_ORDERED_EDEFAULT;
			case ISMStatikPackage.TYPED_MULTI_ELEMENT__TYPE:
				return type != null;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc --> <!-- end-user-doc -->
	 * 
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy())
			return super.toString();

		StringBuffer result= new StringBuffer(super.toString());
		result.append(" (min: ");
		result.append(min);
		result.append(", max: ");
		result.append(max);
		result.append(", isOrdered: ");
		result.append(isOrdered);
		result.append(')');
		return result.toString();
	}

} // TypedMultiElementImpl
