/**
* 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.vmware.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.vmware.HostFirewallRuleDirection;
import org.occiware.clouddesigner.occi.vmware.HostNetworkProtocol;
import org.occiware.clouddesigner.occi.vmware.Hostfirewallrule;
import org.occiware.clouddesigner.occi.vmware.VmwarePackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Hostfirewallrule</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.occiware.clouddesigner.occi.vmware.impl.HostfirewallruleImpl#getDirection <em>Direction</em>}</li>
* <li>{@link org.occiware.clouddesigner.occi.vmware.impl.HostfirewallruleImpl#getPort <em>Port</em>}</li>
* <li>{@link org.occiware.clouddesigner.occi.vmware.impl.HostfirewallruleImpl#getEndPort <em>End Port</em>}</li>
* <li>{@link org.occiware.clouddesigner.occi.vmware.impl.HostfirewallruleImpl#getProtocol <em>Protocol</em>}</li>
* </ul>
*
* @generated
*/
public class HostfirewallruleImpl extends LinkImpl implements Hostfirewallrule {
/**
* The default value of the '{@link #getDirection() <em>Direction</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDirection()
* @generated
* @ordered
*/
protected static final HostFirewallRuleDirection DIRECTION_EDEFAULT = HostFirewallRuleDirection.INBOUND;
/**
* The cached value of the '{@link #getDirection() <em>Direction</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDirection()
* @generated
* @ordered
*/
protected HostFirewallRuleDirection direction = DIRECTION_EDEFAULT;
/**
* The default value of the '{@link #getPort() <em>Port</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPort()
* @generated
* @ordered
*/
protected static final int PORT_EDEFAULT = 0;
/**
* The cached value of the '{@link #getPort() <em>Port</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPort()
* @generated
* @ordered
*/
protected int port = PORT_EDEFAULT;
/**
* The default value of the '{@link #getEndPort() <em>End Port</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getEndPort()
* @generated
* @ordered
*/
protected static final int END_PORT_EDEFAULT = 0;
/**
* The cached value of the '{@link #getEndPort() <em>End Port</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getEndPort()
* @generated
* @ordered
*/
protected int endPort = END_PORT_EDEFAULT;
/**
* The default value of the '{@link #getProtocol() <em>Protocol</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getProtocol()
* @generated
* @ordered
*/
protected static final HostNetworkProtocol PROTOCOL_EDEFAULT = HostNetworkProtocol.TCP;
/**
* The cached value of the '{@link #getProtocol() <em>Protocol</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getProtocol()
* @generated
* @ordered
*/
protected HostNetworkProtocol protocol = PROTOCOL_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected HostfirewallruleImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return VmwarePackage.eINSTANCE.getHostfirewallrule();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public HostFirewallRuleDirection getDirection() {
return direction;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setDirection(HostFirewallRuleDirection newDirection) {
HostFirewallRuleDirection oldDirection = direction;
direction = newDirection == null ? DIRECTION_EDEFAULT : newDirection;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, VmwarePackage.HOSTFIREWALLRULE__DIRECTION, oldDirection, direction));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int getPort() {
return port;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setPort(int newPort) {
int oldPort = port;
port = newPort;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, VmwarePackage.HOSTFIREWALLRULE__PORT, oldPort, port));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int getEndPort() {
return endPort;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setEndPort(int newEndPort) {
int oldEndPort = endPort;
endPort = newEndPort;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, VmwarePackage.HOSTFIREWALLRULE__END_PORT, oldEndPort, endPort));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public HostNetworkProtocol getProtocol() {
return protocol;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setProtocol(HostNetworkProtocol newProtocol) {
HostNetworkProtocol oldProtocol = protocol;
protocol = newProtocol == null ? PROTOCOL_EDEFAULT : newProtocol;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, VmwarePackage.HOSTFIREWALLRULE__PROTOCOL, oldProtocol, protocol));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case VmwarePackage.HOSTFIREWALLRULE__DIRECTION:
return getDirection();
case VmwarePackage.HOSTFIREWALLRULE__PORT:
return getPort();
case VmwarePackage.HOSTFIREWALLRULE__END_PORT:
return getEndPort();
case VmwarePackage.HOSTFIREWALLRULE__PROTOCOL:
return getProtocol();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case VmwarePackage.HOSTFIREWALLRULE__DIRECTION:
setDirection((HostFirewallRuleDirection)newValue);
return;
case VmwarePackage.HOSTFIREWALLRULE__PORT:
setPort((Integer)newValue);
return;
case VmwarePackage.HOSTFIREWALLRULE__END_PORT:
setEndPort((Integer)newValue);
return;
case VmwarePackage.HOSTFIREWALLRULE__PROTOCOL:
setProtocol((HostNetworkProtocol)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case VmwarePackage.HOSTFIREWALLRULE__DIRECTION:
setDirection(DIRECTION_EDEFAULT);
return;
case VmwarePackage.HOSTFIREWALLRULE__PORT:
setPort(PORT_EDEFAULT);
return;
case VmwarePackage.HOSTFIREWALLRULE__END_PORT:
setEndPort(END_PORT_EDEFAULT);
return;
case VmwarePackage.HOSTFIREWALLRULE__PROTOCOL:
setProtocol(PROTOCOL_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case VmwarePackage.HOSTFIREWALLRULE__DIRECTION:
return direction != DIRECTION_EDEFAULT;
case VmwarePackage.HOSTFIREWALLRULE__PORT:
return port != PORT_EDEFAULT;
case VmwarePackage.HOSTFIREWALLRULE__END_PORT:
return endPort != END_PORT_EDEFAULT;
case VmwarePackage.HOSTFIREWALLRULE__PROTOCOL:
return protocol != PROTOCOL_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(" (direction: ");
result.append(direction);
result.append(", port: ");
result.append(port);
result.append(", endPort: ");
result.append(endPort);
result.append(", protocol: ");
result.append(protocol);
result.append(')');
return result.toString();
}
} //HostfirewallruleImpl