/** * Copyright (c) 2002-2006 IBM Corporation 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: * IBM - Initial API and implementation */ package org.eclipse.xsd.impl; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.xsd.XSDCardinality; import org.eclipse.xsd.XSDCardinalityFacet; import org.eclipse.xsd.XSDPackage; /** * * An implementation of the model object 'Cardinality Facet'. * *

* The following features are implemented: *

* * * @generated */ public class XSDCardinalityFacetImpl extends XSDFundamentalFacetImpl implements XSDCardinalityFacet { /** * The default value of the '{@link #getValue() Value}' attribute. * * * @see #getValue() * @generated * @ordered */ protected static final XSDCardinality VALUE_EDEFAULT = XSDCardinality.FINITE_LITERAL; /** * The offset of the flags representing the value of the '{@link #getValue() Value}' attribute. * * * @generated * @ordered */ protected static final int VALUE_EFLAG_OFFSET = 8; /** * The flags representing the default value of the '{@link #getValue() Value}' attribute. * * * @generated * @ordered */ protected static final int VALUE_EFLAG_DEFAULT = VALUE_EDEFAULT.ordinal() << VALUE_EFLAG_OFFSET; /** * The array of enumeration values for '{@link XSDCardinality Cardinality}' * * * @generated * @ordered */ private static final XSDCardinality[] VALUE_EFLAG_VALUES = XSDCardinality.values(); /** * The flag representing the value of the '{@link #getValue() Value}' attribute. * * * @see #getValue() * @generated * @ordered */ protected static final int VALUE_EFLAG = 1 << VALUE_EFLAG_OFFSET; /** * * * @generated */ protected XSDCardinalityFacetImpl() { super(); } /** * * * @generated */ @Override protected EClass eStaticClass() { return XSDPackage.Literals.XSD_CARDINALITY_FACET; } /** * * * @generated */ @Override public XSDCardinality getValue() { return VALUE_EFLAG_VALUES[(eFlags & VALUE_EFLAG) >>> VALUE_EFLAG_OFFSET]; } /** * * * @generated */ @Override public void setValue(XSDCardinality newValue) { XSDCardinality oldValue = VALUE_EFLAG_VALUES[(eFlags & VALUE_EFLAG) >>> VALUE_EFLAG_OFFSET]; if (newValue == null) newValue = VALUE_EDEFAULT; eFlags = eFlags & ~VALUE_EFLAG | newValue.ordinal() << VALUE_EFLAG_OFFSET; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, XSDPackage.XSD_CARDINALITY_FACET__VALUE, oldValue, newValue)); } /** * * * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case XSDPackage.XSD_CARDINALITY_FACET__VALUE: return getValue(); } return super.eGet(featureID, resolve, coreType); } /** * * * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case XSDPackage.XSD_CARDINALITY_FACET__VALUE: setValue((XSDCardinality)newValue); return; } super.eSet(featureID, newValue); } /** * * * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case XSDPackage.XSD_CARDINALITY_FACET__VALUE: setValue(VALUE_EDEFAULT); return; } super.eUnset(featureID); } /** * * * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case XSDPackage.XSD_CARDINALITY_FACET__VALUE: return (eFlags & VALUE_EFLAG) != VALUE_EFLAG_DEFAULT; } return super.eIsSet(featureID); } /** * * * @generated */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuilder result = new StringBuilder(super.toString()); result.append(" (value: "); result.append(VALUE_EFLAG_VALUES[(eFlags & VALUE_EFLAG) >>> VALUE_EFLAG_OFFSET]); result.append(')'); return result.toString(); } @Override public Object getEffectiveValue() { return getValue(); } }