blob: 9e75d0b4b12d6a7726c47d87ee2ad9b32dcb124c [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 java.util.Collection;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.vorto.functionblock.Event;
import org.eclipse.vorto.functionblock.FBFeature;
import org.eclipse.vorto.functionblock.FunctionBlock;
import org.eclipse.vorto.functionblock.FunctionblockPackage;
import org.eclipse.vorto.functionblock.Operation;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Function Block</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.vorto.functionblock.impl.FunctionBlockImpl#getDisplayname <em>Displayname</em>}</li>
* <li>{@link org.eclipse.vorto.functionblock.impl.FunctionBlockImpl#getDescription <em>Description</em>}</li>
* <li>{@link org.eclipse.vorto.functionblock.impl.FunctionBlockImpl#getVendor <em>Vendor</em>}</li>
* <li>{@link org.eclipse.vorto.functionblock.impl.FunctionBlockImpl#getCategory <em>Category</em>}</li>
* <li>{@link org.eclipse.vorto.functionblock.impl.FunctionBlockImpl#getVersion <em>Version</em>}</li>
* <li>{@link org.eclipse.vorto.functionblock.impl.FunctionBlockImpl#getConfiguration <em>Configuration</em>}</li>
* <li>{@link org.eclipse.vorto.functionblock.impl.FunctionBlockImpl#getStatus <em>Status</em>}</li>
* <li>{@link org.eclipse.vorto.functionblock.impl.FunctionBlockImpl#getFault <em>Fault</em>}</li>
* <li>{@link org.eclipse.vorto.functionblock.impl.FunctionBlockImpl#getFeatures <em>Features</em>}</li>
* <li>{@link org.eclipse.vorto.functionblock.impl.FunctionBlockImpl#getEvents <em>Events</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class FunctionBlockImpl extends MinimalEObjectImpl.Container implements FunctionBlock {
/**
* The default value of the '{@link #getDisplayname() <em>Displayname</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDisplayname()
* @generated
* @ordered
*/
protected static final String DISPLAYNAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getDisplayname() <em>Displayname</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDisplayname()
* @generated
* @ordered
*/
protected String displayname = DISPLAYNAME_EDEFAULT;
/**
* The default value of the '{@link #getDescription() <em>Description</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDescription()
* @generated
* @ordered
*/
protected static final String DESCRIPTION_EDEFAULT = null;
/**
* The cached value of the '{@link #getDescription() <em>Description</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDescription()
* @generated
* @ordered
*/
protected String description = DESCRIPTION_EDEFAULT;
/**
* The default value of the '{@link #getVendor() <em>Vendor</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getVendor()
* @generated
* @ordered
*/
protected static final String VENDOR_EDEFAULT = null;
/**
* The cached value of the '{@link #getVendor() <em>Vendor</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getVendor()
* @generated
* @ordered
*/
protected String vendor = VENDOR_EDEFAULT;
/**
* The default value of the '{@link #getCategory() <em>Category</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getCategory()
* @generated
* @ordered
*/
protected static final String CATEGORY_EDEFAULT = null;
/**
* The cached value of the '{@link #getCategory() <em>Category</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getCategory()
* @generated
* @ordered
*/
protected String category = CATEGORY_EDEFAULT;
/**
* The default value of the '{@link #getVersion() <em>Version</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getVersion()
* @generated
* @ordered
*/
protected static final String VERSION_EDEFAULT = null;
/**
* The cached value of the '{@link #getVersion() <em>Version</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getVersion()
* @generated
* @ordered
*/
protected String version = VERSION_EDEFAULT;
/**
* The cached value of the '{@link #getConfiguration() <em>Configuration</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getConfiguration()
* @generated
* @ordered
*/
protected FBFeature configuration;
/**
* The cached value of the '{@link #getStatus() <em>Status</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getStatus()
* @generated
* @ordered
*/
protected FBFeature status;
/**
* The cached value of the '{@link #getFault() <em>Fault</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getFault()
* @generated
* @ordered
*/
protected FBFeature fault;
/**
* The cached value of the '{@link #getFeatures() <em>Features</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getFeatures()
* @generated
* @ordered
*/
protected EList<Operation> features;
/**
* The cached value of the '{@link #getEvents() <em>Events</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getEvents()
* @generated
* @ordered
*/
protected EList<Event> events;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected FunctionBlockImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return FunctionblockPackage.Literals.FUNCTION_BLOCK;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getDisplayname() {
return displayname;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setDisplayname(String newDisplayname) {
String oldDisplayname = displayname;
displayname = newDisplayname;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FunctionblockPackage.FUNCTION_BLOCK__DISPLAYNAME, oldDisplayname, displayname));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getDescription() {
return description;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setDescription(String newDescription) {
String oldDescription = description;
description = newDescription;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FunctionblockPackage.FUNCTION_BLOCK__DESCRIPTION, oldDescription, description));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getVendor() {
return vendor;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setVendor(String newVendor) {
String oldVendor = vendor;
vendor = newVendor;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FunctionblockPackage.FUNCTION_BLOCK__VENDOR, oldVendor, vendor));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getCategory() {
return category;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setCategory(String newCategory) {
String oldCategory = category;
category = newCategory;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FunctionblockPackage.FUNCTION_BLOCK__CATEGORY, oldCategory, category));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getVersion() {
return version;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setVersion(String newVersion) {
String oldVersion = version;
version = newVersion;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FunctionblockPackage.FUNCTION_BLOCK__VERSION, oldVersion, version));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public FBFeature getConfiguration() {
return configuration;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetConfiguration(FBFeature newConfiguration, NotificationChain msgs) {
FBFeature oldConfiguration = configuration;
configuration = newConfiguration;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FunctionblockPackage.FUNCTION_BLOCK__CONFIGURATION, oldConfiguration, newConfiguration);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setConfiguration(FBFeature newConfiguration) {
if (newConfiguration != configuration) {
NotificationChain msgs = null;
if (configuration != null)
msgs = ((InternalEObject)configuration).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FunctionblockPackage.FUNCTION_BLOCK__CONFIGURATION, null, msgs);
if (newConfiguration != null)
msgs = ((InternalEObject)newConfiguration).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FunctionblockPackage.FUNCTION_BLOCK__CONFIGURATION, null, msgs);
msgs = basicSetConfiguration(newConfiguration, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FunctionblockPackage.FUNCTION_BLOCK__CONFIGURATION, newConfiguration, newConfiguration));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public FBFeature getStatus() {
return status;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetStatus(FBFeature newStatus, NotificationChain msgs) {
FBFeature oldStatus = status;
status = newStatus;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FunctionblockPackage.FUNCTION_BLOCK__STATUS, oldStatus, newStatus);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setStatus(FBFeature newStatus) {
if (newStatus != status) {
NotificationChain msgs = null;
if (status != null)
msgs = ((InternalEObject)status).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FunctionblockPackage.FUNCTION_BLOCK__STATUS, null, msgs);
if (newStatus != null)
msgs = ((InternalEObject)newStatus).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FunctionblockPackage.FUNCTION_BLOCK__STATUS, null, msgs);
msgs = basicSetStatus(newStatus, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FunctionblockPackage.FUNCTION_BLOCK__STATUS, newStatus, newStatus));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public FBFeature getFault() {
return fault;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetFault(FBFeature newFault, NotificationChain msgs) {
FBFeature oldFault = fault;
fault = newFault;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FunctionblockPackage.FUNCTION_BLOCK__FAULT, oldFault, newFault);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setFault(FBFeature newFault) {
if (newFault != fault) {
NotificationChain msgs = null;
if (fault != null)
msgs = ((InternalEObject)fault).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FunctionblockPackage.FUNCTION_BLOCK__FAULT, null, msgs);
if (newFault != null)
msgs = ((InternalEObject)newFault).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FunctionblockPackage.FUNCTION_BLOCK__FAULT, null, msgs);
msgs = basicSetFault(newFault, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FunctionblockPackage.FUNCTION_BLOCK__FAULT, newFault, newFault));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Operation> getFeatures() {
if (features == null) {
features = new EObjectContainmentEList<Operation>(Operation.class, this, FunctionblockPackage.FUNCTION_BLOCK__FEATURES);
}
return features;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Event> getEvents() {
if (events == null) {
events = new EObjectContainmentEList<Event>(Event.class, this, FunctionblockPackage.FUNCTION_BLOCK__EVENTS);
}
return events;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case FunctionblockPackage.FUNCTION_BLOCK__CONFIGURATION:
return basicSetConfiguration(null, msgs);
case FunctionblockPackage.FUNCTION_BLOCK__STATUS:
return basicSetStatus(null, msgs);
case FunctionblockPackage.FUNCTION_BLOCK__FAULT:
return basicSetFault(null, msgs);
case FunctionblockPackage.FUNCTION_BLOCK__FEATURES:
return ((InternalEList<?>)getFeatures()).basicRemove(otherEnd, msgs);
case FunctionblockPackage.FUNCTION_BLOCK__EVENTS:
return ((InternalEList<?>)getEvents()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case FunctionblockPackage.FUNCTION_BLOCK__DISPLAYNAME:
return getDisplayname();
case FunctionblockPackage.FUNCTION_BLOCK__DESCRIPTION:
return getDescription();
case FunctionblockPackage.FUNCTION_BLOCK__VENDOR:
return getVendor();
case FunctionblockPackage.FUNCTION_BLOCK__CATEGORY:
return getCategory();
case FunctionblockPackage.FUNCTION_BLOCK__VERSION:
return getVersion();
case FunctionblockPackage.FUNCTION_BLOCK__CONFIGURATION:
return getConfiguration();
case FunctionblockPackage.FUNCTION_BLOCK__STATUS:
return getStatus();
case FunctionblockPackage.FUNCTION_BLOCK__FAULT:
return getFault();
case FunctionblockPackage.FUNCTION_BLOCK__FEATURES:
return getFeatures();
case FunctionblockPackage.FUNCTION_BLOCK__EVENTS:
return getEvents();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case FunctionblockPackage.FUNCTION_BLOCK__DISPLAYNAME:
setDisplayname((String)newValue);
return;
case FunctionblockPackage.FUNCTION_BLOCK__DESCRIPTION:
setDescription((String)newValue);
return;
case FunctionblockPackage.FUNCTION_BLOCK__VENDOR:
setVendor((String)newValue);
return;
case FunctionblockPackage.FUNCTION_BLOCK__CATEGORY:
setCategory((String)newValue);
return;
case FunctionblockPackage.FUNCTION_BLOCK__VERSION:
setVersion((String)newValue);
return;
case FunctionblockPackage.FUNCTION_BLOCK__CONFIGURATION:
setConfiguration((FBFeature)newValue);
return;
case FunctionblockPackage.FUNCTION_BLOCK__STATUS:
setStatus((FBFeature)newValue);
return;
case FunctionblockPackage.FUNCTION_BLOCK__FAULT:
setFault((FBFeature)newValue);
return;
case FunctionblockPackage.FUNCTION_BLOCK__FEATURES:
getFeatures().clear();
getFeatures().addAll((Collection<? extends Operation>)newValue);
return;
case FunctionblockPackage.FUNCTION_BLOCK__EVENTS:
getEvents().clear();
getEvents().addAll((Collection<? extends Event>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case FunctionblockPackage.FUNCTION_BLOCK__DISPLAYNAME:
setDisplayname(DISPLAYNAME_EDEFAULT);
return;
case FunctionblockPackage.FUNCTION_BLOCK__DESCRIPTION:
setDescription(DESCRIPTION_EDEFAULT);
return;
case FunctionblockPackage.FUNCTION_BLOCK__VENDOR:
setVendor(VENDOR_EDEFAULT);
return;
case FunctionblockPackage.FUNCTION_BLOCK__CATEGORY:
setCategory(CATEGORY_EDEFAULT);
return;
case FunctionblockPackage.FUNCTION_BLOCK__VERSION:
setVersion(VERSION_EDEFAULT);
return;
case FunctionblockPackage.FUNCTION_BLOCK__CONFIGURATION:
setConfiguration((FBFeature)null);
return;
case FunctionblockPackage.FUNCTION_BLOCK__STATUS:
setStatus((FBFeature)null);
return;
case FunctionblockPackage.FUNCTION_BLOCK__FAULT:
setFault((FBFeature)null);
return;
case FunctionblockPackage.FUNCTION_BLOCK__FEATURES:
getFeatures().clear();
return;
case FunctionblockPackage.FUNCTION_BLOCK__EVENTS:
getEvents().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case FunctionblockPackage.FUNCTION_BLOCK__DISPLAYNAME:
return DISPLAYNAME_EDEFAULT == null ? displayname != null : !DISPLAYNAME_EDEFAULT.equals(displayname);
case FunctionblockPackage.FUNCTION_BLOCK__DESCRIPTION:
return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
case FunctionblockPackage.FUNCTION_BLOCK__VENDOR:
return VENDOR_EDEFAULT == null ? vendor != null : !VENDOR_EDEFAULT.equals(vendor);
case FunctionblockPackage.FUNCTION_BLOCK__CATEGORY:
return CATEGORY_EDEFAULT == null ? category != null : !CATEGORY_EDEFAULT.equals(category);
case FunctionblockPackage.FUNCTION_BLOCK__VERSION:
return VERSION_EDEFAULT == null ? version != null : !VERSION_EDEFAULT.equals(version);
case FunctionblockPackage.FUNCTION_BLOCK__CONFIGURATION:
return configuration != null;
case FunctionblockPackage.FUNCTION_BLOCK__STATUS:
return status != null;
case FunctionblockPackage.FUNCTION_BLOCK__FAULT:
return fault != null;
case FunctionblockPackage.FUNCTION_BLOCK__FEATURES:
return features != null && !features.isEmpty();
case FunctionblockPackage.FUNCTION_BLOCK__EVENTS:
return events != null && !events.isEmpty();
}
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(" (displayname: ");
result.append(displayname);
result.append(", description: ");
result.append(description);
result.append(", vendor: ");
result.append(vendor);
result.append(", category: ");
result.append(category);
result.append(", version: ");
result.append(version);
result.append(')');
return result.toString();
}
} //FunctionBlockImpl