Package net.cis.common.model.structure.impl

Source Code of net.cis.common.model.structure.impl.SlotImpl

/**
*/
package net.cis.common.model.structure.impl;

import net.cis.common.model.shipdevice.SlotSize;
import net.cis.common.model.shipdevice.SlotType;

import net.cis.common.model.structure.Slot;
import net.cis.common.model.structure.StructurePackage;

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

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Slot</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
*   <li>{@link net.cis.common.model.structure.impl.SlotImpl#getSlotType <em>Slot Type</em>}</li>
*   <li>{@link net.cis.common.model.structure.impl.SlotImpl#getSlotSize <em>Slot Size</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class SlotImpl extends EObjectImpl implements Slot {
  /**
   * The default value of the '{@link #getSlotType() <em>Slot Type</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getSlotType()
   * @generated
   * @ordered
   */
  protected static final SlotType SLOT_TYPE_EDEFAULT = SlotType.SHIELD;

  /**
   * The cached value of the '{@link #getSlotType() <em>Slot Type</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getSlotType()
   * @generated
   * @ordered
   */
  protected SlotType slotType = SLOT_TYPE_EDEFAULT;

  /**
   * The default value of the '{@link #getSlotSize() <em>Slot Size</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getSlotSize()
   * @generated
   * @ordered
   */
  protected static final SlotSize SLOT_SIZE_EDEFAULT = SlotSize.TINY;

  /**
   * The cached value of the '{@link #getSlotSize() <em>Slot Size</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getSlotSize()
   * @generated
   * @ordered
   */
  protected SlotSize slotSize = SLOT_SIZE_EDEFAULT;

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

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

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public SlotType getSlotType() {
    return slotType;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setSlotType(SlotType newSlotType) {
    SlotType oldSlotType = slotType;
    slotType = newSlotType == null ? SLOT_TYPE_EDEFAULT : newSlotType;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, StructurePackage.SLOT__SLOT_TYPE, oldSlotType, slotType));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public SlotSize getSlotSize() {
    return slotSize;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setSlotSize(SlotSize newSlotSize) {
    SlotSize oldSlotSize = slotSize;
    slotSize = newSlotSize == null ? SLOT_SIZE_EDEFAULT : newSlotSize;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, StructurePackage.SLOT__SLOT_SIZE, oldSlotSize, slotSize));
  }

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

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue) {
    switch (featureID) {
      case StructurePackage.SLOT__SLOT_TYPE:
        setSlotType((SlotType)newValue);
        return;
      case StructurePackage.SLOT__SLOT_SIZE:
        setSlotSize((SlotSize)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID) {
    switch (featureID) {
      case StructurePackage.SLOT__SLOT_TYPE:
        setSlotType(SLOT_TYPE_EDEFAULT);
        return;
      case StructurePackage.SLOT__SLOT_SIZE:
        setSlotSize(SLOT_SIZE_EDEFAULT);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID) {
    switch (featureID) {
      case StructurePackage.SLOT__SLOT_TYPE:
        return slotType != SLOT_TYPE_EDEFAULT;
      case StructurePackage.SLOT__SLOT_SIZE:
        return slotSize != SLOT_SIZE_EDEFAULT;
    }
    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(" (slotType: ");
    result.append(slotType);
    result.append(", slotSize: ");
    result.append(slotSize);
    result.append(')');
    return result.toString();
  }

} //SlotImpl
TOP

Related Classes of net.cis.common.model.structure.impl.SlotImpl

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.