blob: ee3a92446cd6ee9d1cabf8747628522c079d96d8 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2014 Bosch Software Innovations GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v1.0 which accompany this distribution.
*
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
* The Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
* Bosch Software Innovations GmbH - Please refer to git log
*
*******************************************************************************/
/**
*/
package org.eclipse.vorto.functionblock.impl;
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.MinimalEObjectImpl;
import org.eclipse.vorto.functionblock.FunctionblockPackage;
import org.eclipse.vorto.functionblock.Presence;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Presence</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.vorto.functionblock.impl.PresenceImpl#getMandatory <em>Mandatory</em>}</li>
* <li>{@link org.eclipse.vorto.functionblock.impl.PresenceImpl#getOptional <em>Optional</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class PresenceImpl extends MinimalEObjectImpl.Container implements Presence {
/**
* The default value of the '{@link #getMandatory() <em>Mandatory</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getMandatory()
* @generated
* @ordered
*/
protected static final String MANDATORY_EDEFAULT = null;
/**
* The cached value of the '{@link #getMandatory() <em>Mandatory</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getMandatory()
* @generated
* @ordered
*/
protected String mandatory = MANDATORY_EDEFAULT;
/**
* The default value of the '{@link #getOptional() <em>Optional</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOptional()
* @generated
* @ordered
*/
protected static final String OPTIONAL_EDEFAULT = null;
/**
* The cached value of the '{@link #getOptional() <em>Optional</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOptional()
* @generated
* @ordered
*/
protected String optional = OPTIONAL_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected PresenceImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return FunctionblockPackage.Literals.PRESENCE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getMandatory() {
return mandatory;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setMandatory(String newMandatory) {
String oldMandatory = mandatory;
mandatory = newMandatory;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FunctionblockPackage.PRESENCE__MANDATORY, oldMandatory, mandatory));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getOptional() {
return optional;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setOptional(String newOptional) {
String oldOptional = optional;
optional = newOptional;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FunctionblockPackage.PRESENCE__OPTIONAL, oldOptional, optional));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case FunctionblockPackage.PRESENCE__MANDATORY:
return getMandatory();
case FunctionblockPackage.PRESENCE__OPTIONAL:
return getOptional();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case FunctionblockPackage.PRESENCE__MANDATORY:
setMandatory((String)newValue);
return;
case FunctionblockPackage.PRESENCE__OPTIONAL:
setOptional((String)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case FunctionblockPackage.PRESENCE__MANDATORY:
setMandatory(MANDATORY_EDEFAULT);
return;
case FunctionblockPackage.PRESENCE__OPTIONAL:
setOptional(OPTIONAL_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case FunctionblockPackage.PRESENCE__MANDATORY:
return MANDATORY_EDEFAULT == null ? mandatory != null : !MANDATORY_EDEFAULT.equals(mandatory);
case FunctionblockPackage.PRESENCE__OPTIONAL:
return OPTIONAL_EDEFAULT == null ? optional != null : !OPTIONAL_EDEFAULT.equals(optional);
}
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(" (mandatory: ");
result.append(mandatory);
result.append(", optional: ");
result.append(optional);
result.append(')');
return result.toString();
}
} //PresenceImpl