/**
*/
package at.bestsolution.efxclipse.tooling.css.cssext.cssExtDsl.impl;
import at.bestsolution.efxclipse.tooling.css.cssext.cssExtDsl.CSSRule;
import at.bestsolution.efxclipse.tooling.css.cssext.cssExtDsl.CSSRulePostfix;
import at.bestsolution.efxclipse.tooling.css.cssext.cssExtDsl.CssExtDslPackage;
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;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>CSS Rule Postfix</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link at.bestsolution.efxclipse.tooling.css.cssext.cssExtDsl.impl.CSSRulePostfixImpl#getRule <em>Rule</em>}</li>
* <li>{@link at.bestsolution.efxclipse.tooling.css.cssext.cssExtDsl.impl.CSSRulePostfixImpl#getCardinality <em>Cardinality</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class CSSRulePostfixImpl extends CSSRuleImpl implements CSSRulePostfix
{
/**
* The cached value of the '{@link #getRule() <em>Rule</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getRule()
* @generated
* @ordered
*/
protected CSSRule rule;
/**
* The default value of the '{@link #getCardinality() <em>Cardinality</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getCardinality()
* @generated
* @ordered
*/
protected static final String CARDINALITY_EDEFAULT = null;
/**
* The cached value of the '{@link #getCardinality() <em>Cardinality</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getCardinality()
* @generated
* @ordered
*/
protected String cardinality = CARDINALITY_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected CSSRulePostfixImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return CssExtDslPackage.Literals.CSS_RULE_POSTFIX;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public CSSRule getRule()
{
return rule;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetRule(CSSRule newRule, NotificationChain msgs)
{
CSSRule oldRule = rule;
rule = newRule;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, CssExtDslPackage.CSS_RULE_POSTFIX__RULE, oldRule, newRule);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setRule(CSSRule newRule)
{
if (newRule != rule)
{
NotificationChain msgs = null;
if (rule != null)
msgs = ((InternalEObject)rule).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - CssExtDslPackage.CSS_RULE_POSTFIX__RULE, null, msgs);
if (newRule != null)
msgs = ((InternalEObject)newRule).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - CssExtDslPackage.CSS_RULE_POSTFIX__RULE, null, msgs);
msgs = basicSetRule(newRule, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, CssExtDslPackage.CSS_RULE_POSTFIX__RULE, newRule, newRule));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getCardinality()
{
return cardinality;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setCardinality(String newCardinality)
{
String oldCardinality = cardinality;
cardinality = newCardinality;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, CssExtDslPackage.CSS_RULE_POSTFIX__CARDINALITY, oldCardinality, cardinality));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case CssExtDslPackage.CSS_RULE_POSTFIX__RULE:
return basicSetRule(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 CssExtDslPackage.CSS_RULE_POSTFIX__RULE:
return getRule();
case CssExtDslPackage.CSS_RULE_POSTFIX__CARDINALITY:
return getCardinality();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case CssExtDslPackage.CSS_RULE_POSTFIX__RULE:
setRule((CSSRule)newValue);
return;
case CssExtDslPackage.CSS_RULE_POSTFIX__CARDINALITY:
setCardinality((String)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case CssExtDslPackage.CSS_RULE_POSTFIX__RULE:
setRule((CSSRule)null);
return;
case CssExtDslPackage.CSS_RULE_POSTFIX__CARDINALITY:
setCardinality(CARDINALITY_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case CssExtDslPackage.CSS_RULE_POSTFIX__RULE:
return rule != null;
case CssExtDslPackage.CSS_RULE_POSTFIX__CARDINALITY:
return CARDINALITY_EDEFAULT == null ? cardinality != null : !CARDINALITY_EDEFAULT.equals(cardinality);
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString()
{
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (cardinality: ");
result.append(cardinality);
result.append(')');
return result.toString();
}
} //CSSRulePostfixImpl