/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package brn.gui.graph.model.impl;

import brn.gui.graph.model.FwdLink;
import brn.gui.graph.model.ModelPackage;

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

import org.eclipse.emf.ecore.EClass;

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

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Fwd Link</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link brn.gui.graph.model.impl.FwdLinkImpl#getSourceChannel <em>Source Channel</em>}</li>
 *   <li>{@link brn.gui.graph.model.impl.FwdLinkImpl#getTargetChannel <em>Target Channel</em>}</li>
 *   <li>{@link brn.gui.graph.model.impl.FwdLinkImpl#getFlowId <em>Flow Id</em>}</li>
 *   <li>{@link brn.gui.graph.model.impl.FwdLinkImpl#isDuplicate <em>Duplicate</em>}</li>
 *   <li>{@link brn.gui.graph.model.impl.FwdLinkImpl#getNoPackets <em>No Packets</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class FwdLinkImpl extends LinkImpl implements FwdLink {
  /**
   * The default value of the '{@link #getSourceChannel() <em>Source Channel</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getSourceChannel()
   * @generated
   * @ordered
   */
  protected static final int SOURCE_CHANNEL_EDEFAULT = 0;

  /**
   * The cached value of the '{@link #getSourceChannel() <em>Source Channel</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getSourceChannel()
   * @generated
   * @ordered
   */
  protected int sourceChannel = SOURCE_CHANNEL_EDEFAULT;

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

  /**
   * The cached value of the '{@link #getTargetChannel() <em>Target Channel</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getTargetChannel()
   * @generated
   * @ordered
   */
  protected int targetChannel = TARGET_CHANNEL_EDEFAULT;

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

  /**
   * The cached value of the '{@link #getFlowId() <em>Flow Id</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getFlowId()
   * @generated
   * @ordered
   */
  protected int flowId = FLOW_ID_EDEFAULT;

  /**
   * The default value of the '{@link #isDuplicate() <em>Duplicate</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #isDuplicate()
   * @generated
   * @ordered
   */
  protected static final boolean DUPLICATE_EDEFAULT = false;

  /**
   * The cached value of the '{@link #isDuplicate() <em>Duplicate</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #isDuplicate()
   * @generated
   * @ordered
   */
  protected boolean duplicate = DUPLICATE_EDEFAULT;

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

  /**
   * The cached value of the '{@link #getNoPackets() <em>No Packets</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getNoPackets()
   * @generated
   * @ordered
   */
  protected int noPackets = NO_PACKETS_EDEFAULT;

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

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

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

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setSourceChannel(int newSourceChannel) {
    int oldSourceChannel = sourceChannel;
    sourceChannel = newSourceChannel;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.FWD_LINK__SOURCE_CHANNEL, oldSourceChannel, sourceChannel));
  }

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

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setTargetChannel(int newTargetChannel) {
    int oldTargetChannel = targetChannel;
    targetChannel = newTargetChannel;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.FWD_LINK__TARGET_CHANNEL, oldTargetChannel, targetChannel));
  }

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

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setFlowId(int newFlowId) {
    int oldFlowId = flowId;
    flowId = newFlowId;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.FWD_LINK__FLOW_ID, oldFlowId, flowId));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public boolean isDuplicate() {
    return duplicate;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setDuplicate(boolean newDuplicate) {
    boolean oldDuplicate = duplicate;
    duplicate = newDuplicate;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.FWD_LINK__DUPLICATE, oldDuplicate, duplicate));
  }

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

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setNoPackets(int newNoPackets) {
    int oldNoPackets = noPackets;
    noPackets = newNoPackets;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.FWD_LINK__NO_PACKETS, oldNoPackets, noPackets));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Object eGet(int featureID, boolean resolve, boolean coreType) {
    switch (featureID) {
      case ModelPackage.FWD_LINK__SOURCE_CHANNEL:
        return new Integer(getSourceChannel());
      case ModelPackage.FWD_LINK__TARGET_CHANNEL:
        return new Integer(getTargetChannel());
      case ModelPackage.FWD_LINK__FLOW_ID:
        return new Integer(getFlowId());
      case ModelPackage.FWD_LINK__DUPLICATE:
        return isDuplicate() ? Boolean.TRUE : Boolean.FALSE;
      case ModelPackage.FWD_LINK__NO_PACKETS:
        return new Integer(getNoPackets());
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void eSet(int featureID, Object newValue) {
    switch (featureID) {
      case ModelPackage.FWD_LINK__SOURCE_CHANNEL:
        setSourceChannel(((Integer)newValue).intValue());
        return;
      case ModelPackage.FWD_LINK__TARGET_CHANNEL:
        setTargetChannel(((Integer)newValue).intValue());
        return;
      case ModelPackage.FWD_LINK__FLOW_ID:
        setFlowId(((Integer)newValue).intValue());
        return;
      case ModelPackage.FWD_LINK__DUPLICATE:
        setDuplicate(((Boolean)newValue).booleanValue());
        return;
      case ModelPackage.FWD_LINK__NO_PACKETS:
        setNoPackets(((Integer)newValue).intValue());
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void eUnset(int featureID) {
    switch (featureID) {
      case ModelPackage.FWD_LINK__SOURCE_CHANNEL:
        setSourceChannel(SOURCE_CHANNEL_EDEFAULT);
        return;
      case ModelPackage.FWD_LINK__TARGET_CHANNEL:
        setTargetChannel(TARGET_CHANNEL_EDEFAULT);
        return;
      case ModelPackage.FWD_LINK__FLOW_ID:
        setFlowId(FLOW_ID_EDEFAULT);
        return;
      case ModelPackage.FWD_LINK__DUPLICATE:
        setDuplicate(DUPLICATE_EDEFAULT);
        return;
      case ModelPackage.FWD_LINK__NO_PACKETS:
        setNoPackets(NO_PACKETS_EDEFAULT);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public boolean eIsSet(int featureID) {
    switch (featureID) {
      case ModelPackage.FWD_LINK__SOURCE_CHANNEL:
        return sourceChannel != SOURCE_CHANNEL_EDEFAULT;
      case ModelPackage.FWD_LINK__TARGET_CHANNEL:
        return targetChannel != TARGET_CHANNEL_EDEFAULT;
      case ModelPackage.FWD_LINK__FLOW_ID:
        return flowId != FLOW_ID_EDEFAULT;
      case ModelPackage.FWD_LINK__DUPLICATE:
        return duplicate != DUPLICATE_EDEFAULT;
      case ModelPackage.FWD_LINK__NO_PACKETS:
        return noPackets != NO_PACKETS_EDEFAULT;
    }
    return super.eIsSet(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String toString() {
    if (eIsProxy()) return super.toString();

    StringBuffer result = new StringBuffer(super.toString());
    result.append(" (sourceChannel: ");
    result.append(sourceChannel);
    result.append(", targetChannel: ");
    result.append(targetChannel);
    result.append(", flowId: ");
    result.append(flowId);
    result.append(", duplicate: ");
    result.append(duplicate);
    result.append(", noPackets: ");
    result.append(noPackets);
    result.append(')');
    return result.toString();
  }

} //FwdLinkImpl