Package com.puppetlabs.geppetto.pp.impl

Source Code of com.puppetlabs.geppetto.pp.impl.HostClassDefinitionImpl

/**
* Copyright (c) 2013 Puppet Labs, Inc. and other contributors, as listed below.
* 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:
*   Puppet Labs
*/
package com.puppetlabs.geppetto.pp.impl;

import com.puppetlabs.geppetto.pp.HostClassDefinition;
import com.puppetlabs.geppetto.pp.LiteralExpression;
import com.puppetlabs.geppetto.pp.PPPackage;
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>Host Class Definition</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link com.puppetlabs.geppetto.pp.impl.HostClassDefinitionImpl#getParent <em>Parent</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class HostClassDefinitionImpl extends DefinitionImpl implements HostClassDefinition {
  /**
   * The cached value of the '{@link #getParent() <em>Parent</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @see #getParent()
   * @generated
   * @ordered
   */
  protected LiteralExpression parent;

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

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @generated
   */
  public NotificationChain basicSetParent(LiteralExpression newParent, NotificationChain msgs) {
    LiteralExpression oldParent = parent;
    parent = newParent;
    if(eNotificationRequired()) {
      ENotificationImpl notification = new ENotificationImpl(
        this, Notification.SET, PPPackage.HOST_CLASS_DEFINITION__PARENT, oldParent, newParent);
      if(msgs == null)
        msgs = notification;
      else
        msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType) {
    switch(featureID) {
      case PPPackage.HOST_CLASS_DEFINITION__PARENT:
        return getParent();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
    switch(featureID) {
      case PPPackage.HOST_CLASS_DEFINITION__PARENT:
        return basicSetParent(null, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID) {
    switch(featureID) {
      case PPPackage.HOST_CLASS_DEFINITION__PARENT:
        return parent != null;
    }
    return super.eIsSet(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue) {
    switch(featureID) {
      case PPPackage.HOST_CLASS_DEFINITION__PARENT:
        setParent((LiteralExpression) newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

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

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @generated
   */
  @Override
  public void eUnset(int featureID) {
    switch(featureID) {
      case PPPackage.HOST_CLASS_DEFINITION__PARENT:
        setParent((LiteralExpression) null);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @generated
   */
  public LiteralExpression getParent() {
    return parent;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @generated
   */
  public void setParent(LiteralExpression newParent) {
    if(newParent != parent) {
      NotificationChain msgs = null;
      if(parent != null)
        msgs = ((InternalEObject) parent).eInverseRemove(this, EOPPOSITE_FEATURE_BASE -
            PPPackage.HOST_CLASS_DEFINITION__PARENT, null, msgs);
      if(newParent != null)
        msgs = ((InternalEObject) newParent).eInverseAdd(this, EOPPOSITE_FEATURE_BASE -
            PPPackage.HOST_CLASS_DEFINITION__PARENT, null, msgs);
      msgs = basicSetParent(newParent, msgs);
      if(msgs != null)
        msgs.dispatch();
    }
    else if(eNotificationRequired())
      eNotify(new ENotificationImpl(
        this, Notification.SET, PPPackage.HOST_CLASS_DEFINITION__PARENT, newParent, newParent));
  }

} // HostClassDefinitionImpl
TOP

Related Classes of com.puppetlabs.geppetto.pp.impl.HostClassDefinitionImpl

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.