All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.eclipse.xtext.impl.AbstractRuleImpl Maven / Gradle / Ivy

There is a newer version: 2.4.3
Show newest version
/**
 * 
 * 
 *
 * $Id: AbstractRuleImpl.java,v 1.18 2010/04/06 14:09:56 sefftinge Exp $
 */
package org.eclipse.xtext.impl;

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.MinimalEObjectImpl;

import org.eclipse.xtext.AbstractElement;
import org.eclipse.xtext.AbstractRule;
import org.eclipse.xtext.TypeRef;
import org.eclipse.xtext.XtextPackage;

/**
 * 
 * An implementation of the model object 'Abstract Rule'.
 * 
 * 

* The following features are implemented: *

    *
  • {@link org.eclipse.xtext.impl.AbstractRuleImpl#getName Name}
  • *
  • {@link org.eclipse.xtext.impl.AbstractRuleImpl#getType Type}
  • *
  • {@link org.eclipse.xtext.impl.AbstractRuleImpl#getAlternatives Alternatives}
  • *
*

* * @generated */ public class AbstractRuleImpl extends MinimalEObjectImpl.Container implements AbstractRule { /** * The default value of the '{@link #getName() Name}' attribute. * * * @see #getName() * @generated * @ordered */ protected static final String NAME_EDEFAULT = null; /** * The cached value of the '{@link #getName() Name}' attribute. * * * @see #getName() * @generated * @ordered */ protected String name = NAME_EDEFAULT; /** * The cached value of the '{@link #getType() Type}' containment reference. * * * @see #getType() * @generated * @ordered */ protected TypeRef type; /** * The cached value of the '{@link #getAlternatives() Alternatives}' containment reference. * * * @see #getAlternatives() * @generated * @ordered */ protected AbstractElement alternatives; /** * * * @generated */ protected AbstractRuleImpl() { super(); } /** * * * @generated */ @Override protected EClass eStaticClass() { return XtextPackage.Literals.ABSTRACT_RULE; } /** * * * @generated */ public String getName() { return name; } /** * * * @generated */ public void setName(String newName) { String oldName = name; name = newName; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, XtextPackage.ABSTRACT_RULE__NAME, oldName, name)); } /** * * * @generated */ public TypeRef getType() { return type; } /** * * * @generated */ public NotificationChain basicSetType(TypeRef newType, NotificationChain msgs) { TypeRef oldType = type; type = newType; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, XtextPackage.ABSTRACT_RULE__TYPE, oldType, newType); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * * * @generated */ public void setType(TypeRef newType) { if (newType != type) { NotificationChain msgs = null; if (type != null) msgs = ((InternalEObject)type).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XtextPackage.ABSTRACT_RULE__TYPE, null, msgs); if (newType != null) msgs = ((InternalEObject)newType).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XtextPackage.ABSTRACT_RULE__TYPE, null, msgs); msgs = basicSetType(newType, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, XtextPackage.ABSTRACT_RULE__TYPE, newType, newType)); } /** * * * @generated */ public AbstractElement getAlternatives() { return alternatives; } /** * * * @generated */ public NotificationChain basicSetAlternatives(AbstractElement newAlternatives, NotificationChain msgs) { AbstractElement oldAlternatives = alternatives; alternatives = newAlternatives; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, XtextPackage.ABSTRACT_RULE__ALTERNATIVES, oldAlternatives, newAlternatives); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * * * @generated */ public void setAlternatives(AbstractElement newAlternatives) { if (newAlternatives != alternatives) { NotificationChain msgs = null; if (alternatives != null) msgs = ((InternalEObject)alternatives).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XtextPackage.ABSTRACT_RULE__ALTERNATIVES, null, msgs); if (newAlternatives != null) msgs = ((InternalEObject)newAlternatives).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XtextPackage.ABSTRACT_RULE__ALTERNATIVES, null, msgs); msgs = basicSetAlternatives(newAlternatives, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, XtextPackage.ABSTRACT_RULE__ALTERNATIVES, newAlternatives, newAlternatives)); } /** * * * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case XtextPackage.ABSTRACT_RULE__TYPE: return basicSetType(null, msgs); case XtextPackage.ABSTRACT_RULE__ALTERNATIVES: return basicSetAlternatives(null, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * * * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case XtextPackage.ABSTRACT_RULE__NAME: return getName(); case XtextPackage.ABSTRACT_RULE__TYPE: return getType(); case XtextPackage.ABSTRACT_RULE__ALTERNATIVES: return getAlternatives(); } return super.eGet(featureID, resolve, coreType); } /** * * * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case XtextPackage.ABSTRACT_RULE__NAME: setName((String)newValue); return; case XtextPackage.ABSTRACT_RULE__TYPE: setType((TypeRef)newValue); return; case XtextPackage.ABSTRACT_RULE__ALTERNATIVES: setAlternatives((AbstractElement)newValue); return; } super.eSet(featureID, newValue); } /** * * * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case XtextPackage.ABSTRACT_RULE__NAME: setName(NAME_EDEFAULT); return; case XtextPackage.ABSTRACT_RULE__TYPE: setType((TypeRef)null); return; case XtextPackage.ABSTRACT_RULE__ALTERNATIVES: setAlternatives((AbstractElement)null); return; } super.eUnset(featureID); } /** * * * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case XtextPackage.ABSTRACT_RULE__NAME: return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); case XtextPackage.ABSTRACT_RULE__TYPE: return type != null; case XtextPackage.ABSTRACT_RULE__ALTERNATIVES: return alternatives != null; } return super.eIsSet(featureID); } /** * * * @generated */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); result.append(" (name: "); result.append(name); result.append(')'); return result.toString(); } } //AbstractRuleImpl




© 2015 - 2025 Weber Informatics LLC | Privacy Policy