123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443 |
- /**
- */
- package ua.ansymo.hintco.impl;
- import java.lang.reflect.InvocationTargetException;
- import org.eclipse.emf.common.notify.Notification;
- import org.eclipse.emf.common.notify.NotificationChain;
- import org.eclipse.emf.common.util.BasicEList;
- 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.util.EcoreUtil;
- import ua.ansymo.hintco.DecompositionPortAdaptation;
- import ua.ansymo.hintco.HintcoPackage;
- import ua.ansymo.hintco.IDed;
- import ua.ansymo.hintco.PortAdaptation;
- import ua.ansymo.hintco.PortInstance;
- import ua.ansymo.hintco.UnitInstance;
- /**
- * <!-- begin-user-doc -->
- * An implementation of the model object '<em><b>Port Instance</b></em>'.
- * <!-- end-user-doc -->
- * <p>
- * The following features are implemented:
- * </p>
- * <ul>
- * <li>{@link ua.ansymo.hintco.impl.PortInstanceImpl#getIdentifier <em>Identifier</em>}</li>
- * <li>{@link ua.ansymo.hintco.impl.PortInstanceImpl#getUnit <em>Unit</em>}</li>
- * <li>{@link ua.ansymo.hintco.impl.PortInstanceImpl#getAdaptation <em>Adaptation</em>}</li>
- * </ul>
- *
- * @generated
- */
- public abstract class PortInstanceImpl extends PrecendenceNodeImpl implements PortInstance {
- /**
- * The default value of the '{@link #getIdentifier() <em>Identifier</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getIdentifier()
- * @generated
- * @ordered
- */
- protected static final String IDENTIFIER_EDEFAULT = null;
- /**
- * The cached value of the '{@link #getIdentifier() <em>Identifier</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getIdentifier()
- * @generated
- * @ordered
- */
- protected String identifier = IDENTIFIER_EDEFAULT;
- /**
- * The cached value of the '{@link #getAdaptation() <em>Adaptation</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getAdaptation()
- * @generated
- * @ordered
- */
- protected PortAdaptation adaptation;
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected PortInstanceImpl() {
- super();
- }
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return HintcoPackage.Literals.PORT_INSTANCE;
- }
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public String getIdentifier() {
- return identifier;
- }
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void setIdentifier(String newIdentifier) {
- String oldIdentifier = identifier;
- identifier = newIdentifier;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, HintcoPackage.PORT_INSTANCE__IDENTIFIER, oldIdentifier, identifier));
- }
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public UnitInstance getUnit() {
- if (eContainerFeatureID() != HintcoPackage.PORT_INSTANCE__UNIT) return null;
- return (UnitInstance)eContainer();
- }
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public UnitInstance basicGetUnit() {
- if (eContainerFeatureID() != HintcoPackage.PORT_INSTANCE__UNIT) return null;
- return (UnitInstance)eInternalContainer();
- }
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NotificationChain basicSetUnit(UnitInstance newUnit, NotificationChain msgs) {
- msgs = eBasicSetContainer((InternalEObject)newUnit, HintcoPackage.PORT_INSTANCE__UNIT, msgs);
- return msgs;
- }
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void setUnit(UnitInstance newUnit) {
- if (newUnit != eInternalContainer() || (eContainerFeatureID() != HintcoPackage.PORT_INSTANCE__UNIT && newUnit != null)) {
- if (EcoreUtil.isAncestor(this, newUnit))
- throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
- NotificationChain msgs = null;
- if (eInternalContainer() != null)
- msgs = eBasicRemoveFromContainer(msgs);
- if (newUnit != null)
- msgs = ((InternalEObject)newUnit).eInverseAdd(this, HintcoPackage.UNIT_INSTANCE__PORTS, UnitInstance.class, msgs);
- msgs = basicSetUnit(newUnit, msgs);
- if (msgs != null) msgs.dispatch();
- }
- else if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, HintcoPackage.PORT_INSTANCE__UNIT, newUnit, newUnit));
- }
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public PortAdaptation getAdaptation() {
- return adaptation;
- }
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NotificationChain basicSetAdaptation(PortAdaptation newAdaptation, NotificationChain msgs) {
- PortAdaptation oldAdaptation = adaptation;
- adaptation = newAdaptation;
- if (eNotificationRequired()) {
- ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, HintcoPackage.PORT_INSTANCE__ADAPTATION, oldAdaptation, newAdaptation);
- if (msgs == null) msgs = notification; else msgs.add(notification);
- }
- return msgs;
- }
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void setAdaptation(PortAdaptation newAdaptation) {
- if (newAdaptation != adaptation) {
- NotificationChain msgs = null;
- if (adaptation != null)
- msgs = ((InternalEObject)adaptation).eInverseRemove(this, HintcoPackage.PORT_ADAPTATION__PORT, PortAdaptation.class, msgs);
- if (newAdaptation != null)
- msgs = ((InternalEObject)newAdaptation).eInverseAdd(this, HintcoPackage.PORT_ADAPTATION__PORT, PortAdaptation.class, msgs);
- msgs = basicSetAdaptation(newAdaptation, msgs);
- if (msgs != null) msgs.dispatch();
- }
- else if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, HintcoPackage.PORT_INSTANCE__ADAPTATION, newAdaptation, newAdaptation));
- }
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EList<PortAdaptation> selectedAdaptations() {
- PortAdaptation _adaptation = this.getAdaptation();
- boolean _tripleEquals = (_adaptation == null);
- if (_tripleEquals) {
- return new BasicEList<PortAdaptation>(java.util.Collections.<PortAdaptation>unmodifiableList(org.eclipse.xtext.xbase.lib.CollectionLiterals.<PortAdaptation>newArrayList()));
- }
- boolean _isSelected = this.getAdaptation().isSelected();
- if (_isSelected) {
- PortAdaptation _adaptation_1 = this.getAdaptation();
- if ((_adaptation_1 instanceof DecompositionPortAdaptation)) {
- PortAdaptation _adaptation_2 = this.getAdaptation();
- return ((DecompositionPortAdaptation) _adaptation_2).selectedAdaptations();
- }
- PortAdaptation _adaptation_3 = this.getAdaptation();
- return new BasicEList<PortAdaptation>(java.util.Collections.<PortAdaptation>unmodifiableList(org.eclipse.xtext.xbase.lib.CollectionLiterals.<PortAdaptation>newArrayList(_adaptation_3)));
- }
- return new BasicEList<PortAdaptation>(java.util.Collections.<PortAdaptation>unmodifiableList(org.eclipse.xtext.xbase.lib.CollectionLiterals.<PortAdaptation>newArrayList()));
- }
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public boolean isInput() {
- return false;
- }
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public boolean getsValueFrom(final PortInstance p) {
- return false;
- }
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public String toString() {
- String _string = this.getUnit().toString();
- String _plus = (_string + ".");
- String _identifier = this.getIdentifier();
- return (_plus + _identifier);
- }
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case HintcoPackage.PORT_INSTANCE__UNIT:
- if (eInternalContainer() != null)
- msgs = eBasicRemoveFromContainer(msgs);
- return basicSetUnit((UnitInstance)otherEnd, msgs);
- case HintcoPackage.PORT_INSTANCE__ADAPTATION:
- if (adaptation != null)
- msgs = ((InternalEObject)adaptation).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - HintcoPackage.PORT_INSTANCE__ADAPTATION, null, msgs);
- return basicSetAdaptation((PortAdaptation)otherEnd, msgs);
- }
- return super.eInverseAdd(otherEnd, featureID, msgs);
- }
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case HintcoPackage.PORT_INSTANCE__UNIT:
- return basicSetUnit(null, msgs);
- case HintcoPackage.PORT_INSTANCE__ADAPTATION:
- return basicSetAdaptation(null, msgs);
- }
- return super.eInverseRemove(otherEnd, featureID, msgs);
- }
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) {
- switch (eContainerFeatureID()) {
- case HintcoPackage.PORT_INSTANCE__UNIT:
- return eInternalContainer().eInverseRemove(this, HintcoPackage.UNIT_INSTANCE__PORTS, UnitInstance.class, msgs);
- }
- return super.eBasicRemoveFromContainerFeature(msgs);
- }
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case HintcoPackage.PORT_INSTANCE__IDENTIFIER:
- return getIdentifier();
- case HintcoPackage.PORT_INSTANCE__UNIT:
- if (resolve) return getUnit();
- return basicGetUnit();
- case HintcoPackage.PORT_INSTANCE__ADAPTATION:
- return getAdaptation();
- }
- return super.eGet(featureID, resolve, coreType);
- }
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case HintcoPackage.PORT_INSTANCE__IDENTIFIER:
- setIdentifier((String)newValue);
- return;
- case HintcoPackage.PORT_INSTANCE__UNIT:
- setUnit((UnitInstance)newValue);
- return;
- case HintcoPackage.PORT_INSTANCE__ADAPTATION:
- setAdaptation((PortAdaptation)newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case HintcoPackage.PORT_INSTANCE__IDENTIFIER:
- setIdentifier(IDENTIFIER_EDEFAULT);
- return;
- case HintcoPackage.PORT_INSTANCE__UNIT:
- setUnit((UnitInstance)null);
- return;
- case HintcoPackage.PORT_INSTANCE__ADAPTATION:
- setAdaptation((PortAdaptation)null);
- return;
- }
- super.eUnset(featureID);
- }
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case HintcoPackage.PORT_INSTANCE__IDENTIFIER:
- return IDENTIFIER_EDEFAULT == null ? identifier != null : !IDENTIFIER_EDEFAULT.equals(identifier);
- case HintcoPackage.PORT_INSTANCE__UNIT:
- return basicGetUnit() != null;
- case HintcoPackage.PORT_INSTANCE__ADAPTATION:
- return adaptation != null;
- }
- return super.eIsSet(featureID);
- }
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == IDed.class) {
- switch (derivedFeatureID) {
- case HintcoPackage.PORT_INSTANCE__IDENTIFIER: return HintcoPackage.IDED__IDENTIFIER;
- default: return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == IDed.class) {
- switch (baseFeatureID) {
- case HintcoPackage.IDED__IDENTIFIER: return HintcoPackage.PORT_INSTANCE__IDENTIFIER;
- default: return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eInvoke(int operationID, EList<?> arguments) throws InvocationTargetException {
- switch (operationID) {
- case HintcoPackage.PORT_INSTANCE___SELECTED_ADAPTATIONS:
- return selectedAdaptations();
- case HintcoPackage.PORT_INSTANCE___IS_INPUT:
- return isInput();
- case HintcoPackage.PORT_INSTANCE___GETS_VALUE_FROM__PORTINSTANCE:
- return getsValueFrom((PortInstance)arguments.get(0));
- case HintcoPackage.PORT_INSTANCE___TO_STRING:
- return toString();
- }
- return super.eInvoke(operationID, arguments);
- }
- } //PortInstanceImpl
|