/**
 */
package de.ugoe.cs.swe.bnftools.ebnf.impl;

import de.ugoe.cs.swe.bnftools.ebnf.EbnfPackage;
import de.ugoe.cs.swe.bnftools.ebnf.HookCombinator;

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.util.EDataTypeEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Hook Combinator</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link de.ugoe.cs.swe.bnftools.ebnf.impl.HookCombinatorImpl#getName <em>Name</em>}</li>
 *   <li>{@link de.ugoe.cs.swe.bnftools.ebnf.impl.HookCombinatorImpl#getRuleext <em>Ruleext</em>}</li>
 *   <li>{@link de.ugoe.cs.swe.bnftools.ebnf.impl.HookCombinatorImpl#getLABEL <em>LABEL</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class HookCombinatorImpl extends MergeRuleImpl implements HookCombinator
{
  /**
   * The default value of the '{@link #getName() <em>Name</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getName()
   * @generated
   * @ordered
   */
  protected static final String NAME_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getName()
   * @generated
   * @ordered
   */
  protected String name = NAME_EDEFAULT;

  /**
   * The default value of the '{@link #getRuleext() <em>Ruleext</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getRuleext()
   * @generated
   * @ordered
   */
  protected static final int RULEEXT_EDEFAULT = 0;

  /**
   * The cached value of the '{@link #getRuleext() <em>Ruleext</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getRuleext()
   * @generated
   * @ordered
   */
  protected int ruleext = RULEEXT_EDEFAULT;

  /**
   * The cached value of the '{@link #getLABEL() <em>LABEL</em>}' attribute list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getLABEL()
   * @generated
   * @ordered
   */
  protected EList<String> label;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected HookCombinatorImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return EbnfPackage.Literals.HOOK_COMBINATOR;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getName()
  {
    return name;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setName(String newName)
  {
    String oldName = name;
    name = newName;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, EbnfPackage.HOOK_COMBINATOR__NAME, oldName, name));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public int getRuleext()
  {
    return ruleext;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setRuleext(int newRuleext)
  {
    int oldRuleext = ruleext;
    ruleext = newRuleext;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, EbnfPackage.HOOK_COMBINATOR__RULEEXT, oldRuleext, ruleext));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<String> getLABEL()
  {
    if (label == null)
    {
      label = new EDataTypeEList<String>(String.class, this, EbnfPackage.HOOK_COMBINATOR__LABEL);
    }
    return label;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case EbnfPackage.HOOK_COMBINATOR__NAME:
        return getName();
      case EbnfPackage.HOOK_COMBINATOR__RULEEXT:
        return getRuleext();
      case EbnfPackage.HOOK_COMBINATOR__LABEL:
        return getLABEL();
    }
    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 EbnfPackage.HOOK_COMBINATOR__NAME:
        setName((String)newValue);
        return;
      case EbnfPackage.HOOK_COMBINATOR__RULEEXT:
        setRuleext((Integer)newValue);
        return;
      case EbnfPackage.HOOK_COMBINATOR__LABEL:
        getLABEL().clear();
        getLABEL().addAll((Collection<? extends String>)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case EbnfPackage.HOOK_COMBINATOR__NAME:
        setName(NAME_EDEFAULT);
        return;
      case EbnfPackage.HOOK_COMBINATOR__RULEEXT:
        setRuleext(RULEEXT_EDEFAULT);
        return;
      case EbnfPackage.HOOK_COMBINATOR__LABEL:
        getLABEL().clear();
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case EbnfPackage.HOOK_COMBINATOR__NAME:
        return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
      case EbnfPackage.HOOK_COMBINATOR__RULEEXT:
        return ruleext != RULEEXT_EDEFAULT;
      case EbnfPackage.HOOK_COMBINATOR__LABEL:
        return label != null && !label.isEmpty();
    }
    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(" (name: ");
    result.append(name);
    result.append(", ruleext: ");
    result.append(ruleext);
    result.append(", LABEL: ");
    result.append(label);
    result.append(')');
    return result.toString();
  }

} //HookCombinatorImpl
