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

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

import java.util.Date;

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>Link Table Link</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link brn.gui.graph.model.impl.LinkTableLinkImpl#getMetric <em>Metric</em>}</li>
 *   <li>{@link brn.gui.graph.model.impl.LinkTableLinkImpl#getSeq <em>Seq</em>}</li>
 *   <li>{@link brn.gui.graph.model.impl.LinkTableLinkImpl#getAge <em>Age</em>}</li>
 *   <li>{@link brn.gui.graph.model.impl.LinkTableLinkImpl#isPermanent <em>Permanent</em>}</li>
 *   <li>{@link brn.gui.graph.model.impl.LinkTableLinkImpl#getLastUpdated <em>Last Updated</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class LinkTableLinkImpl extends LinkImpl implements LinkTableLink {
  /**
   * The default value of the '{@link #getMetric() <em>Metric</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getMetric()
   * @generated
   * @ordered
   */
  protected static final int METRIC_EDEFAULT = 0;

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

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

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

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

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

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

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

  /**
   * The default value of the '{@link #getLastUpdated() <em>Last Updated</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getLastUpdated()
   * @generated
   * @ordered
   */
  protected static final Date LAST_UPDATED_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getLastUpdated() <em>Last Updated</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getLastUpdated()
   * @generated
   * @ordered
   */
  protected Date lastUpdated = LAST_UPDATED_EDEFAULT;

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

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

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

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setMetric(int newMetric) {
    int oldMetric = metric;
    metric = newMetric;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.LINK_TABLE_LINK__METRIC, oldMetric, metric));
  }

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

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setSeq(int newSeq) {
    int oldSeq = seq;
    seq = newSeq;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.LINK_TABLE_LINK__SEQ, oldSeq, seq));
  }

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

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setAge(int newAge) {
    int oldAge = age;
    age = newAge;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.LINK_TABLE_LINK__AGE, oldAge, age));
  }

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

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setPermanent(boolean newPermanent) {
    boolean oldPermanent = permanent;
    permanent = newPermanent;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.LINK_TABLE_LINK__PERMANENT, oldPermanent, permanent));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Date getLastUpdated() {
    return lastUpdated;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setLastUpdated(Date newLastUpdated) {
    Date oldLastUpdated = lastUpdated;
    lastUpdated = newLastUpdated;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.LINK_TABLE_LINK__LAST_UPDATED, oldLastUpdated, lastUpdated));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Object eGet(int featureID, boolean resolve, boolean coreType) {
    switch (featureID) {
      case ModelPackage.LINK_TABLE_LINK__METRIC:
        return new Integer(getMetric());
      case ModelPackage.LINK_TABLE_LINK__SEQ:
        return new Integer(getSeq());
      case ModelPackage.LINK_TABLE_LINK__AGE:
        return new Integer(getAge());
      case ModelPackage.LINK_TABLE_LINK__PERMANENT:
        return isPermanent() ? Boolean.TRUE : Boolean.FALSE;
      case ModelPackage.LINK_TABLE_LINK__LAST_UPDATED:
        return getLastUpdated();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void eSet(int featureID, Object newValue) {
    switch (featureID) {
      case ModelPackage.LINK_TABLE_LINK__METRIC:
        setMetric(((Integer)newValue).intValue());
        return;
      case ModelPackage.LINK_TABLE_LINK__SEQ:
        setSeq(((Integer)newValue).intValue());
        return;
      case ModelPackage.LINK_TABLE_LINK__AGE:
        setAge(((Integer)newValue).intValue());
        return;
      case ModelPackage.LINK_TABLE_LINK__PERMANENT:
        setPermanent(((Boolean)newValue).booleanValue());
        return;
      case ModelPackage.LINK_TABLE_LINK__LAST_UPDATED:
        setLastUpdated((Date)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void eUnset(int featureID) {
    switch (featureID) {
      case ModelPackage.LINK_TABLE_LINK__METRIC:
        setMetric(METRIC_EDEFAULT);
        return;
      case ModelPackage.LINK_TABLE_LINK__SEQ:
        setSeq(SEQ_EDEFAULT);
        return;
      case ModelPackage.LINK_TABLE_LINK__AGE:
        setAge(AGE_EDEFAULT);
        return;
      case ModelPackage.LINK_TABLE_LINK__PERMANENT:
        setPermanent(PERMANENT_EDEFAULT);
        return;
      case ModelPackage.LINK_TABLE_LINK__LAST_UPDATED:
        setLastUpdated(LAST_UPDATED_EDEFAULT);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public boolean eIsSet(int featureID) {
    switch (featureID) {
      case ModelPackage.LINK_TABLE_LINK__METRIC:
        return metric != METRIC_EDEFAULT;
      case ModelPackage.LINK_TABLE_LINK__SEQ:
        return seq != SEQ_EDEFAULT;
      case ModelPackage.LINK_TABLE_LINK__AGE:
        return age != AGE_EDEFAULT;
      case ModelPackage.LINK_TABLE_LINK__PERMANENT:
        return permanent != PERMANENT_EDEFAULT;
      case ModelPackage.LINK_TABLE_LINK__LAST_UPDATED:
        return LAST_UPDATED_EDEFAULT == null ? lastUpdated != null : !LAST_UPDATED_EDEFAULT.equals(lastUpdated);
    }
    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(" (metric: ");
    result.append(metric);
    result.append(", seq: ");
    result.append(seq);
    result.append(", age: ");
    result.append(age);
    result.append(", permanent: ");
    result.append(permanent);
    result.append(", lastUpdated: ");
    result.append(lastUpdated);
    result.append(')');
    return result.toString();
  }

} //LinkTableLinkImpl