| /******************************************************************************* |
| * 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.ReportPackage; |
| import org.eclipse.rcptt.sherlock.core.model.sherlock.report.Snaphot; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Snaphot</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.rcptt.sherlock.core.model.sherlock.report.impl.SnaphotImpl#getTime <em>Time</em>}</li> |
| * <li>{@link org.eclipse.rcptt.sherlock.core.model.sherlock.report.impl.SnaphotImpl#getProperties <em>Properties</em>}</li> |
| * <li>{@link org.eclipse.rcptt.sherlock.core.model.sherlock.report.impl.SnaphotImpl#getData <em>Data</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class SnaphotImpl extends EObjectImpl implements Snaphot { |
| /** |
| * 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; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected SnaphotImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return ReportPackage.Literals.SNAPHOT; |
| } |
| |
| /** |
| * <!-- 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.SNAPHOT__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.SNAPHOT__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.SNAPHOT__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.SNAPHOT__DATA, null, msgs); |
| if (newData != null) |
| msgs = ((InternalEObject)newData).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ReportPackage.SNAPHOT__DATA, null, msgs); |
| msgs = basicSetData(newData, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ReportPackage.SNAPHOT__DATA, newData, newData)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case ReportPackage.SNAPHOT__PROPERTIES: |
| return ((InternalEList<?>)getProperties()).basicRemove(otherEnd, msgs); |
| case ReportPackage.SNAPHOT__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.SNAPHOT__TIME: |
| return getTime(); |
| case ReportPackage.SNAPHOT__PROPERTIES: |
| if (coreType) return getProperties(); |
| else return getProperties().map(); |
| case ReportPackage.SNAPHOT__DATA: |
| return getData(); |
| } |
| 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.SNAPHOT__TIME: |
| setTime((Long)newValue); |
| return; |
| case ReportPackage.SNAPHOT__PROPERTIES: |
| ((EStructuralFeature.Setting)getProperties()).set(newValue); |
| return; |
| case ReportPackage.SNAPHOT__DATA: |
| setData((EObject)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case ReportPackage.SNAPHOT__TIME: |
| setTime(TIME_EDEFAULT); |
| return; |
| case ReportPackage.SNAPHOT__PROPERTIES: |
| getProperties().clear(); |
| return; |
| case ReportPackage.SNAPHOT__DATA: |
| setData((EObject)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case ReportPackage.SNAPHOT__TIME: |
| return time != TIME_EDEFAULT; |
| case ReportPackage.SNAPHOT__PROPERTIES: |
| return properties != null && !properties.isEmpty(); |
| case ReportPackage.SNAPHOT__DATA: |
| return data != 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(" (time: "); |
| result.append(time); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //SnaphotImpl |