| /******************************************************************************* |
| * Copyright (c) 2009, 2014 Xored Software Inc 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: |
| * Xored Software Inc - initial API and implementation and/or initial documentation |
| *******************************************************************************/ |
| package org.eclipse.rcptt.sherlock.core.model.sherlock.report.impl; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| import org.eclipse.emf.common.notify.NotificationChain; |
| |
| import org.eclipse.emf.common.util.EMap; |
| |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.EObject; |
| import org.eclipse.emf.ecore.EStructuralFeature; |
| 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.EcoreEMap; |
| import org.eclipse.emf.ecore.util.InternalEList; |
| |
| import org.eclipse.rcptt.sherlock.core.model.sherlock.report.Event; |
| import org.eclipse.rcptt.sherlock.core.model.sherlock.report.EventKind; |
| import org.eclipse.rcptt.sherlock.core.model.sherlock.report.EventSource; |
| import org.eclipse.rcptt.sherlock.core.model.sherlock.report.ReportPackage; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Event</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.rcptt.sherlock.core.model.sherlock.report.impl.EventImpl#getTime <em>Time</em>}</li> |
| * <li>{@link org.eclipse.rcptt.sherlock.core.model.sherlock.report.impl.EventImpl#getProperties <em>Properties</em>}</li> |
| * <li>{@link org.eclipse.rcptt.sherlock.core.model.sherlock.report.impl.EventImpl#getData <em>Data</em>}</li> |
| * <li>{@link org.eclipse.rcptt.sherlock.core.model.sherlock.report.impl.EventImpl#getSource <em>Source</em>}</li> |
| * <li>{@link org.eclipse.rcptt.sherlock.core.model.sherlock.report.impl.EventImpl#getKind <em>Kind</em>}</li> |
| * <li>{@link org.eclipse.rcptt.sherlock.core.model.sherlock.report.impl.EventImpl#getColor <em>Color</em>}</li> |
| * <li>{@link org.eclipse.rcptt.sherlock.core.model.sherlock.report.impl.EventImpl#getCount <em>Count</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class EventImpl extends EObjectImpl implements Event { |
| /** |
| * The default value of the '{@link #getTime() <em>Time</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getTime() |
| * @generated |
| * @ordered |
| */ |
| protected static final long TIME_EDEFAULT = 0L; |
| |
| /** |
| * The cached value of the '{@link #getTime() <em>Time</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getTime() |
| * @generated |
| * @ordered |
| */ |
| protected long time = TIME_EDEFAULT; |
| |
| /** |
| * The cached value of the '{@link #getProperties() <em>Properties</em>}' map. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getProperties() |
| * @generated |
| * @ordered |
| */ |
| protected EMap<String, EObject> properties; |
| |
| /** |
| * The cached value of the '{@link #getData() <em>Data</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getData() |
| * @generated |
| * @ordered |
| */ |
| protected EObject data; |
| |
| /** |
| * The cached value of the '{@link #getSource() <em>Source</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getSource() |
| * @generated |
| * @ordered |
| */ |
| protected EventSource source; |
| |
| /** |
| * The default value of the '{@link #getKind() <em>Kind</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getKind() |
| * @generated |
| * @ordered |
| */ |
| protected static final EventKind KIND_EDEFAULT = EventKind.INFO; |
| |
| /** |
| * The cached value of the '{@link #getKind() <em>Kind</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getKind() |
| * @generated |
| * @ordered |
| */ |
| protected EventKind kind = KIND_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #getColor() <em>Color</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getColor() |
| * @generated |
| * @ordered |
| */ |
| protected static final String COLOR_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getColor() <em>Color</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getColor() |
| * @generated |
| * @ordered |
| */ |
| protected String color = COLOR_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #getCount() <em>Count</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getCount() |
| * @generated |
| * @ordered |
| */ |
| protected static final int COUNT_EDEFAULT = 1; |
| |
| /** |
| * The cached value of the '{@link #getCount() <em>Count</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getCount() |
| * @generated |
| * @ordered |
| */ |
| protected int count = COUNT_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected EventImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return ReportPackage.Literals.EVENT; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public long getTime() { |
| return time; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setTime(long newTime) { |
| long oldTime = time; |
| time = newTime; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ReportPackage.EVENT__TIME, oldTime, time)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EMap<String, EObject> getProperties() { |
| if (properties == null) { |
| properties = new EcoreEMap<String,EObject>(ReportPackage.Literals.PROPERTY_MAP, PropertyMapImpl.class, this, ReportPackage.EVENT__PROPERTIES); |
| } |
| return properties; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EObject getData() { |
| return data; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetData(EObject newData, NotificationChain msgs) { |
| EObject oldData = data; |
| data = newData; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ReportPackage.EVENT__DATA, oldData, newData); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setData(EObject newData) { |
| if (newData != data) { |
| NotificationChain msgs = null; |
| if (data != null) |
| msgs = ((InternalEObject)data).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ReportPackage.EVENT__DATA, null, msgs); |
| if (newData != null) |
| msgs = ((InternalEObject)newData).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ReportPackage.EVENT__DATA, null, msgs); |
| msgs = basicSetData(newData, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ReportPackage.EVENT__DATA, newData, newData)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EventSource getSource() { |
| if (source != null && source.eIsProxy()) { |
| InternalEObject oldSource = (InternalEObject)source; |
| source = (EventSource)eResolveProxy(oldSource); |
| if (source != oldSource) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, ReportPackage.EVENT__SOURCE, oldSource, source)); |
| } |
| } |
| return source; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EventSource basicGetSource() { |
| return source; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setSource(EventSource newSource) { |
| EventSource oldSource = source; |
| source = newSource; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ReportPackage.EVENT__SOURCE, oldSource, source)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EventKind getKind() { |
| return kind; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setKind(EventKind newKind) { |
| EventKind oldKind = kind; |
| kind = newKind == null ? KIND_EDEFAULT : newKind; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ReportPackage.EVENT__KIND, oldKind, kind)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getColor() { |
| return color; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setColor(String newColor) { |
| String oldColor = color; |
| color = newColor; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ReportPackage.EVENT__COLOR, oldColor, color)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public int getCount() { |
| return count; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setCount(int newCount) { |
| int oldCount = count; |
| count = newCount; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ReportPackage.EVENT__COUNT, oldCount, count)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case ReportPackage.EVENT__PROPERTIES: |
| return ((InternalEList<?>)getProperties()).basicRemove(otherEnd, msgs); |
| case ReportPackage.EVENT__DATA: |
| return basicSetData(null, 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 ReportPackage.EVENT__TIME: |
| return getTime(); |
| case ReportPackage.EVENT__PROPERTIES: |
| if (coreType) return getProperties(); |
| else return getProperties().map(); |
| case ReportPackage.EVENT__DATA: |
| return getData(); |
| case ReportPackage.EVENT__SOURCE: |
| if (resolve) return getSource(); |
| return basicGetSource(); |
| case ReportPackage.EVENT__KIND: |
| return getKind(); |
| case ReportPackage.EVENT__COLOR: |
| return getColor(); |
| case ReportPackage.EVENT__COUNT: |
| return getCount(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case ReportPackage.EVENT__TIME: |
| setTime((Long)newValue); |
| return; |
| case ReportPackage.EVENT__PROPERTIES: |
| ((EStructuralFeature.Setting)getProperties()).set(newValue); |
| return; |
| case ReportPackage.EVENT__DATA: |
| setData((EObject)newValue); |
| return; |
| case ReportPackage.EVENT__SOURCE: |
| setSource((EventSource)newValue); |
| return; |
| case ReportPackage.EVENT__KIND: |
| setKind((EventKind)newValue); |
| return; |
| case ReportPackage.EVENT__COLOR: |
| setColor((String)newValue); |
| return; |
| case ReportPackage.EVENT__COUNT: |
| setCount((Integer)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case ReportPackage.EVENT__TIME: |
| setTime(TIME_EDEFAULT); |
| return; |
| case ReportPackage.EVENT__PROPERTIES: |
| getProperties().clear(); |
| return; |
| case ReportPackage.EVENT__DATA: |
| setData((EObject)null); |
| return; |
| case ReportPackage.EVENT__SOURCE: |
| setSource((EventSource)null); |
| return; |
| case ReportPackage.EVENT__KIND: |
| setKind(KIND_EDEFAULT); |
| return; |
| case ReportPackage.EVENT__COLOR: |
| setColor(COLOR_EDEFAULT); |
| return; |
| case ReportPackage.EVENT__COUNT: |
| setCount(COUNT_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case ReportPackage.EVENT__TIME: |
| return time != TIME_EDEFAULT; |
| case ReportPackage.EVENT__PROPERTIES: |
| return properties != null && !properties.isEmpty(); |
| case ReportPackage.EVENT__DATA: |
| return data != null; |
| case ReportPackage.EVENT__SOURCE: |
| return source != null; |
| case ReportPackage.EVENT__KIND: |
| return kind != KIND_EDEFAULT; |
| case ReportPackage.EVENT__COLOR: |
| return COLOR_EDEFAULT == null ? color != null : !COLOR_EDEFAULT.equals(color); |
| case ReportPackage.EVENT__COUNT: |
| return count != COUNT_EDEFAULT; |
| } |
| 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(" (time: "); |
| result.append(time); |
| result.append(", kind: "); |
| result.append(kind); |
| result.append(", color: "); |
| result.append(color); |
| result.append(", count: "); |
| result.append(count); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //EventImpl |