blob: b70808d11ab29b9c6639def6b77f81d5dac2f648 [file] [log] [blame]
/**
* *******************************************************************************
* Copyright (c) 2015-2021 Robert Bosch GmbH and others.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Generated using Eclipse EMF
*
* *******************************************************************************
*/
package org.eclipse.app4mc.amalthea.model.impl;
import org.eclipse.app4mc.amalthea.model.AmaltheaPackage;
import org.eclipse.app4mc.amalthea.model.PowerDomain;
import org.eclipse.app4mc.amalthea.model.Voltage;
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;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Power Domain</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.app4mc.amalthea.model.impl.PowerDomainImpl#getDefaultValue <em>Default Value</em>}</li>
* <li>{@link org.eclipse.app4mc.amalthea.model.impl.PowerDomainImpl#isPowerGating <em>Power Gating</em>}</li>
* </ul>
*
* @generated
*/
public class PowerDomainImpl extends HwDomainImpl implements PowerDomain {
/**
* The cached value of the '{@link #getDefaultValue() <em>Default Value</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDefaultValue()
* @generated
* @ordered
*/
protected Voltage defaultValue;
/**
* The default value of the '{@link #isPowerGating() <em>Power Gating</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isPowerGating()
* @generated
* @ordered
*/
protected static final boolean POWER_GATING_EDEFAULT = false;
/**
* The cached value of the '{@link #isPowerGating() <em>Power Gating</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isPowerGating()
* @generated
* @ordered
*/
protected boolean powerGating = POWER_GATING_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected PowerDomainImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return AmaltheaPackage.eINSTANCE.getPowerDomain();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Voltage getDefaultValue() {
return defaultValue;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetDefaultValue(Voltage newDefaultValue, NotificationChain msgs) {
Voltage oldDefaultValue = defaultValue;
defaultValue = newDefaultValue;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AmaltheaPackage.POWER_DOMAIN__DEFAULT_VALUE, oldDefaultValue, newDefaultValue);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setDefaultValue(Voltage newDefaultValue) {
if (newDefaultValue != defaultValue) {
NotificationChain msgs = null;
if (defaultValue != null)
msgs = ((InternalEObject)defaultValue).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AmaltheaPackage.POWER_DOMAIN__DEFAULT_VALUE, null, msgs);
if (newDefaultValue != null)
msgs = ((InternalEObject)newDefaultValue).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AmaltheaPackage.POWER_DOMAIN__DEFAULT_VALUE, null, msgs);
msgs = basicSetDefaultValue(newDefaultValue, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AmaltheaPackage.POWER_DOMAIN__DEFAULT_VALUE, newDefaultValue, newDefaultValue));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean isPowerGating() {
return powerGating;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setPowerGating(boolean newPowerGating) {
boolean oldPowerGating = powerGating;
powerGating = newPowerGating;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AmaltheaPackage.POWER_DOMAIN__POWER_GATING, oldPowerGating, powerGating));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case AmaltheaPackage.POWER_DOMAIN__DEFAULT_VALUE:
return basicSetDefaultValue(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 AmaltheaPackage.POWER_DOMAIN__DEFAULT_VALUE:
return getDefaultValue();
case AmaltheaPackage.POWER_DOMAIN__POWER_GATING:
return isPowerGating();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case AmaltheaPackage.POWER_DOMAIN__DEFAULT_VALUE:
setDefaultValue((Voltage)newValue);
return;
case AmaltheaPackage.POWER_DOMAIN__POWER_GATING:
setPowerGating((Boolean)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case AmaltheaPackage.POWER_DOMAIN__DEFAULT_VALUE:
setDefaultValue((Voltage)null);
return;
case AmaltheaPackage.POWER_DOMAIN__POWER_GATING:
setPowerGating(POWER_GATING_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case AmaltheaPackage.POWER_DOMAIN__DEFAULT_VALUE:
return defaultValue != null;
case AmaltheaPackage.POWER_DOMAIN__POWER_GATING:
return powerGating != POWER_GATING_EDEFAULT;
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuilder result = new StringBuilder(super.toString());
result.append(" (powerGating: ");
result.append(powerGating);
result.append(')');
return result.toString();
}
} //PowerDomainImpl