/**
* Copyright (c) 2015-2016 Obeo, Inria
* 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:
* - William Piers <william.piers@obeo.fr>
* - Philippe Merle <philippe.merle@inria.fr>
*/
package org.occiware.clouddesigner.occi.infrastructure.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.occiware.clouddesigner.occi.impl.LinkImpl;
import org.occiware.clouddesigner.occi.infrastructure.InfrastructurePackage;
import org.occiware.clouddesigner.occi.infrastructure.NetworkInterfaceStatus;
import org.occiware.clouddesigner.occi.infrastructure.Networkinterface;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Networkinterface</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.occiware.clouddesigner.occi.infrastructure.impl.NetworkinterfaceImpl#getInterface <em>Interface</em>}</li>
* <li>{@link org.occiware.clouddesigner.occi.infrastructure.impl.NetworkinterfaceImpl#getMac <em>Mac</em>}</li>
* <li>{@link org.occiware.clouddesigner.occi.infrastructure.impl.NetworkinterfaceImpl#getState <em>State</em>}</li>
* <li>{@link org.occiware.clouddesigner.occi.infrastructure.impl.NetworkinterfaceImpl#getMessage <em>Message</em>}</li>
* </ul>
*
* @generated
*/
public class NetworkinterfaceImpl extends LinkImpl implements Networkinterface {
/**
* The default value of the '{@link #getInterface() <em>Interface</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getInterface()
* @generated
* @ordered
*/
protected static final String INTERFACE_EDEFAULT = null;
/**
* The cached value of the '{@link #getInterface() <em>Interface</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getInterface()
* @generated
* @ordered
*/
protected String interface_ = INTERFACE_EDEFAULT;
/**
* The default value of the '{@link #getMac() <em>Mac</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getMac()
* @generated
* @ordered
*/
protected static final String MAC_EDEFAULT = null;
/**
* The cached value of the '{@link #getMac() <em>Mac</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getMac()
* @generated
* @ordered
*/
protected String mac = MAC_EDEFAULT;
/**
* The default value of the '{@link #getState() <em>State</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getState()
* @generated
* @ordered
*/
protected static final NetworkInterfaceStatus STATE_EDEFAULT = NetworkInterfaceStatus.ACTIVE;
/**
* The cached value of the '{@link #getState() <em>State</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getState()
* @generated
* @ordered
*/
protected NetworkInterfaceStatus state = STATE_EDEFAULT;
/**
* The default value of the '{@link #getMessage() <em>Message</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getMessage()
* @generated
* @ordered
*/
protected static final String MESSAGE_EDEFAULT = null;
/**
* The cached value of the '{@link #getMessage() <em>Message</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getMessage()
* @generated
* @ordered
*/
protected String message = MESSAGE_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected NetworkinterfaceImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return InfrastructurePackage.Literals.NETWORKINTERFACE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getInterface() {
return interface_;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setInterface(String newInterface) {
String oldInterface = interface_;
interface_ = newInterface;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, InfrastructurePackage.NETWORKINTERFACE__INTERFACE, oldInterface, interface_));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getMac() {
return mac;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setMac(String newMac) {
String oldMac = mac;
mac = newMac;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, InfrastructurePackage.NETWORKINTERFACE__MAC, oldMac, mac));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NetworkInterfaceStatus getState() {
return state;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setState(NetworkInterfaceStatus newState) {
NetworkInterfaceStatus oldState = state;
state = newState == null ? STATE_EDEFAULT : newState;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, InfrastructurePackage.NETWORKINTERFACE__STATE, oldState, state));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getMessage() {
return message;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setMessage(String newMessage) {
String oldMessage = message;
message = newMessage;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, InfrastructurePackage.NETWORKINTERFACE__MESSAGE, oldMessage, message));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case InfrastructurePackage.NETWORKINTERFACE__INTERFACE:
return getInterface();
case InfrastructurePackage.NETWORKINTERFACE__MAC:
return getMac();
case InfrastructurePackage.NETWORKINTERFACE__STATE:
return getState();
case InfrastructurePackage.NETWORKINTERFACE__MESSAGE:
return getMessage();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case InfrastructurePackage.NETWORKINTERFACE__INTERFACE:
setInterface((String)newValue);
return;
case InfrastructurePackage.NETWORKINTERFACE__MAC:
setMac((String)newValue);
return;
case InfrastructurePackage.NETWORKINTERFACE__STATE:
setState((NetworkInterfaceStatus)newValue);
return;
case InfrastructurePackage.NETWORKINTERFACE__MESSAGE:
setMessage((String)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case InfrastructurePackage.NETWORKINTERFACE__INTERFACE:
setInterface(INTERFACE_EDEFAULT);
return;
case InfrastructurePackage.NETWORKINTERFACE__MAC:
setMac(MAC_EDEFAULT);
return;
case InfrastructurePackage.NETWORKINTERFACE__STATE:
setState(STATE_EDEFAULT);
return;
case InfrastructurePackage.NETWORKINTERFACE__MESSAGE:
setMessage(MESSAGE_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case InfrastructurePackage.NETWORKINTERFACE__INTERFACE:
return INTERFACE_EDEFAULT == null ? interface_ != null : !INTERFACE_EDEFAULT.equals(interface_);
case InfrastructurePackage.NETWORKINTERFACE__MAC:
return MAC_EDEFAULT == null ? mac != null : !MAC_EDEFAULT.equals(mac);
case InfrastructurePackage.NETWORKINTERFACE__STATE:
return state != STATE_EDEFAULT;
case InfrastructurePackage.NETWORKINTERFACE__MESSAGE:
return MESSAGE_EDEFAULT == null ? message != null : !MESSAGE_EDEFAULT.equals(message);
}
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(" (interface: ");
result.append(interface_);
result.append(", mac: ");
result.append(mac);
result.append(", state: ");
result.append(state);
result.append(", message: ");
result.append(message);
result.append(')');
return result.toString();
}
} //NetworkinterfaceImpl