blob: e854cefdb618fb30dd1466e17489a808f9d0d06a [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2009, 2016 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.tesla.core.protocol.impl;
import org.eclipse.rcptt.tesla.core.protocol.Assert;
import org.eclipse.rcptt.tesla.core.protocol.AssertImageData;
import org.eclipse.rcptt.tesla.core.protocol.AssertKind;
import org.eclipse.rcptt.tesla.core.protocol.ProtocolPackage;
import org.eclipse.rcptt.tesla.core.protocol.raw.Element;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Assert</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.rcptt.tesla.core.protocol.impl.AssertImpl#getId <em>Id</em>}</li>
* <li>{@link org.eclipse.rcptt.tesla.core.protocol.impl.AssertImpl#getElement <em>Element</em>}</li>
* <li>{@link org.eclipse.rcptt.tesla.core.protocol.impl.AssertImpl#getAttribute <em>Attribute</em>}</li>
* <li>{@link org.eclipse.rcptt.tesla.core.protocol.impl.AssertImpl#getValue <em>Value</em>}</li>
* <li>{@link org.eclipse.rcptt.tesla.core.protocol.impl.AssertImpl#getKind <em>Kind</em>}</li>
* <li>{@link org.eclipse.rcptt.tesla.core.protocol.impl.AssertImpl#getIndex <em>Index</em>}</li>
* <li>{@link org.eclipse.rcptt.tesla.core.protocol.impl.AssertImpl#getCategory <em>Category</em>}</li>
* <li>{@link org.eclipse.rcptt.tesla.core.protocol.impl.AssertImpl#getValueType <em>Value Type</em>}</li>
* <li>{@link org.eclipse.rcptt.tesla.core.protocol.impl.AssertImpl#getImageData <em>Image Data</em>}</li>
* <li>{@link org.eclipse.rcptt.tesla.core.protocol.impl.AssertImpl#isShowIndex <em>Show Index</em>}</li>
* </ul>
*
* @generated
*/
public class AssertImpl extends EObjectImpl implements Assert {
/**
* The default value of the '{@link #getId() <em>Id</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getId()
* @generated
* @ordered
*/
protected static final int ID_EDEFAULT = 0;
/**
* The cached value of the '{@link #getId() <em>Id</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getId()
* @generated
* @ordered
*/
protected int id = ID_EDEFAULT;
/**
* The cached value of the '{@link #getElement() <em>Element</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getElement()
* @generated
* @ordered
*/
protected Element element;
/**
* The default value of the '{@link #getAttribute() <em>Attribute</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAttribute()
* @generated
* @ordered
*/
protected static final String ATTRIBUTE_EDEFAULT = null;
/**
* The cached value of the '{@link #getAttribute() <em>Attribute</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAttribute()
* @generated
* @ordered
*/
protected String attribute = ATTRIBUTE_EDEFAULT;
/**
* The default value of the '{@link #getValue() <em>Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getValue()
* @generated
* @ordered
*/
protected static final String VALUE_EDEFAULT = null;
/**
* The cached value of the '{@link #getValue() <em>Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getValue()
* @generated
* @ordered
*/
protected String value = VALUE_EDEFAULT;
/**
* The default value of the '{@link #getKind() <em>Kind</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getKind()
* @generated
* @ordered
*/
protected static final AssertKind KIND_EDEFAULT = AssertKind.EQUALS;
/**
* The cached value of the '{@link #getKind() <em>Kind</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getKind()
* @generated
* @ordered
*/
protected AssertKind kind = KIND_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;
/**
* The default value of the '{@link #getCategory() <em>Category</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getCategory()
* @generated
* @ordered
*/
protected static final String CATEGORY_EDEFAULT = null;
/**
* The cached value of the '{@link #getCategory() <em>Category</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getCategory()
* @generated
* @ordered
*/
protected String category = CATEGORY_EDEFAULT;
/**
* The cached value of the '{@link #getValueType() <em>Value Type</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getValueType()
* @generated
* @ordered
*/
protected EClassifier valueType;
/**
* The cached value of the '{@link #getImageData() <em>Image Data</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getImageData()
* @generated
* @ordered
*/
protected AssertImageData imageData;
/**
* The default value of the '{@link #isShowIndex() <em>Show Index</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isShowIndex()
* @generated
* @ordered
*/
protected static final boolean SHOW_INDEX_EDEFAULT = false;
/**
* The cached value of the '{@link #isShowIndex() <em>Show Index</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isShowIndex()
* @generated
* @ordered
*/
protected boolean showIndex = SHOW_INDEX_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected AssertImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return ProtocolPackage.Literals.ASSERT;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int getId() {
return id;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setId(int newId) {
int oldId = id;
id = newId;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ProtocolPackage.ASSERT__ID, oldId, id));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Element getElement() {
return element;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetElement(Element newElement, NotificationChain msgs) {
Element oldElement = element;
element = newElement;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ProtocolPackage.ASSERT__ELEMENT, oldElement, newElement);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setElement(Element newElement) {
if (newElement != element) {
NotificationChain msgs = null;
if (element != null)
msgs = ((InternalEObject)element).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ProtocolPackage.ASSERT__ELEMENT, null, msgs);
if (newElement != null)
msgs = ((InternalEObject)newElement).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ProtocolPackage.ASSERT__ELEMENT, null, msgs);
msgs = basicSetElement(newElement, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ProtocolPackage.ASSERT__ELEMENT, newElement, newElement));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getAttribute() {
return attribute;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setAttribute(String newAttribute) {
String oldAttribute = attribute;
attribute = newAttribute;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ProtocolPackage.ASSERT__ATTRIBUTE, oldAttribute, attribute));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getValue() {
return value;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setValue(String newValue) {
String oldValue = value;
value = newValue;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ProtocolPackage.ASSERT__VALUE, oldValue, value));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public AssertKind getKind() {
return kind;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setKind(AssertKind newKind) {
AssertKind oldKind = kind;
kind = newKind == null ? KIND_EDEFAULT : newKind;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ProtocolPackage.ASSERT__KIND, oldKind, kind));
}
/**
* <!-- 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.ASSERT__INDEX, oldIndex, index));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getCategory() {
return category;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setCategory(String newCategory) {
String oldCategory = category;
category = newCategory;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ProtocolPackage.ASSERT__CATEGORY, oldCategory, category));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClassifier getValueType() {
if (valueType != null && valueType.eIsProxy()) {
InternalEObject oldValueType = (InternalEObject)valueType;
valueType = (EClassifier)eResolveProxy(oldValueType);
if (valueType != oldValueType) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, ProtocolPackage.ASSERT__VALUE_TYPE, oldValueType, valueType));
}
}
return valueType;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClassifier basicGetValueType() {
return valueType;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setValueType(EClassifier newValueType) {
EClassifier oldValueType = valueType;
valueType = newValueType;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ProtocolPackage.ASSERT__VALUE_TYPE, oldValueType, valueType));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public AssertImageData getImageData() {
return imageData;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetImageData(AssertImageData newImageData, NotificationChain msgs) {
AssertImageData oldImageData = imageData;
imageData = newImageData;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ProtocolPackage.ASSERT__IMAGE_DATA, oldImageData, newImageData);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setImageData(AssertImageData newImageData) {
if (newImageData != imageData) {
NotificationChain msgs = null;
if (imageData != null)
msgs = ((InternalEObject)imageData).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ProtocolPackage.ASSERT__IMAGE_DATA, null, msgs);
if (newImageData != null)
msgs = ((InternalEObject)newImageData).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ProtocolPackage.ASSERT__IMAGE_DATA, null, msgs);
msgs = basicSetImageData(newImageData, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ProtocolPackage.ASSERT__IMAGE_DATA, newImageData, newImageData));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isShowIndex() {
return showIndex;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setShowIndex(boolean newShowIndex) {
boolean oldShowIndex = showIndex;
showIndex = newShowIndex;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ProtocolPackage.ASSERT__SHOW_INDEX, oldShowIndex, showIndex));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case ProtocolPackage.ASSERT__ELEMENT:
return basicSetElement(null, msgs);
case ProtocolPackage.ASSERT__IMAGE_DATA:
return basicSetImageData(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.ASSERT__ID:
return getId();
case ProtocolPackage.ASSERT__ELEMENT:
return getElement();
case ProtocolPackage.ASSERT__ATTRIBUTE:
return getAttribute();
case ProtocolPackage.ASSERT__VALUE:
return getValue();
case ProtocolPackage.ASSERT__KIND:
return getKind();
case ProtocolPackage.ASSERT__INDEX:
return getIndex();
case ProtocolPackage.ASSERT__CATEGORY:
return getCategory();
case ProtocolPackage.ASSERT__VALUE_TYPE:
if (resolve) return getValueType();
return basicGetValueType();
case ProtocolPackage.ASSERT__IMAGE_DATA:
return getImageData();
case ProtocolPackage.ASSERT__SHOW_INDEX:
return isShowIndex();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case ProtocolPackage.ASSERT__ID:
setId((Integer)newValue);
return;
case ProtocolPackage.ASSERT__ELEMENT:
setElement((Element)newValue);
return;
case ProtocolPackage.ASSERT__ATTRIBUTE:
setAttribute((String)newValue);
return;
case ProtocolPackage.ASSERT__VALUE:
setValue((String)newValue);
return;
case ProtocolPackage.ASSERT__KIND:
setKind((AssertKind)newValue);
return;
case ProtocolPackage.ASSERT__INDEX:
setIndex((Integer)newValue);
return;
case ProtocolPackage.ASSERT__CATEGORY:
setCategory((String)newValue);
return;
case ProtocolPackage.ASSERT__VALUE_TYPE:
setValueType((EClassifier)newValue);
return;
case ProtocolPackage.ASSERT__IMAGE_DATA:
setImageData((AssertImageData)newValue);
return;
case ProtocolPackage.ASSERT__SHOW_INDEX:
setShowIndex((Boolean)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case ProtocolPackage.ASSERT__ID:
setId(ID_EDEFAULT);
return;
case ProtocolPackage.ASSERT__ELEMENT:
setElement((Element)null);
return;
case ProtocolPackage.ASSERT__ATTRIBUTE:
setAttribute(ATTRIBUTE_EDEFAULT);
return;
case ProtocolPackage.ASSERT__VALUE:
setValue(VALUE_EDEFAULT);
return;
case ProtocolPackage.ASSERT__KIND:
setKind(KIND_EDEFAULT);
return;
case ProtocolPackage.ASSERT__INDEX:
setIndex(INDEX_EDEFAULT);
return;
case ProtocolPackage.ASSERT__CATEGORY:
setCategory(CATEGORY_EDEFAULT);
return;
case ProtocolPackage.ASSERT__VALUE_TYPE:
setValueType((EClassifier)null);
return;
case ProtocolPackage.ASSERT__IMAGE_DATA:
setImageData((AssertImageData)null);
return;
case ProtocolPackage.ASSERT__SHOW_INDEX:
setShowIndex(SHOW_INDEX_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case ProtocolPackage.ASSERT__ID:
return id != ID_EDEFAULT;
case ProtocolPackage.ASSERT__ELEMENT:
return element != null;
case ProtocolPackage.ASSERT__ATTRIBUTE:
return ATTRIBUTE_EDEFAULT == null ? attribute != null : !ATTRIBUTE_EDEFAULT.equals(attribute);
case ProtocolPackage.ASSERT__VALUE:
return VALUE_EDEFAULT == null ? value != null : !VALUE_EDEFAULT.equals(value);
case ProtocolPackage.ASSERT__KIND:
return kind != KIND_EDEFAULT;
case ProtocolPackage.ASSERT__INDEX:
return INDEX_EDEFAULT == null ? index != null : !INDEX_EDEFAULT.equals(index);
case ProtocolPackage.ASSERT__CATEGORY:
return CATEGORY_EDEFAULT == null ? category != null : !CATEGORY_EDEFAULT.equals(category);
case ProtocolPackage.ASSERT__VALUE_TYPE:
return valueType != null;
case ProtocolPackage.ASSERT__IMAGE_DATA:
return imageData != null;
case ProtocolPackage.ASSERT__SHOW_INDEX:
return showIndex != SHOW_INDEX_EDEFAULT;
}
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(" (id: ");
result.append(id);
result.append(", attribute: ");
result.append(attribute);
result.append(", value: ");
result.append(value);
result.append(", kind: ");
result.append(kind);
result.append(", index: ");
result.append(index);
result.append(", category: ");
result.append(category);
result.append(", showIndex: ");
result.append(showIndex);
result.append(')');
return result.toString();
}
} //AssertImpl