blob: bcd9706f259d383a55ba89dc1636f6397c06ca96 [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.common.notify.NotificationChain;
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.vorto.functionblock.FunctionblockPackage;
import org.eclipse.vorto.functionblock.Presence;
import org.eclipse.vorto.functionblock.Property;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Property</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.vorto.functionblock.impl.PropertyImpl#getPresence <em>Presence</em>}</li>
* <li>{@link org.eclipse.vorto.functionblock.impl.PropertyImpl#getMultiplicity <em>Multiplicity</em>}</li>
* <li>{@link org.eclipse.vorto.functionblock.impl.PropertyImpl#getPropName <em>Prop Name</em>}</li>
* <li>{@link org.eclipse.vorto.functionblock.impl.PropertyImpl#getDescription <em>Description</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class PropertyImpl extends MinimalEObjectImpl.Container implements Property {
/**
* The cached value of the '{@link #getPresence() <em>Presence</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPresence()
* @generated
* @ordered
*/
protected Presence presence;
/**
* The default value of the '{@link #getMultiplicity() <em>Multiplicity</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getMultiplicity()
* @generated
* @ordered
*/
protected static final String MULTIPLICITY_EDEFAULT = null;
/**
* The cached value of the '{@link #getMultiplicity() <em>Multiplicity</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getMultiplicity()
* @generated
* @ordered
*/
protected String multiplicity = MULTIPLICITY_EDEFAULT;
/**
* The default value of the '{@link #getPropName() <em>Prop Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPropName()
* @generated
* @ordered
*/
protected static final String PROP_NAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getPropName() <em>Prop Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPropName()
* @generated
* @ordered
*/
protected String propName = PROP_NAME_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;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected PropertyImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return FunctionblockPackage.Literals.PROPERTY;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Presence getPresence() {
return presence;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetPresence(Presence newPresence, NotificationChain msgs) {
Presence oldPresence = presence;
presence = newPresence;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FunctionblockPackage.PROPERTY__PRESENCE, oldPresence, newPresence);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setPresence(Presence newPresence) {
if (newPresence != presence) {
NotificationChain msgs = null;
if (presence != null)
msgs = ((InternalEObject)presence).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FunctionblockPackage.PROPERTY__PRESENCE, null, msgs);
if (newPresence != null)
msgs = ((InternalEObject)newPresence).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FunctionblockPackage.PROPERTY__PRESENCE, null, msgs);
msgs = basicSetPresence(newPresence, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FunctionblockPackage.PROPERTY__PRESENCE, newPresence, newPresence));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getMultiplicity() {
return multiplicity;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setMultiplicity(String newMultiplicity) {
String oldMultiplicity = multiplicity;
multiplicity = newMultiplicity;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FunctionblockPackage.PROPERTY__MULTIPLICITY, oldMultiplicity, multiplicity));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getPropName() {
return propName;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setPropName(String newPropName) {
String oldPropName = propName;
propName = newPropName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FunctionblockPackage.PROPERTY__PROP_NAME, oldPropName, propName));
}
/**
* <!-- 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.PROPERTY__DESCRIPTION, oldDescription, description));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case FunctionblockPackage.PROPERTY__PRESENCE:
return basicSetPresence(null, 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.PROPERTY__PRESENCE:
return getPresence();
case FunctionblockPackage.PROPERTY__MULTIPLICITY:
return getMultiplicity();
case FunctionblockPackage.PROPERTY__PROP_NAME:
return getPropName();
case FunctionblockPackage.PROPERTY__DESCRIPTION:
return getDescription();
}
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.PROPERTY__PRESENCE:
setPresence((Presence)newValue);
return;
case FunctionblockPackage.PROPERTY__MULTIPLICITY:
setMultiplicity((String)newValue);
return;
case FunctionblockPackage.PROPERTY__PROP_NAME:
setPropName((String)newValue);
return;
case FunctionblockPackage.PROPERTY__DESCRIPTION:
setDescription((String)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case FunctionblockPackage.PROPERTY__PRESENCE:
setPresence((Presence)null);
return;
case FunctionblockPackage.PROPERTY__MULTIPLICITY:
setMultiplicity(MULTIPLICITY_EDEFAULT);
return;
case FunctionblockPackage.PROPERTY__PROP_NAME:
setPropName(PROP_NAME_EDEFAULT);
return;
case FunctionblockPackage.PROPERTY__DESCRIPTION:
setDescription(DESCRIPTION_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case FunctionblockPackage.PROPERTY__PRESENCE:
return presence != null;
case FunctionblockPackage.PROPERTY__MULTIPLICITY:
return MULTIPLICITY_EDEFAULT == null ? multiplicity != null : !MULTIPLICITY_EDEFAULT.equals(multiplicity);
case FunctionblockPackage.PROPERTY__PROP_NAME:
return PROP_NAME_EDEFAULT == null ? propName != null : !PROP_NAME_EDEFAULT.equals(propName);
case FunctionblockPackage.PROPERTY__DESCRIPTION:
return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
}
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(" (multiplicity: ");
result.append(multiplicity);
result.append(", propName: ");
result.append(propName);
result.append(", description: ");
result.append(description);
result.append(')');
return result.toString();
}
} //PropertyImpl