BehaviorTimeImpl.java
/**
* AADL-BA-FrontEnd
*
* Copyright (c) 2011-2021 TELECOM ParisTech and CNRS
*
* TELECOM ParisTech/LTCI
*
* Authors: see AUTHORS
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the Eclipse Public License as published by Eclipse, either
* version 2.0 of the License, or (at your option) any later version. This
* program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the Eclipse Public License for
* more details. You should have received a copy of the Eclipse Public License
* along with this program. If not, see
* https://www.eclipse.org/legal/epl-2.0/
*/
package org.osate.ba.aadlba.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.EObject;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.osate.aadl2.UnitLiteral;
import org.osate.ba.aadlba.AadlBaPackage;
import org.osate.ba.aadlba.BehaviorTime;
import org.osate.ba.aadlba.IntegerValue;
import org.osate.ba.utils.visitor.IBAVisitor;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Behavior Time</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.osate.ba.aadlba.impl.BehaviorTimeImpl#getIntegerValue <em>Integer Value</em>}</li>
* <li>{@link org.osate.ba.aadlba.impl.BehaviorTimeImpl#getUnit <em>Unit</em>}</li>
* </ul>
*
* @generated
*/
public class BehaviorTimeImpl extends BehaviorElementImpl implements BehaviorTime {
/**
* The cached value of the '{@link #getIntegerValue() <em>Integer Value</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getIntegerValue()
* @generated
* @ordered
*/
protected IntegerValue integerValue;
/**
* The cached value of the '{@link #getUnit() <em>Unit</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getUnit()
* @generated
* @ordered
*/
protected UnitLiteral unit;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected BehaviorTimeImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return AadlBaPackage.Literals.BEHAVIOR_TIME;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public IntegerValue getIntegerValue() {
return integerValue;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetIntegerValue(IntegerValue newIntegerValue, NotificationChain msgs) {
IntegerValue oldIntegerValue = integerValue;
integerValue = newIntegerValue;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET,
AadlBaPackage.BEHAVIOR_TIME__INTEGER_VALUE, oldIntegerValue, newIntegerValue);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setIntegerValue(IntegerValue newIntegerValue) {
if (newIntegerValue != integerValue) {
NotificationChain msgs = null;
if (integerValue != null)
msgs = ((InternalEObject) integerValue).eInverseRemove(this,
EOPPOSITE_FEATURE_BASE - AadlBaPackage.BEHAVIOR_TIME__INTEGER_VALUE, null, msgs);
if (newIntegerValue != null)
msgs = ((InternalEObject) newIntegerValue).eInverseAdd(this,
EOPPOSITE_FEATURE_BASE - AadlBaPackage.BEHAVIOR_TIME__INTEGER_VALUE, null, msgs);
msgs = basicSetIntegerValue(newIntegerValue, msgs);
if (msgs != null)
msgs.dispatch();
} else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AadlBaPackage.BEHAVIOR_TIME__INTEGER_VALUE,
newIntegerValue, newIntegerValue));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public UnitLiteral getUnit() {
if (unit != null && ((EObject) unit).eIsProxy()) {
InternalEObject oldUnit = (InternalEObject) unit;
unit = (UnitLiteral) eResolveProxy(oldUnit);
if (unit != oldUnit) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, AadlBaPackage.BEHAVIOR_TIME__UNIT,
oldUnit, unit));
}
}
return unit;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public UnitLiteral basicGetUnit() {
return unit;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setUnit(UnitLiteral newUnit) {
UnitLiteral oldUnit = unit;
unit = newUnit;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AadlBaPackage.BEHAVIOR_TIME__UNIT, oldUnit, unit));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case AadlBaPackage.BEHAVIOR_TIME__INTEGER_VALUE:
return basicSetIntegerValue(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 AadlBaPackage.BEHAVIOR_TIME__INTEGER_VALUE:
return getIntegerValue();
case AadlBaPackage.BEHAVIOR_TIME__UNIT:
if (resolve)
return getUnit();
return basicGetUnit();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case AadlBaPackage.BEHAVIOR_TIME__INTEGER_VALUE:
setIntegerValue((IntegerValue) newValue);
return;
case AadlBaPackage.BEHAVIOR_TIME__UNIT:
setUnit((UnitLiteral) newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case AadlBaPackage.BEHAVIOR_TIME__INTEGER_VALUE:
setIntegerValue((IntegerValue) null);
return;
case AadlBaPackage.BEHAVIOR_TIME__UNIT:
setUnit((UnitLiteral) null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case AadlBaPackage.BEHAVIOR_TIME__INTEGER_VALUE:
return integerValue != null;
case AadlBaPackage.BEHAVIOR_TIME__UNIT:
return unit != null;
}
return super.eIsSet(featureID);
}
public void accept(IBAVisitor visitor) {
visitor.visit(this);
}
} // BehaviorTimeImpl