blob: ef39eeda77b96330884d9d8a467a47db7acf8e7f [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.HoverAtText;
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.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>Hover At Text</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.rcptt.tesla.core.protocol.impl.HoverAtTextImpl#getId <em>Id</em>}</li>
* <li>{@link org.eclipse.rcptt.tesla.core.protocol.impl.HoverAtTextImpl#getElement <em>Element</em>}</li>
* <li>{@link org.eclipse.rcptt.tesla.core.protocol.impl.HoverAtTextImpl#getLine <em>Line</em>}</li>
* <li>{@link org.eclipse.rcptt.tesla.core.protocol.impl.HoverAtTextImpl#getOffset <em>Offset</em>}</li>
* <li>{@link org.eclipse.rcptt.tesla.core.protocol.impl.HoverAtTextImpl#getStateMask <em>State Mask</em>}</li>
* </ul>
*
* @generated
*/
public class HoverAtTextImpl extends EObjectImpl implements HoverAtText {
/**
* 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 #getLine() <em>Line</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLine()
* @generated
* @ordered
*/
protected static final int LINE_EDEFAULT = -1;
/**
* The cached value of the '{@link #getLine() <em>Line</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLine()
* @generated
* @ordered
*/
protected int line = LINE_EDEFAULT;
/**
* The default value of the '{@link #getOffset() <em>Offset</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOffset()
* @generated
* @ordered
*/
protected static final int OFFSET_EDEFAULT = 0;
/**
* The cached value of the '{@link #getOffset() <em>Offset</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOffset()
* @generated
* @ordered
*/
protected int offset = OFFSET_EDEFAULT;
/**
* The default value of the '{@link #getStateMask() <em>State Mask</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getStateMask()
* @generated
* @ordered
*/
protected static final int STATE_MASK_EDEFAULT = 0;
/**
* The cached value of the '{@link #getStateMask() <em>State Mask</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getStateMask()
* @generated
* @ordered
*/
protected int stateMask = STATE_MASK_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected HoverAtTextImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return ProtocolPackage.Literals.HOVER_AT_TEXT;
}
/**
* <!-- 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.HOVER_AT_TEXT__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.HOVER_AT_TEXT__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.HOVER_AT_TEXT__ELEMENT, null, msgs);
if (newElement != null)
msgs = ((InternalEObject)newElement).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ProtocolPackage.HOVER_AT_TEXT__ELEMENT, null, msgs);
msgs = basicSetElement(newElement, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ProtocolPackage.HOVER_AT_TEXT__ELEMENT, newElement, newElement));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int getLine() {
return line;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setLine(int newLine) {
int oldLine = line;
line = newLine;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ProtocolPackage.HOVER_AT_TEXT__LINE, oldLine, line));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int getOffset() {
return offset;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setOffset(int newOffset) {
int oldOffset = offset;
offset = newOffset;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ProtocolPackage.HOVER_AT_TEXT__OFFSET, oldOffset, offset));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int getStateMask() {
return stateMask;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setStateMask(int newStateMask) {
int oldStateMask = stateMask;
stateMask = newStateMask;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ProtocolPackage.HOVER_AT_TEXT__STATE_MASK, oldStateMask, stateMask));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case ProtocolPackage.HOVER_AT_TEXT__ELEMENT:
return basicSetElement(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.HOVER_AT_TEXT__ID:
return getId();
case ProtocolPackage.HOVER_AT_TEXT__ELEMENT:
return getElement();
case ProtocolPackage.HOVER_AT_TEXT__LINE:
return getLine();
case ProtocolPackage.HOVER_AT_TEXT__OFFSET:
return getOffset();
case ProtocolPackage.HOVER_AT_TEXT__STATE_MASK:
return getStateMask();
}
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.HOVER_AT_TEXT__ID:
setId((Integer)newValue);
return;
case ProtocolPackage.HOVER_AT_TEXT__ELEMENT:
setElement((Element)newValue);
return;
case ProtocolPackage.HOVER_AT_TEXT__LINE:
setLine((Integer)newValue);
return;
case ProtocolPackage.HOVER_AT_TEXT__OFFSET:
setOffset((Integer)newValue);
return;
case ProtocolPackage.HOVER_AT_TEXT__STATE_MASK:
setStateMask((Integer)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case ProtocolPackage.HOVER_AT_TEXT__ID:
setId(ID_EDEFAULT);
return;
case ProtocolPackage.HOVER_AT_TEXT__ELEMENT:
setElement((Element)null);
return;
case ProtocolPackage.HOVER_AT_TEXT__LINE:
setLine(LINE_EDEFAULT);
return;
case ProtocolPackage.HOVER_AT_TEXT__OFFSET:
setOffset(OFFSET_EDEFAULT);
return;
case ProtocolPackage.HOVER_AT_TEXT__STATE_MASK:
setStateMask(STATE_MASK_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case ProtocolPackage.HOVER_AT_TEXT__ID:
return id != ID_EDEFAULT;
case ProtocolPackage.HOVER_AT_TEXT__ELEMENT:
return element != null;
case ProtocolPackage.HOVER_AT_TEXT__LINE:
return line != LINE_EDEFAULT;
case ProtocolPackage.HOVER_AT_TEXT__OFFSET:
return offset != OFFSET_EDEFAULT;
case ProtocolPackage.HOVER_AT_TEXT__STATE_MASK:
return stateMask != STATE_MASK_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(", line: ");
result.append(line);
result.append(", offset: ");
result.append(offset);
result.append(", stateMask: ");
result.append(stateMask);
result.append(')');
return result.toString();
}
} //HoverAtTextImpl