/**
 * generated by Xtext 2.12.0
 */
package com.minres.rdl.rdl.impl;

import com.minres.rdl.rdl.ComponentDefinition;
import com.minres.rdl.rdl.EnumDefinition;
import com.minres.rdl.rdl.Include;
import com.minres.rdl.rdl.NamedInstantiation;
import com.minres.rdl.rdl.PropertyAssignment;
import com.minres.rdl.rdl.PropertyDefinition;
import com.minres.rdl.rdl.RdlPackage;
import com.minres.rdl.rdl.Root;

import java.util.Collection;

import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Root</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * </p>
 * <ul>
 *   <li>{@link com.minres.rdl.rdl.impl.RootImpl#getIncludes <em>Includes</em>}</li>
 *   <li>{@link com.minres.rdl.rdl.impl.RootImpl#getComponentDefinitions <em>Component Definitions</em>}</li>
 *   <li>{@link com.minres.rdl.rdl.impl.RootImpl#getEnumDefinitions <em>Enum Definitions</em>}</li>
 *   <li>{@link com.minres.rdl.rdl.impl.RootImpl#getNamedInstantiations <em>Named Instantiations</em>}</li>
 *   <li>{@link com.minres.rdl.rdl.impl.RootImpl#getPropertyAssignments <em>Property Assignments</em>}</li>
 *   <li>{@link com.minres.rdl.rdl.impl.RootImpl#getPropertyDefinitions <em>Property Definitions</em>}</li>
 * </ul>
 *
 * @generated
 */
public class RootImpl extends MinimalEObjectImpl.Container implements Root
{
  /**
   * The cached value of the '{@link #getIncludes() <em>Includes</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getIncludes()
   * @generated
   * @ordered
   */
  protected EList<Include> includes;

  /**
   * The cached value of the '{@link #getComponentDefinitions() <em>Component Definitions</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getComponentDefinitions()
   * @generated
   * @ordered
   */
  protected EList<ComponentDefinition> componentDefinitions;

  /**
   * The cached value of the '{@link #getEnumDefinitions() <em>Enum Definitions</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getEnumDefinitions()
   * @generated
   * @ordered
   */
  protected EList<EnumDefinition> enumDefinitions;

  /**
   * The cached value of the '{@link #getNamedInstantiations() <em>Named Instantiations</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getNamedInstantiations()
   * @generated
   * @ordered
   */
  protected EList<NamedInstantiation> namedInstantiations;

  /**
   * The cached value of the '{@link #getPropertyAssignments() <em>Property Assignments</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getPropertyAssignments()
   * @generated
   * @ordered
   */
  protected EList<PropertyAssignment> propertyAssignments;

  /**
   * The cached value of the '{@link #getPropertyDefinitions() <em>Property Definitions</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getPropertyDefinitions()
   * @generated
   * @ordered
   */
  protected EList<PropertyDefinition> propertyDefinitions;

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

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

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<Include> getIncludes()
  {
    if (includes == null)
    {
      includes = new EObjectContainmentEList<Include>(Include.class, this, RdlPackage.ROOT__INCLUDES);
    }
    return includes;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<ComponentDefinition> getComponentDefinitions()
  {
    if (componentDefinitions == null)
    {
      componentDefinitions = new EObjectContainmentEList<ComponentDefinition>(ComponentDefinition.class, this, RdlPackage.ROOT__COMPONENT_DEFINITIONS);
    }
    return componentDefinitions;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<EnumDefinition> getEnumDefinitions()
  {
    if (enumDefinitions == null)
    {
      enumDefinitions = new EObjectContainmentEList<EnumDefinition>(EnumDefinition.class, this, RdlPackage.ROOT__ENUM_DEFINITIONS);
    }
    return enumDefinitions;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<NamedInstantiation> getNamedInstantiations()
  {
    if (namedInstantiations == null)
    {
      namedInstantiations = new EObjectContainmentEList<NamedInstantiation>(NamedInstantiation.class, this, RdlPackage.ROOT__NAMED_INSTANTIATIONS);
    }
    return namedInstantiations;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<PropertyAssignment> getPropertyAssignments()
  {
    if (propertyAssignments == null)
    {
      propertyAssignments = new EObjectContainmentEList<PropertyAssignment>(PropertyAssignment.class, this, RdlPackage.ROOT__PROPERTY_ASSIGNMENTS);
    }
    return propertyAssignments;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<PropertyDefinition> getPropertyDefinitions()
  {
    if (propertyDefinitions == null)
    {
      propertyDefinitions = new EObjectContainmentEList<PropertyDefinition>(PropertyDefinition.class, this, RdlPackage.ROOT__PROPERTY_DEFINITIONS);
    }
    return propertyDefinitions;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case RdlPackage.ROOT__INCLUDES:
        return ((InternalEList<?>)getIncludes()).basicRemove(otherEnd, msgs);
      case RdlPackage.ROOT__COMPONENT_DEFINITIONS:
        return ((InternalEList<?>)getComponentDefinitions()).basicRemove(otherEnd, msgs);
      case RdlPackage.ROOT__ENUM_DEFINITIONS:
        return ((InternalEList<?>)getEnumDefinitions()).basicRemove(otherEnd, msgs);
      case RdlPackage.ROOT__NAMED_INSTANTIATIONS:
        return ((InternalEList<?>)getNamedInstantiations()).basicRemove(otherEnd, msgs);
      case RdlPackage.ROOT__PROPERTY_ASSIGNMENTS:
        return ((InternalEList<?>)getPropertyAssignments()).basicRemove(otherEnd, msgs);
      case RdlPackage.ROOT__PROPERTY_DEFINITIONS:
        return ((InternalEList<?>)getPropertyDefinitions()).basicRemove(otherEnd, 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 RdlPackage.ROOT__INCLUDES:
        return getIncludes();
      case RdlPackage.ROOT__COMPONENT_DEFINITIONS:
        return getComponentDefinitions();
      case RdlPackage.ROOT__ENUM_DEFINITIONS:
        return getEnumDefinitions();
      case RdlPackage.ROOT__NAMED_INSTANTIATIONS:
        return getNamedInstantiations();
      case RdlPackage.ROOT__PROPERTY_ASSIGNMENTS:
        return getPropertyAssignments();
      case RdlPackage.ROOT__PROPERTY_DEFINITIONS:
        return getPropertyDefinitions();
    }
    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 RdlPackage.ROOT__INCLUDES:
        getIncludes().clear();
        getIncludes().addAll((Collection<? extends Include>)newValue);
        return;
      case RdlPackage.ROOT__COMPONENT_DEFINITIONS:
        getComponentDefinitions().clear();
        getComponentDefinitions().addAll((Collection<? extends ComponentDefinition>)newValue);
        return;
      case RdlPackage.ROOT__ENUM_DEFINITIONS:
        getEnumDefinitions().clear();
        getEnumDefinitions().addAll((Collection<? extends EnumDefinition>)newValue);
        return;
      case RdlPackage.ROOT__NAMED_INSTANTIATIONS:
        getNamedInstantiations().clear();
        getNamedInstantiations().addAll((Collection<? extends NamedInstantiation>)newValue);
        return;
      case RdlPackage.ROOT__PROPERTY_ASSIGNMENTS:
        getPropertyAssignments().clear();
        getPropertyAssignments().addAll((Collection<? extends PropertyAssignment>)newValue);
        return;
      case RdlPackage.ROOT__PROPERTY_DEFINITIONS:
        getPropertyDefinitions().clear();
        getPropertyDefinitions().addAll((Collection<? extends PropertyDefinition>)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case RdlPackage.ROOT__INCLUDES:
        getIncludes().clear();
        return;
      case RdlPackage.ROOT__COMPONENT_DEFINITIONS:
        getComponentDefinitions().clear();
        return;
      case RdlPackage.ROOT__ENUM_DEFINITIONS:
        getEnumDefinitions().clear();
        return;
      case RdlPackage.ROOT__NAMED_INSTANTIATIONS:
        getNamedInstantiations().clear();
        return;
      case RdlPackage.ROOT__PROPERTY_ASSIGNMENTS:
        getPropertyAssignments().clear();
        return;
      case RdlPackage.ROOT__PROPERTY_DEFINITIONS:
        getPropertyDefinitions().clear();
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case RdlPackage.ROOT__INCLUDES:
        return includes != null && !includes.isEmpty();
      case RdlPackage.ROOT__COMPONENT_DEFINITIONS:
        return componentDefinitions != null && !componentDefinitions.isEmpty();
      case RdlPackage.ROOT__ENUM_DEFINITIONS:
        return enumDefinitions != null && !enumDefinitions.isEmpty();
      case RdlPackage.ROOT__NAMED_INSTANTIATIONS:
        return namedInstantiations != null && !namedInstantiations.isEmpty();
      case RdlPackage.ROOT__PROPERTY_ASSIGNMENTS:
        return propertyAssignments != null && !propertyAssignments.isEmpty();
      case RdlPackage.ROOT__PROPERTY_DEFINITIONS:
        return propertyDefinitions != null && !propertyDefinitions.isEmpty();
    }
    return super.eIsSet(featureID);
  }

} //RootImpl
