| /******************************************************************************* |
| * Copyright (c) 2009, 2019 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 v2.0 |
| * which accompanies this distribution, and is available at |
| * https://www.eclipse.org/legal/epl-v20.html |
| * |
| * Contributors: |
| * Xored Software Inc - initial API and implementation and/or initial documentation |
| *******************************************************************************/ |
| package org.eclipse.rcptt.tesla.core.protocol.impl; |
| |
| import org.eclipse.rcptt.tesla.core.protocol.ProtocolPackage; |
| import org.eclipse.rcptt.tesla.core.protocol.SelectData; |
| |
| import org.eclipse.rcptt.tesla.core.protocol.raw.Element; |
| |
| 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.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.EDataTypeEList; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Select Data</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.rcptt.tesla.core.protocol.impl.SelectDataImpl#getKind <em>Kind</em>}</li> |
| * <li>{@link org.eclipse.rcptt.tesla.core.protocol.impl.SelectDataImpl#getPattern <em>Pattern</em>}</li> |
| * <li>{@link org.eclipse.rcptt.tesla.core.protocol.impl.SelectDataImpl#getPath <em>Path</em>}</li> |
| * <li>{@link org.eclipse.rcptt.tesla.core.protocol.impl.SelectDataImpl#getIndex <em>Index</em>}</li> |
| * <li>{@link org.eclipse.rcptt.tesla.core.protocol.impl.SelectDataImpl#getMultiplicity <em>Multiplicity</em>}</li> |
| * <li>{@link org.eclipse.rcptt.tesla.core.protocol.impl.SelectDataImpl#getAfter <em>After</em>}</li> |
| * <li>{@link org.eclipse.rcptt.tesla.core.protocol.impl.SelectDataImpl#getParent <em>Parent</em>}</li> |
| * <li>{@link org.eclipse.rcptt.tesla.core.protocol.impl.SelectDataImpl#getClassPattern <em>Class Pattern</em>}</li> |
| * <li>{@link org.eclipse.rcptt.tesla.core.protocol.impl.SelectDataImpl#getIndexes <em>Indexes</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class SelectDataImpl extends EObjectImpl implements SelectData { |
| /** |
| * The default value of the '{@link #getKind() <em>Kind</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getKind() |
| * @generated |
| * @ordered |
| */ |
| protected static final String KIND_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getKind() <em>Kind</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getKind() |
| * @generated |
| * @ordered |
| */ |
| protected String kind = KIND_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #getPattern() <em>Pattern</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getPattern() |
| * @generated |
| * @ordered |
| */ |
| protected static final String PATTERN_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getPattern() <em>Pattern</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getPattern() |
| * @generated |
| * @ordered |
| */ |
| protected String pattern = PATTERN_EDEFAULT; |
| |
| /** |
| * The cached value of the '{@link #getPath() <em>Path</em>}' attribute list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getPath() |
| * @generated |
| * @ordered |
| */ |
| protected EList<String> path; |
| |
| /** |
| * The default value of the '{@link #getIndex() <em>Index</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getIndex() |
| * @generated |
| * @ordered |
| */ |
| protected static final Integer INDEX_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getIndex() <em>Index</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getIndex() |
| * @generated |
| * @ordered |
| */ |
| protected Integer index = INDEX_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #getMultiplicity() <em>Multiplicity</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getMultiplicity() |
| * @generated |
| * @ordered |
| */ |
| protected static final int MULTIPLICITY_EDEFAULT = 0; |
| |
| /** |
| * The cached value of the '{@link #getMultiplicity() <em>Multiplicity</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getMultiplicity() |
| * @generated |
| * @ordered |
| */ |
| protected int multiplicity = MULTIPLICITY_EDEFAULT; |
| |
| /** |
| * The cached value of the '{@link #getAfter() <em>After</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getAfter() |
| * @generated |
| * @ordered |
| */ |
| protected Element after; |
| |
| /** |
| * The cached value of the '{@link #getParent() <em>Parent</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getParent() |
| * @generated |
| * @ordered |
| */ |
| protected Element parent; |
| |
| /** |
| * The default value of the '{@link #getClassPattern() <em>Class Pattern</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getClassPattern() |
| * @generated |
| * @ordered |
| */ |
| protected static final String CLASS_PATTERN_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getClassPattern() <em>Class Pattern</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getClassPattern() |
| * @generated |
| * @ordered |
| */ |
| protected String classPattern = CLASS_PATTERN_EDEFAULT; |
| |
| /** |
| * The cached value of the '{@link #getIndexes() <em>Indexes</em>}' attribute list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getIndexes() |
| * @generated |
| * @ordered |
| */ |
| protected EList<Integer> indexes; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected SelectDataImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return ProtocolPackage.Literals.SELECT_DATA; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getKind() { |
| return kind; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setKind(String newKind) { |
| String oldKind = kind; |
| kind = newKind; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ProtocolPackage.SELECT_DATA__KIND, oldKind, kind)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getPattern() { |
| return pattern; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setPattern(String newPattern) { |
| String oldPattern = pattern; |
| pattern = newPattern; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ProtocolPackage.SELECT_DATA__PATTERN, oldPattern, pattern)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<String> getPath() { |
| if (path == null) { |
| path = new EDataTypeEList<String>(String.class, this, ProtocolPackage.SELECT_DATA__PATH); |
| } |
| return path; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Integer getIndex() { |
| return index; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setIndex(Integer newIndex) { |
| Integer oldIndex = index; |
| index = newIndex; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ProtocolPackage.SELECT_DATA__INDEX, oldIndex, index)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public int getMultiplicity() { |
| return multiplicity; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setMultiplicity(int newMultiplicity) { |
| int oldMultiplicity = multiplicity; |
| multiplicity = newMultiplicity; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ProtocolPackage.SELECT_DATA__MULTIPLICITY, oldMultiplicity, multiplicity)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Element getAfter() { |
| return after; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetAfter(Element newAfter, NotificationChain msgs) { |
| Element oldAfter = after; |
| after = newAfter; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ProtocolPackage.SELECT_DATA__AFTER, oldAfter, newAfter); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setAfter(Element newAfter) { |
| if (newAfter != after) { |
| NotificationChain msgs = null; |
| if (after != null) |
| msgs = ((InternalEObject)after).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ProtocolPackage.SELECT_DATA__AFTER, null, msgs); |
| if (newAfter != null) |
| msgs = ((InternalEObject)newAfter).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ProtocolPackage.SELECT_DATA__AFTER, null, msgs); |
| msgs = basicSetAfter(newAfter, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ProtocolPackage.SELECT_DATA__AFTER, newAfter, newAfter)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Element getParent() { |
| return parent; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetParent(Element newParent, NotificationChain msgs) { |
| Element oldParent = parent; |
| parent = newParent; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ProtocolPackage.SELECT_DATA__PARENT, oldParent, newParent); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setParent(Element newParent) { |
| if (newParent != parent) { |
| NotificationChain msgs = null; |
| if (parent != null) |
| msgs = ((InternalEObject)parent).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ProtocolPackage.SELECT_DATA__PARENT, null, msgs); |
| if (newParent != null) |
| msgs = ((InternalEObject)newParent).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ProtocolPackage.SELECT_DATA__PARENT, null, msgs); |
| msgs = basicSetParent(newParent, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ProtocolPackage.SELECT_DATA__PARENT, newParent, newParent)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getClassPattern() { |
| return classPattern; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setClassPattern(String newClassPattern) { |
| String oldClassPattern = classPattern; |
| classPattern = newClassPattern; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ProtocolPackage.SELECT_DATA__CLASS_PATTERN, oldClassPattern, classPattern)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<Integer> getIndexes() { |
| if (indexes == null) { |
| indexes = new EDataTypeEList<Integer>(Integer.class, this, ProtocolPackage.SELECT_DATA__INDEXES); |
| } |
| return indexes; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case ProtocolPackage.SELECT_DATA__AFTER: |
| return basicSetAfter(null, msgs); |
| case ProtocolPackage.SELECT_DATA__PARENT: |
| return basicSetParent(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 ProtocolPackage.SELECT_DATA__KIND: |
| return getKind(); |
| case ProtocolPackage.SELECT_DATA__PATTERN: |
| return getPattern(); |
| case ProtocolPackage.SELECT_DATA__PATH: |
| return getPath(); |
| case ProtocolPackage.SELECT_DATA__INDEX: |
| return getIndex(); |
| case ProtocolPackage.SELECT_DATA__MULTIPLICITY: |
| return getMultiplicity(); |
| case ProtocolPackage.SELECT_DATA__AFTER: |
| return getAfter(); |
| case ProtocolPackage.SELECT_DATA__PARENT: |
| return getParent(); |
| case ProtocolPackage.SELECT_DATA__CLASS_PATTERN: |
| return getClassPattern(); |
| case ProtocolPackage.SELECT_DATA__INDEXES: |
| return getIndexes(); |
| } |
| 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 ProtocolPackage.SELECT_DATA__KIND: |
| setKind((String)newValue); |
| return; |
| case ProtocolPackage.SELECT_DATA__PATTERN: |
| setPattern((String)newValue); |
| return; |
| case ProtocolPackage.SELECT_DATA__PATH: |
| getPath().clear(); |
| getPath().addAll((Collection<? extends String>)newValue); |
| return; |
| case ProtocolPackage.SELECT_DATA__INDEX: |
| setIndex((Integer)newValue); |
| return; |
| case ProtocolPackage.SELECT_DATA__MULTIPLICITY: |
| setMultiplicity((Integer)newValue); |
| return; |
| case ProtocolPackage.SELECT_DATA__AFTER: |
| setAfter((Element)newValue); |
| return; |
| case ProtocolPackage.SELECT_DATA__PARENT: |
| setParent((Element)newValue); |
| return; |
| case ProtocolPackage.SELECT_DATA__CLASS_PATTERN: |
| setClassPattern((String)newValue); |
| return; |
| case ProtocolPackage.SELECT_DATA__INDEXES: |
| getIndexes().clear(); |
| getIndexes().addAll((Collection<? extends Integer>)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case ProtocolPackage.SELECT_DATA__KIND: |
| setKind(KIND_EDEFAULT); |
| return; |
| case ProtocolPackage.SELECT_DATA__PATTERN: |
| setPattern(PATTERN_EDEFAULT); |
| return; |
| case ProtocolPackage.SELECT_DATA__PATH: |
| getPath().clear(); |
| return; |
| case ProtocolPackage.SELECT_DATA__INDEX: |
| setIndex(INDEX_EDEFAULT); |
| return; |
| case ProtocolPackage.SELECT_DATA__MULTIPLICITY: |
| setMultiplicity(MULTIPLICITY_EDEFAULT); |
| return; |
| case ProtocolPackage.SELECT_DATA__AFTER: |
| setAfter((Element)null); |
| return; |
| case ProtocolPackage.SELECT_DATA__PARENT: |
| setParent((Element)null); |
| return; |
| case ProtocolPackage.SELECT_DATA__CLASS_PATTERN: |
| setClassPattern(CLASS_PATTERN_EDEFAULT); |
| return; |
| case ProtocolPackage.SELECT_DATA__INDEXES: |
| getIndexes().clear(); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case ProtocolPackage.SELECT_DATA__KIND: |
| return KIND_EDEFAULT == null ? kind != null : !KIND_EDEFAULT.equals(kind); |
| case ProtocolPackage.SELECT_DATA__PATTERN: |
| return PATTERN_EDEFAULT == null ? pattern != null : !PATTERN_EDEFAULT.equals(pattern); |
| case ProtocolPackage.SELECT_DATA__PATH: |
| return path != null && !path.isEmpty(); |
| case ProtocolPackage.SELECT_DATA__INDEX: |
| return INDEX_EDEFAULT == null ? index != null : !INDEX_EDEFAULT.equals(index); |
| case ProtocolPackage.SELECT_DATA__MULTIPLICITY: |
| return multiplicity != MULTIPLICITY_EDEFAULT; |
| case ProtocolPackage.SELECT_DATA__AFTER: |
| return after != null; |
| case ProtocolPackage.SELECT_DATA__PARENT: |
| return parent != null; |
| case ProtocolPackage.SELECT_DATA__CLASS_PATTERN: |
| return CLASS_PATTERN_EDEFAULT == null ? classPattern != null : !CLASS_PATTERN_EDEFAULT.equals(classPattern); |
| case ProtocolPackage.SELECT_DATA__INDEXES: |
| return indexes != null && !indexes.isEmpty(); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public String toString() { |
| if (eIsProxy()) return super.toString(); |
| |
| StringBuilder result = new StringBuilder(super.toString()); |
| result.append(" (kind: "); |
| result.append(kind); |
| result.append(", pattern: "); |
| result.append(pattern); |
| result.append(", path: "); |
| result.append(path); |
| result.append(", index: "); |
| result.append(index); |
| result.append(", multiplicity: "); |
| result.append(multiplicity); |
| result.append(", classPattern: "); |
| result.append(classPattern); |
| result.append(", indexes: "); |
| result.append(indexes); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //SelectDataImpl |