| /** |
| * <copyright> |
| * </copyright> |
| * |
| * $Id$ |
| */ |
| package org.eclipse.egf.core.trace.impl; |
| |
| import java.util.Collection; |
| |
| import org.eclipse.egf.core.trace.Category; |
| import org.eclipse.egf.core.trace.Filter; |
| import org.eclipse.egf.core.trace.TracePackage; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| import org.eclipse.emf.common.notify.NotificationChain; |
| |
| import org.eclipse.emf.common.util.EList; |
| |
| 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 org.eclipse.emf.ecore.util.EObjectContainmentEList; |
| import org.eclipse.emf.ecore.util.InternalEList; |
| |
| /** |
| * <!-- 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.eclipse.egf.core.trace.impl.CategoryImpl#getFilters <em>Filters</em>}</li> |
| * <li>{@link org.eclipse.egf.core.trace.impl.CategoryImpl#isActive <em>Active</em>}</li> |
| * <li>{@link org.eclipse.egf.core.trace.impl.CategoryImpl#getName <em>Name</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class CategoryImpl extends EObjectImpl implements Category { |
| /** |
| * The cached value of the '{@link #getFilters() <em>Filters</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getFilters() |
| * @generated |
| * @ordered |
| */ |
| protected EList<Filter> filters; |
| |
| /** |
| * The default value of the '{@link #isActive() <em>Active</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #isActive() |
| * @generated |
| * @ordered |
| */ |
| protected static final boolean ACTIVE_EDEFAULT = false; |
| |
| /** |
| * The cached value of the '{@link #isActive() <em>Active</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #isActive() |
| * @generated |
| * @ordered |
| */ |
| protected boolean active = ACTIVE_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #getName() <em>Name</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getName() |
| * @generated |
| * @ordered |
| */ |
| protected static final String NAME_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getName() <em>Name</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getName() |
| * @generated |
| * @ordered |
| */ |
| protected String name = NAME_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected CategoryImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return TracePackage.Literals.CATEGORY; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<Filter> getFilters() { |
| if (filters == null) { |
| filters = new EObjectContainmentEList<Filter>(Filter.class, this, TracePackage.CATEGORY__FILTERS); |
| } |
| return filters; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public boolean isActive() { |
| return active; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setActive(boolean newActive) { |
| boolean oldActive = active; |
| active = newActive; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, TracePackage.CATEGORY__ACTIVE, oldActive, active)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getName() { |
| return name; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setName(String newName) { |
| String oldName = name; |
| name = newName; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, TracePackage.CATEGORY__NAME, oldName, name)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case TracePackage.CATEGORY__FILTERS: |
| return ((InternalEList<?>)getFilters()).basicRemove(otherEnd, msgs); |
| } |
| return super.eInverseRemove(otherEnd, featureID, msgs); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case TracePackage.CATEGORY__FILTERS: |
| return getFilters(); |
| case TracePackage.CATEGORY__ACTIVE: |
| return isActive(); |
| case TracePackage.CATEGORY__NAME: |
| return getName(); |
| } |
| 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 TracePackage.CATEGORY__FILTERS: |
| getFilters().clear(); |
| getFilters().addAll((Collection<? extends Filter>)newValue); |
| return; |
| case TracePackage.CATEGORY__ACTIVE: |
| setActive((Boolean)newValue); |
| return; |
| case TracePackage.CATEGORY__NAME: |
| setName((String)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case TracePackage.CATEGORY__FILTERS: |
| getFilters().clear(); |
| return; |
| case TracePackage.CATEGORY__ACTIVE: |
| setActive(ACTIVE_EDEFAULT); |
| return; |
| case TracePackage.CATEGORY__NAME: |
| setName(NAME_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case TracePackage.CATEGORY__FILTERS: |
| return filters != null && !filters.isEmpty(); |
| case TracePackage.CATEGORY__ACTIVE: |
| return active != ACTIVE_EDEFAULT; |
| case TracePackage.CATEGORY__NAME: |
| return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); |
| } |
| 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(" (active: "); |
| result.append(active); |
| result.append(", name: "); |
| result.append(name); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //CategoryImpl |