| /******************************************************************************* |
| * 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 java.util.Collection; |
| |
| 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.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.EObjectContainmentEList; |
| import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList; |
| import org.eclipse.emf.ecore.util.EcoreEMap; |
| import org.eclipse.emf.ecore.util.EcoreUtil; |
| 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.Node; |
| import org.eclipse.rcptt.sherlock.core.model.sherlock.report.Report; |
| 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>Node</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.rcptt.sherlock.core.model.sherlock.report.impl.NodeImpl#getStartTime <em>Start Time</em>}</li> |
| * <li>{@link org.eclipse.rcptt.sherlock.core.model.sherlock.report.impl.NodeImpl#getEndTime <em>End Time</em>}</li> |
| * <li>{@link org.eclipse.rcptt.sherlock.core.model.sherlock.report.impl.NodeImpl#getChildren <em>Children</em>}</li> |
| * <li>{@link org.eclipse.rcptt.sherlock.core.model.sherlock.report.impl.NodeImpl#getEvents <em>Events</em>}</li> |
| * <li>{@link org.eclipse.rcptt.sherlock.core.model.sherlock.report.impl.NodeImpl#getName <em>Name</em>}</li> |
| * <li>{@link org.eclipse.rcptt.sherlock.core.model.sherlock.report.impl.NodeImpl#getProperties <em>Properties</em>}</li> |
| * <li>{@link org.eclipse.rcptt.sherlock.core.model.sherlock.report.impl.NodeImpl#getParent <em>Parent</em>}</li> |
| * <li>{@link org.eclipse.rcptt.sherlock.core.model.sherlock.report.impl.NodeImpl#getReport <em>Report</em>}</li> |
| * <li>{@link org.eclipse.rcptt.sherlock.core.model.sherlock.report.impl.NodeImpl#getSnapshots <em>Snapshots</em>}</li> |
| * <li>{@link org.eclipse.rcptt.sherlock.core.model.sherlock.report.impl.NodeImpl#getDuration <em>Duration</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class NodeImpl extends EObjectImpl implements Node { |
| /** |
| * The default value of the '{@link #getStartTime() <em>Start Time</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getStartTime() |
| * @generated |
| * @ordered |
| */ |
| protected static final long START_TIME_EDEFAULT = 0L; |
| |
| /** |
| * The cached value of the '{@link #getStartTime() <em>Start Time</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getStartTime() |
| * @generated |
| * @ordered |
| */ |
| protected long startTime = START_TIME_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #getEndTime() <em>End Time</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getEndTime() |
| * @generated |
| * @ordered |
| */ |
| protected static final long END_TIME_EDEFAULT = 0L; |
| |
| /** |
| * The cached value of the '{@link #getEndTime() <em>End Time</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getEndTime() |
| * @generated |
| * @ordered |
| */ |
| protected long endTime = END_TIME_EDEFAULT; |
| |
| /** |
| * The cached value of the '{@link #getChildren() <em>Children</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getChildren() |
| * @generated |
| * @ordered |
| */ |
| protected EList<Node> children; |
| |
| /** |
| * The cached value of the '{@link #getEvents() <em>Events</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getEvents() |
| * @generated |
| * @ordered |
| */ |
| protected EList<Event> events; |
| |
| /** |
| * 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; |
| |
| /** |
| * 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 #getSnapshots() <em>Snapshots</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getSnapshots() |
| * @generated |
| * @ordered |
| */ |
| protected EList<Snaphot> snapshots; |
| |
| /** |
| * The default value of the '{@link #getDuration() <em>Duration</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getDuration() |
| * @generated |
| * @ordered |
| */ |
| protected static final long DURATION_EDEFAULT = 0L; |
| |
| /** |
| * The cached value of the '{@link #getDuration() <em>Duration</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getDuration() |
| * @generated |
| * @ordered |
| */ |
| protected long duration = DURATION_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected NodeImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return ReportPackage.Literals.NODE; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public long getStartTime() { |
| return startTime; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setStartTime(long newStartTime) { |
| long oldStartTime = startTime; |
| startTime = newStartTime; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ReportPackage.NODE__START_TIME, oldStartTime, startTime)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public long getEndTime() { |
| return endTime; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setEndTime(long newEndTime) { |
| long oldEndTime = endTime; |
| endTime = newEndTime; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ReportPackage.NODE__END_TIME, oldEndTime, endTime)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<Node> getChildren() { |
| if (children == null) { |
| children = new EObjectContainmentWithInverseEList<Node>(Node.class, this, ReportPackage.NODE__CHILDREN, ReportPackage.NODE__PARENT); |
| } |
| return children; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<Event> getEvents() { |
| if (events == null) { |
| events = new EObjectContainmentEList<Event>(Event.class, this, ReportPackage.NODE__EVENTS); |
| } |
| return events; |
| } |
| |
| /** |
| * <!-- 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, ReportPackage.NODE__NAME, oldName, name)); |
| } |
| |
| /** |
| * <!-- 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.NODE__PROPERTIES); |
| } |
| return properties; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Node getParent() { |
| if (eContainerFeatureID() != ReportPackage.NODE__PARENT) return null; |
| return (Node)eInternalContainer(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetParent(Node newParent, NotificationChain msgs) { |
| msgs = eBasicSetContainer((InternalEObject)newParent, ReportPackage.NODE__PARENT, msgs); |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setParent(Node newParent) { |
| if (newParent != eInternalContainer() || (eContainerFeatureID() != ReportPackage.NODE__PARENT && newParent != null)) { |
| if (EcoreUtil.isAncestor(this, newParent)) |
| throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); |
| NotificationChain msgs = null; |
| if (eInternalContainer() != null) |
| msgs = eBasicRemoveFromContainer(msgs); |
| if (newParent != null) |
| msgs = ((InternalEObject)newParent).eInverseAdd(this, ReportPackage.NODE__CHILDREN, Node.class, msgs); |
| msgs = basicSetParent(newParent, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ReportPackage.NODE__PARENT, newParent, newParent)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Report getReport() { |
| if (eContainerFeatureID() != ReportPackage.NODE__REPORT) return null; |
| return (Report)eInternalContainer(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetReport(Report newReport, NotificationChain msgs) { |
| msgs = eBasicSetContainer((InternalEObject)newReport, ReportPackage.NODE__REPORT, msgs); |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setReport(Report newReport) { |
| if (newReport != eInternalContainer() || (eContainerFeatureID() != ReportPackage.NODE__REPORT && newReport != null)) { |
| if (EcoreUtil.isAncestor(this, newReport)) |
| throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); |
| NotificationChain msgs = null; |
| if (eInternalContainer() != null) |
| msgs = eBasicRemoveFromContainer(msgs); |
| if (newReport != null) |
| msgs = ((InternalEObject)newReport).eInverseAdd(this, ReportPackage.REPORT__ROOT, Report.class, msgs); |
| msgs = basicSetReport(newReport, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ReportPackage.NODE__REPORT, newReport, newReport)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<Snaphot> getSnapshots() { |
| if (snapshots == null) { |
| snapshots = new EObjectContainmentEList<Snaphot>(Snaphot.class, this, ReportPackage.NODE__SNAPSHOTS); |
| } |
| return snapshots; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public long getDuration() { |
| return duration; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setDuration(long newDuration) { |
| long oldDuration = duration; |
| duration = newDuration; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ReportPackage.NODE__DURATION, oldDuration, duration)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @SuppressWarnings("unchecked") |
| @Override |
| public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case ReportPackage.NODE__CHILDREN: |
| return ((InternalEList<InternalEObject>)(InternalEList<?>)getChildren()).basicAdd(otherEnd, msgs); |
| case ReportPackage.NODE__PARENT: |
| if (eInternalContainer() != null) |
| msgs = eBasicRemoveFromContainer(msgs); |
| return basicSetParent((Node)otherEnd, msgs); |
| case ReportPackage.NODE__REPORT: |
| if (eInternalContainer() != null) |
| msgs = eBasicRemoveFromContainer(msgs); |
| return basicSetReport((Report)otherEnd, msgs); |
| } |
| return super.eInverseAdd(otherEnd, featureID, msgs); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case ReportPackage.NODE__CHILDREN: |
| return ((InternalEList<?>)getChildren()).basicRemove(otherEnd, msgs); |
| case ReportPackage.NODE__EVENTS: |
| return ((InternalEList<?>)getEvents()).basicRemove(otherEnd, msgs); |
| case ReportPackage.NODE__PROPERTIES: |
| return ((InternalEList<?>)getProperties()).basicRemove(otherEnd, msgs); |
| case ReportPackage.NODE__PARENT: |
| return basicSetParent(null, msgs); |
| case ReportPackage.NODE__REPORT: |
| return basicSetReport(null, msgs); |
| case ReportPackage.NODE__SNAPSHOTS: |
| return ((InternalEList<?>)getSnapshots()).basicRemove(otherEnd, msgs); |
| } |
| return super.eInverseRemove(otherEnd, featureID, msgs); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { |
| switch (eContainerFeatureID()) { |
| case ReportPackage.NODE__PARENT: |
| return eInternalContainer().eInverseRemove(this, ReportPackage.NODE__CHILDREN, Node.class, msgs); |
| case ReportPackage.NODE__REPORT: |
| return eInternalContainer().eInverseRemove(this, ReportPackage.REPORT__ROOT, Report.class, msgs); |
| } |
| return super.eBasicRemoveFromContainerFeature(msgs); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case ReportPackage.NODE__START_TIME: |
| return getStartTime(); |
| case ReportPackage.NODE__END_TIME: |
| return getEndTime(); |
| case ReportPackage.NODE__CHILDREN: |
| return getChildren(); |
| case ReportPackage.NODE__EVENTS: |
| return getEvents(); |
| case ReportPackage.NODE__NAME: |
| return getName(); |
| case ReportPackage.NODE__PROPERTIES: |
| if (coreType) return getProperties(); |
| else return getProperties().map(); |
| case ReportPackage.NODE__PARENT: |
| return getParent(); |
| case ReportPackage.NODE__REPORT: |
| return getReport(); |
| case ReportPackage.NODE__SNAPSHOTS: |
| return getSnapshots(); |
| case ReportPackage.NODE__DURATION: |
| return getDuration(); |
| } |
| 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 ReportPackage.NODE__START_TIME: |
| setStartTime((Long)newValue); |
| return; |
| case ReportPackage.NODE__END_TIME: |
| setEndTime((Long)newValue); |
| return; |
| case ReportPackage.NODE__CHILDREN: |
| getChildren().clear(); |
| getChildren().addAll((Collection<? extends Node>)newValue); |
| return; |
| case ReportPackage.NODE__EVENTS: |
| getEvents().clear(); |
| getEvents().addAll((Collection<? extends Event>)newValue); |
| return; |
| case ReportPackage.NODE__NAME: |
| setName((String)newValue); |
| return; |
| case ReportPackage.NODE__PROPERTIES: |
| ((EStructuralFeature.Setting)getProperties()).set(newValue); |
| return; |
| case ReportPackage.NODE__PARENT: |
| setParent((Node)newValue); |
| return; |
| case ReportPackage.NODE__REPORT: |
| setReport((Report)newValue); |
| return; |
| case ReportPackage.NODE__SNAPSHOTS: |
| getSnapshots().clear(); |
| getSnapshots().addAll((Collection<? extends Snaphot>)newValue); |
| return; |
| case ReportPackage.NODE__DURATION: |
| setDuration((Long)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case ReportPackage.NODE__START_TIME: |
| setStartTime(START_TIME_EDEFAULT); |
| return; |
| case ReportPackage.NODE__END_TIME: |
| setEndTime(END_TIME_EDEFAULT); |
| return; |
| case ReportPackage.NODE__CHILDREN: |
| getChildren().clear(); |
| return; |
| case ReportPackage.NODE__EVENTS: |
| getEvents().clear(); |
| return; |
| case ReportPackage.NODE__NAME: |
| setName(NAME_EDEFAULT); |
| return; |
| case ReportPackage.NODE__PROPERTIES: |
| getProperties().clear(); |
| return; |
| case ReportPackage.NODE__PARENT: |
| setParent((Node)null); |
| return; |
| case ReportPackage.NODE__REPORT: |
| setReport((Report)null); |
| return; |
| case ReportPackage.NODE__SNAPSHOTS: |
| getSnapshots().clear(); |
| return; |
| case ReportPackage.NODE__DURATION: |
| setDuration(DURATION_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case ReportPackage.NODE__START_TIME: |
| return startTime != START_TIME_EDEFAULT; |
| case ReportPackage.NODE__END_TIME: |
| return endTime != END_TIME_EDEFAULT; |
| case ReportPackage.NODE__CHILDREN: |
| return children != null && !children.isEmpty(); |
| case ReportPackage.NODE__EVENTS: |
| return events != null && !events.isEmpty(); |
| case ReportPackage.NODE__NAME: |
| return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); |
| case ReportPackage.NODE__PROPERTIES: |
| return properties != null && !properties.isEmpty(); |
| case ReportPackage.NODE__PARENT: |
| return getParent() != null; |
| case ReportPackage.NODE__REPORT: |
| return getReport() != null; |
| case ReportPackage.NODE__SNAPSHOTS: |
| return snapshots != null && !snapshots.isEmpty(); |
| case ReportPackage.NODE__DURATION: |
| return duration != DURATION_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(" (startTime: "); |
| result.append(startTime); |
| result.append(", endTime: "); |
| result.append(endTime); |
| result.append(", name: "); |
| result.append(name); |
| result.append(", duration: "); |
| result.append(duration); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //NodeImpl |