blob: a29cfb20680e6c7f8675f8ada4f5c1e3fc5a2f18 [file] [log] [blame]
/*******************************************************************************
* 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.MultiSelectionItem;
import org.eclipse.rcptt.tesla.core.protocol.ProtocolPackage;
import java.util.Collection;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
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>Multi Selection Item</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.rcptt.tesla.core.protocol.impl.MultiSelectionItemImpl#getPath <em>Path</em>}</li>
* <li>{@link org.eclipse.rcptt.tesla.core.protocol.impl.MultiSelectionItemImpl#getPattern <em>Pattern</em>}</li>
* <li>{@link org.eclipse.rcptt.tesla.core.protocol.impl.MultiSelectionItemImpl#getIndex <em>Index</em>}</li>
* </ul>
*
* @generated
*/
public class MultiSelectionItemImpl extends EObjectImpl implements MultiSelectionItem {
/**
* 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 #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 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;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected MultiSelectionItemImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return ProtocolPackage.Literals.MULTI_SELECTION_ITEM;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<String> getPath() {
if (path == null) {
path = new EDataTypeEList<String>(String.class, this, ProtocolPackage.MULTI_SELECTION_ITEM__PATH);
}
return path;
}
/**
* <!-- 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.MULTI_SELECTION_ITEM__PATTERN, oldPattern, pattern));
}
/**
* <!-- 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.MULTI_SELECTION_ITEM__INDEX, oldIndex, index));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case ProtocolPackage.MULTI_SELECTION_ITEM__PATH:
return getPath();
case ProtocolPackage.MULTI_SELECTION_ITEM__PATTERN:
return getPattern();
case ProtocolPackage.MULTI_SELECTION_ITEM__INDEX:
return getIndex();
}
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.MULTI_SELECTION_ITEM__PATH:
getPath().clear();
getPath().addAll((Collection<? extends String>)newValue);
return;
case ProtocolPackage.MULTI_SELECTION_ITEM__PATTERN:
setPattern((String)newValue);
return;
case ProtocolPackage.MULTI_SELECTION_ITEM__INDEX:
setIndex((Integer)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case ProtocolPackage.MULTI_SELECTION_ITEM__PATH:
getPath().clear();
return;
case ProtocolPackage.MULTI_SELECTION_ITEM__PATTERN:
setPattern(PATTERN_EDEFAULT);
return;
case ProtocolPackage.MULTI_SELECTION_ITEM__INDEX:
setIndex(INDEX_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case ProtocolPackage.MULTI_SELECTION_ITEM__PATH:
return path != null && !path.isEmpty();
case ProtocolPackage.MULTI_SELECTION_ITEM__PATTERN:
return PATTERN_EDEFAULT == null ? pattern != null : !PATTERN_EDEFAULT.equals(pattern);
case ProtocolPackage.MULTI_SELECTION_ITEM__INDEX:
return INDEX_EDEFAULT == null ? index != null : !INDEX_EDEFAULT.equals(index);
}
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(" (path: ");
result.append(path);
result.append(", pattern: ");
result.append(pattern);
result.append(", index: ");
result.append(index);
result.append(')');
return result.toString();
}
} //MultiSelectionItemImpl