/** */ package org.pdtextensions.semanticanalysis.model.validators.impl; import java.util.Collection; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; import org.eclipse.emf.ecore.util.EObjectResolvingEList; import org.pdtextensions.semanticanalysis.model.validators.Category; import org.pdtextensions.semanticanalysis.model.validators.Validator; import org.pdtextensions.semanticanalysis.model.validators.ValidatorsPackage; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Category</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.pdtextensions.semanticanalysis.model.validators.impl.CategoryImpl#getId <em>Id</em>}</li> * <li>{@link org.pdtextensions.semanticanalysis.model.validators.impl.CategoryImpl#getLabel <em>Label</em>}</li> * <li>{@link org.pdtextensions.semanticanalysis.model.validators.impl.CategoryImpl#getDescription <em>Description</em>}</li> * <li>{@link org.pdtextensions.semanticanalysis.model.validators.impl.CategoryImpl#getValidators <em>Validators</em>}</li> * </ul> * </p> * * @generated */ public class CategoryImpl extends MinimalEObjectImpl.Container implements Category { /** * The default value of the '{@link #getId() <em>Id</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getId() * @generated * @ordered */ protected static final String ID_EDEFAULT = null; /** * The cached value of the '{@link #getId() <em>Id</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getId() * @generated * @ordered */ protected String id = ID_EDEFAULT; /** * The default value of the '{@link #getLabel() <em>Label</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getLabel() * @generated * @ordered */ protected static final String LABEL_EDEFAULT = null; /** * The cached value of the '{@link #getLabel() <em>Label</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getLabel() * @generated * @ordered */ protected String label = LABEL_EDEFAULT; /** * The default value of the '{@link #getDescription() <em>Description</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getDescription() * @generated * @ordered */ protected static final String DESCRIPTION_EDEFAULT = null; /** * The cached value of the '{@link #getDescription() <em>Description</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getDescription() * @generated * @ordered */ protected String description = DESCRIPTION_EDEFAULT; /** * The cached value of the '{@link #getValidators() <em>Validators</em>}' reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getValidators() * @generated * @ordered */ protected EList<Validator> validators; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected CategoryImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return ValidatorsPackage.Literals.CATEGORY; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getId() { return id; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setId(String newId) { String oldId = id; id = newId; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, ValidatorsPackage.CATEGORY__ID, oldId, id)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getLabel() { return label; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setLabel(String newLabel) { String oldLabel = label; label = newLabel; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, ValidatorsPackage.CATEGORY__LABEL, oldLabel, label)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getDescription() { return description; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setDescription(String newDescription) { String oldDescription = description; description = newDescription; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, ValidatorsPackage.CATEGORY__DESCRIPTION, oldDescription, description)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<Validator> getValidators() { if (validators == null) { validators = new EObjectResolvingEList<Validator>(Validator.class, this, ValidatorsPackage.CATEGORY__VALIDATORS); } return validators; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case ValidatorsPackage.CATEGORY__ID: return getId(); case ValidatorsPackage.CATEGORY__LABEL: return getLabel(); case ValidatorsPackage.CATEGORY__DESCRIPTION: return getDescription(); case ValidatorsPackage.CATEGORY__VALIDATORS: return getValidators(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case ValidatorsPackage.CATEGORY__ID: setId((String)newValue); return; case ValidatorsPackage.CATEGORY__LABEL: setLabel((String)newValue); return; case ValidatorsPackage.CATEGORY__DESCRIPTION: setDescription((String)newValue); return; case ValidatorsPackage.CATEGORY__VALIDATORS: getValidators().clear(); getValidators().addAll((Collection<? extends Validator>)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case ValidatorsPackage.CATEGORY__ID: setId(ID_EDEFAULT); return; case ValidatorsPackage.CATEGORY__LABEL: setLabel(LABEL_EDEFAULT); return; case ValidatorsPackage.CATEGORY__DESCRIPTION: setDescription(DESCRIPTION_EDEFAULT); return; case ValidatorsPackage.CATEGORY__VALIDATORS: getValidators().clear(); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case ValidatorsPackage.CATEGORY__ID: return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id); case ValidatorsPackage.CATEGORY__LABEL: return LABEL_EDEFAULT == null ? label != null : !LABEL_EDEFAULT.equals(label); case ValidatorsPackage.CATEGORY__DESCRIPTION: return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description); case ValidatorsPackage.CATEGORY__VALIDATORS: return validators != null && !validators.isEmpty(); } 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(" (id: "); result.append(id); result.append(", label: "); result.append(label); result.append(", description: "); result.append(description); result.append(')'); return result.toString(); } } //CategoryImpl