diff options
Diffstat (limited to 'extraplugins/eastadl/org.eclipse.papyrus.eastadl/src/org/eclipse/papyrus/eastadl/genericconstraints/impl/GenericConstraintImpl.java')
-rw-r--r-- | extraplugins/eastadl/org.eclipse.papyrus.eastadl/src/org/eclipse/papyrus/eastadl/genericconstraints/impl/GenericConstraintImpl.java | 306 |
1 files changed, 131 insertions, 175 deletions
diff --git a/extraplugins/eastadl/org.eclipse.papyrus.eastadl/src/org/eclipse/papyrus/eastadl/genericconstraints/impl/GenericConstraintImpl.java b/extraplugins/eastadl/org.eclipse.papyrus.eastadl/src/org/eclipse/papyrus/eastadl/genericconstraints/impl/GenericConstraintImpl.java index 5fcf0ac4840..2205679a0a5 100644 --- a/extraplugins/eastadl/org.eclipse.papyrus.eastadl/src/org/eclipse/papyrus/eastadl/genericconstraints/impl/GenericConstraintImpl.java +++ b/extraplugins/eastadl/org.eclipse.papyrus.eastadl/src/org/eclipse/papyrus/eastadl/genericconstraints/impl/GenericConstraintImpl.java @@ -16,6 +16,7 @@ package org.eclipse.papyrus.eastadl.genericconstraints.impl; import java.util.Collection; +import java.util.Iterator; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.util.EList; @@ -28,8 +29,11 @@ import org.eclipse.papyrus.eastadl.genericconstraints.GenericConstraint; import org.eclipse.papyrus.eastadl.genericconstraints.GenericConstraintKind; import org.eclipse.papyrus.eastadl.genericconstraints.GenericconstraintsPackage; import org.eclipse.papyrus.eastadl.infrastructure.elements.impl.TraceableSpecificationImpl; +import org.eclipse.papyrus.eastadl.infrastructure.values.EAValue; import org.eclipse.uml2.uml.Constraint; +import org.eclipse.uml2.uml.Element; import org.eclipse.uml2.uml.NamedElement; +import org.eclipse.uml2.uml.util.UMLUtil; /** @@ -39,46 +43,42 @@ import org.eclipse.uml2.uml.NamedElement; * <p> * The following features are implemented: * <ul> - * <li>{@link org.eclipse.papyrus.eastadl.genericconstraints.impl.GenericConstraintImpl#getDesignConstraintType <em>Design Constraint Type</em>}</li> - * <li>{@link org.eclipse.papyrus.eastadl.genericconstraints.impl.GenericConstraintImpl#getBase_Constraint <em>Base Constraint</em>}</li> - * <li>{@link org.eclipse.papyrus.eastadl.genericconstraints.impl.GenericConstraintImpl#getGenericConstraintValue <em>Generic Constraint Value</em>}</li> - * <li>{@link org.eclipse.papyrus.eastadl.genericconstraints.impl.GenericConstraintImpl#getBase_Class <em>Base Class</em>}</li> - * <li>{@link org.eclipse.papyrus.eastadl.genericconstraints.impl.GenericConstraintImpl#getTarget <em>Target</em>}</li> - * <li>{@link org.eclipse.papyrus.eastadl.genericconstraints.impl.GenericConstraintImpl#getMode <em>Mode</em>}</li> + * <li>{@link org.eclipse.papyrus.eastadl.genericconstraints.impl.GenericConstraintImpl#getKind <em>Kind</em>}</li> + * <li>{@link org.eclipse.papyrus.eastadl.genericconstraints.impl.GenericConstraintImpl#getBase_Constraint <em>Base Constraint</em>}</li> + * <li>{@link org.eclipse.papyrus.eastadl.genericconstraints.impl.GenericConstraintImpl#getBase_Class <em>Base Class</em>}</li> + * <li>{@link org.eclipse.papyrus.eastadl.genericconstraints.impl.GenericConstraintImpl#getTarget <em>Target</em>}</li> + * <li>{@link org.eclipse.papyrus.eastadl.genericconstraints.impl.GenericConstraintImpl#getMode <em>Mode</em>}</li> + * <li>{@link org.eclipse.papyrus.eastadl.genericconstraints.impl.GenericConstraintImpl#getValue <em>Value</em>}</li> * </ul> * </p> - * + * * @generated */ public class GenericConstraintImpl extends TraceableSpecificationImpl implements GenericConstraint { - /** - * The default value of the '{@link #getDesignConstraintType() <em>Design Constraint Type</em>}' attribute. + * The default value of the '{@link #getKind() <em>Kind</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> - * - * @see #getDesignConstraintType() + * @see #getKind() * @generated * @ordered */ - protected static final GenericConstraintKind DESIGN_CONSTRAINT_TYPE_EDEFAULT = GenericConstraintKind.POWER_CONSUMPTION; + protected static final GenericConstraintKind KIND_EDEFAULT = GenericConstraintKind.CABLE_LENGTH; /** - * The cached value of the '{@link #getDesignConstraintType() <em>Design Constraint Type</em>}' attribute. + * The cached value of the '{@link #getKind() <em>Kind</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> - * - * @see #getDesignConstraintType() + * @see #getKind() * @generated * @ordered */ - protected GenericConstraintKind designConstraintType = DESIGN_CONSTRAINT_TYPE_EDEFAULT; + protected GenericConstraintKind kind = KIND_EDEFAULT; /** * The cached value of the '{@link #getBase_Constraint() <em>Base Constraint</em>}' reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> - * * @see #getBase_Constraint() * @generated * @ordered @@ -86,32 +86,9 @@ public class GenericConstraintImpl extends TraceableSpecificationImpl implements protected Constraint base_Constraint; /** - * The default value of the '{@link #getGenericConstraintValue() <em>Generic Constraint Value</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @see #getGenericConstraintValue() - * @generated - * @ordered - */ - protected static final String GENERIC_CONSTRAINT_VALUE_EDEFAULT = null; - - /** - * The cached value of the '{@link #getGenericConstraintValue() <em>Generic Constraint Value</em>}' attribute. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @see #getGenericConstraintValue() - * @generated - * @ordered - */ - protected String genericConstraintValue = GENERIC_CONSTRAINT_VALUE_EDEFAULT; - - /** * The cached value of the '{@link #getBase_Class() <em>Base Class</em>}' reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> - * * @see #getBase_Class() * @generated * @ordered @@ -122,7 +99,6 @@ public class GenericConstraintImpl extends TraceableSpecificationImpl implements * The cached value of the '{@link #getTarget() <em>Target</em>}' reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> - * * @see #getTarget() * @generated * @ordered @@ -133,7 +109,6 @@ public class GenericConstraintImpl extends TraceableSpecificationImpl implements * The cached value of the '{@link #getMode() <em>Mode</em>}' reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> - * * @see #getMode() * @generated * @ordered @@ -143,7 +118,6 @@ public class GenericConstraintImpl extends TraceableSpecificationImpl implements /** * <!-- begin-user-doc --> * <!-- end-user-doc --> - * * @generated */ protected GenericConstraintImpl() { @@ -153,28 +127,26 @@ public class GenericConstraintImpl extends TraceableSpecificationImpl implements /** * <!-- begin-user-doc --> * <!-- end-user-doc --> - * * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch(featureID) { - case GenericconstraintsPackage.GENERIC_CONSTRAINT__DESIGN_CONSTRAINT_TYPE: - return getDesignConstraintType(); - case GenericconstraintsPackage.GENERIC_CONSTRAINT__BASE_CONSTRAINT: - if(resolve) - return getBase_Constraint(); - return basicGetBase_Constraint(); - case GenericconstraintsPackage.GENERIC_CONSTRAINT__GENERIC_CONSTRAINT_VALUE: - return getGenericConstraintValue(); - case GenericconstraintsPackage.GENERIC_CONSTRAINT__BASE_CLASS: - if(resolve) - return getBase_Class(); - return basicGetBase_Class(); - case GenericconstraintsPackage.GENERIC_CONSTRAINT__TARGET: - return getTarget(); - case GenericconstraintsPackage.GENERIC_CONSTRAINT__MODE: - return getMode(); + switch (featureID) { + case GenericconstraintsPackage.GENERIC_CONSTRAINT__KIND: + return getKind(); + case GenericconstraintsPackage.GENERIC_CONSTRAINT__BASE_CONSTRAINT: + if (resolve) return getBase_Constraint(); + return basicGetBase_Constraint(); + case GenericconstraintsPackage.GENERIC_CONSTRAINT__BASE_CLASS: + if (resolve) return getBase_Class(); + return basicGetBase_Class(); + case GenericconstraintsPackage.GENERIC_CONSTRAINT__TARGET: + return getTarget(); + case GenericconstraintsPackage.GENERIC_CONSTRAINT__MODE: + return getMode(); + case GenericconstraintsPackage.GENERIC_CONSTRAINT__VALUE: + if (resolve) return getValue(); + return basicGetValue(); } return super.eGet(featureID, resolve, coreType); } @@ -182,24 +154,23 @@ public class GenericConstraintImpl extends TraceableSpecificationImpl implements /** * <!-- begin-user-doc --> * <!-- end-user-doc --> - * * @generated */ @Override public boolean eIsSet(int featureID) { - switch(featureID) { - case GenericconstraintsPackage.GENERIC_CONSTRAINT__DESIGN_CONSTRAINT_TYPE: - return designConstraintType != DESIGN_CONSTRAINT_TYPE_EDEFAULT; - case GenericconstraintsPackage.GENERIC_CONSTRAINT__BASE_CONSTRAINT: - return base_Constraint != null; - case GenericconstraintsPackage.GENERIC_CONSTRAINT__GENERIC_CONSTRAINT_VALUE: - return GENERIC_CONSTRAINT_VALUE_EDEFAULT == null ? genericConstraintValue != null : !GENERIC_CONSTRAINT_VALUE_EDEFAULT.equals(genericConstraintValue); - case GenericconstraintsPackage.GENERIC_CONSTRAINT__BASE_CLASS: - return base_Class != null; - case GenericconstraintsPackage.GENERIC_CONSTRAINT__TARGET: - return target != null && !target.isEmpty(); - case GenericconstraintsPackage.GENERIC_CONSTRAINT__MODE: - return mode != null && !mode.isEmpty(); + switch (featureID) { + case GenericconstraintsPackage.GENERIC_CONSTRAINT__KIND: + return kind != KIND_EDEFAULT; + case GenericconstraintsPackage.GENERIC_CONSTRAINT__BASE_CONSTRAINT: + return base_Constraint != null; + case GenericconstraintsPackage.GENERIC_CONSTRAINT__BASE_CLASS: + return base_Class != null; + case GenericconstraintsPackage.GENERIC_CONSTRAINT__TARGET: + return target != null && !target.isEmpty(); + case GenericconstraintsPackage.GENERIC_CONSTRAINT__MODE: + return mode != null && !mode.isEmpty(); + case GenericconstraintsPackage.GENERIC_CONSTRAINT__VALUE: + return basicGetValue() != null; } return super.eIsSet(featureID); } @@ -207,33 +178,29 @@ public class GenericConstraintImpl extends TraceableSpecificationImpl implements /** * <!-- begin-user-doc --> * <!-- end-user-doc --> - * * @generated */ @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { - switch(featureID) { - case GenericconstraintsPackage.GENERIC_CONSTRAINT__DESIGN_CONSTRAINT_TYPE: - setDesignConstraintType((GenericConstraintKind)newValue); - return; - case GenericconstraintsPackage.GENERIC_CONSTRAINT__BASE_CONSTRAINT: - setBase_Constraint((Constraint)newValue); - return; - case GenericconstraintsPackage.GENERIC_CONSTRAINT__GENERIC_CONSTRAINT_VALUE: - setGenericConstraintValue((String)newValue); - return; - case GenericconstraintsPackage.GENERIC_CONSTRAINT__BASE_CLASS: - setBase_Class((org.eclipse.uml2.uml.Class)newValue); - return; - case GenericconstraintsPackage.GENERIC_CONSTRAINT__TARGET: - getTarget().clear(); - getTarget().addAll((Collection<? extends NamedElement>)newValue); - return; - case GenericconstraintsPackage.GENERIC_CONSTRAINT__MODE: - getMode().clear(); - getMode().addAll((Collection<? extends Mode>)newValue); - return; + switch (featureID) { + case GenericconstraintsPackage.GENERIC_CONSTRAINT__KIND: + setKind((GenericConstraintKind)newValue); + return; + case GenericconstraintsPackage.GENERIC_CONSTRAINT__BASE_CONSTRAINT: + setBase_Constraint((Constraint)newValue); + return; + case GenericconstraintsPackage.GENERIC_CONSTRAINT__BASE_CLASS: + setBase_Class((org.eclipse.uml2.uml.Class)newValue); + return; + case GenericconstraintsPackage.GENERIC_CONSTRAINT__TARGET: + getTarget().clear(); + getTarget().addAll((Collection<? extends NamedElement>)newValue); + return; + case GenericconstraintsPackage.GENERIC_CONSTRAINT__MODE: + getMode().clear(); + getMode().addAll((Collection<? extends Mode>)newValue); + return; } super.eSet(featureID, newValue); } @@ -241,7 +208,6 @@ public class GenericConstraintImpl extends TraceableSpecificationImpl implements /** * <!-- begin-user-doc --> * <!-- end-user-doc --> - * * @generated */ @Override @@ -252,62 +218,58 @@ public class GenericConstraintImpl extends TraceableSpecificationImpl implements /** * <!-- begin-user-doc --> * <!-- end-user-doc --> - * * @generated */ - @Override - public void eUnset(int featureID) { - switch(featureID) { - case GenericconstraintsPackage.GENERIC_CONSTRAINT__DESIGN_CONSTRAINT_TYPE: - setDesignConstraintType(DESIGN_CONSTRAINT_TYPE_EDEFAULT); - return; - case GenericconstraintsPackage.GENERIC_CONSTRAINT__BASE_CONSTRAINT: - setBase_Constraint((Constraint)null); - return; - case GenericconstraintsPackage.GENERIC_CONSTRAINT__GENERIC_CONSTRAINT_VALUE: - setGenericConstraintValue(GENERIC_CONSTRAINT_VALUE_EDEFAULT); - return; - case GenericconstraintsPackage.GENERIC_CONSTRAINT__BASE_CLASS: - setBase_Class((org.eclipse.uml2.uml.Class)null); - return; - case GenericconstraintsPackage.GENERIC_CONSTRAINT__TARGET: - getTarget().clear(); - return; - case GenericconstraintsPackage.GENERIC_CONSTRAINT__MODE: - getMode().clear(); - return; - } - super.eUnset(featureID); + public GenericConstraintKind getKind() { + return kind; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> - * * @generated */ - public GenericConstraintKind getDesignConstraintType() { - return designConstraintType; + public void setKind(GenericConstraintKind newKind) { + GenericConstraintKind oldKind = kind; + kind = newKind == null ? KIND_EDEFAULT : newKind; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, GenericconstraintsPackage.GENERIC_CONSTRAINT__KIND, oldKind, kind)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> - * * @generated */ - public String getGenericConstraintValue() { - return genericConstraintValue; + @Override + public void eUnset(int featureID) { + switch (featureID) { + case GenericconstraintsPackage.GENERIC_CONSTRAINT__KIND: + setKind(KIND_EDEFAULT); + return; + case GenericconstraintsPackage.GENERIC_CONSTRAINT__BASE_CONSTRAINT: + setBase_Constraint((Constraint)null); + return; + case GenericconstraintsPackage.GENERIC_CONSTRAINT__BASE_CLASS: + setBase_Class((org.eclipse.uml2.uml.Class)null); + return; + case GenericconstraintsPackage.GENERIC_CONSTRAINT__TARGET: + getTarget().clear(); + return; + case GenericconstraintsPackage.GENERIC_CONSTRAINT__MODE: + getMode().clear(); + return; + } + super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> - * * @generated */ public EList<Mode> getMode() { - if(mode == null) { + if (mode == null) { mode = new EObjectResolvingEList<Mode>(Mode.class, this, GenericconstraintsPackage.GENERIC_CONSTRAINT__MODE); } return mode; @@ -316,41 +278,57 @@ public class GenericConstraintImpl extends TraceableSpecificationImpl implements /** * <!-- begin-user-doc --> * <!-- end-user-doc --> - * * @generated */ - public EList<NamedElement> getTarget() { - if(target == null) { - target = new EObjectResolvingEList<NamedElement>(NamedElement.class, this, GenericconstraintsPackage.GENERIC_CONSTRAINT__TARGET); + public EAValue getValue() { + EAValue value = basicGetValue(); + return value != null && value.eIsProxy() ? (EAValue)eResolveProxy((InternalEObject)value) : value; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated NOT + */ + public EAValue basicGetValue() { + EAValue adlEAValue = null; + if (getBase_NamedElement() != null) { + Iterator<Element> it = getBase_NamedElement().getOwnedElements().iterator(); + + while (it.hasNext()) { + Element element = it.next(); + adlEAValue = (EAValue )UMLUtil.getStereotypeApplication(element, EAValue.class); + if (adlEAValue != null) + return adlEAValue; + } } - return target; + + return adlEAValue; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> - * * @generated */ - public void setDesignConstraintType(GenericConstraintKind newDesignConstraintType) { - GenericConstraintKind oldDesignConstraintType = designConstraintType; - designConstraintType = newDesignConstraintType == null ? DESIGN_CONSTRAINT_TYPE_EDEFAULT : newDesignConstraintType; - if(eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, GenericconstraintsPackage.GENERIC_CONSTRAINT__DESIGN_CONSTRAINT_TYPE, oldDesignConstraintType, designConstraintType)); + public EList<NamedElement> getTarget() { + if (target == null) { + target = new EObjectResolvingEList<NamedElement>(NamedElement.class, this, GenericconstraintsPackage.GENERIC_CONSTRAINT__TARGET); + } + return target; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> - * * @generated */ public Constraint getBase_Constraint() { - if(base_Constraint != null && base_Constraint.eIsProxy()) { + if (base_Constraint != null && base_Constraint.eIsProxy()) { InternalEObject oldBase_Constraint = (InternalEObject)base_Constraint; base_Constraint = (Constraint)eResolveProxy(oldBase_Constraint); - if(base_Constraint != oldBase_Constraint) { - if(eNotificationRequired()) + if (base_Constraint != oldBase_Constraint) { + if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, GenericconstraintsPackage.GENERIC_CONSTRAINT__BASE_CONSTRAINT, oldBase_Constraint, base_Constraint)); } } @@ -360,7 +338,6 @@ public class GenericConstraintImpl extends TraceableSpecificationImpl implements /** * <!-- begin-user-doc --> * <!-- end-user-doc --> - * * @generated */ public Constraint basicGetBase_Constraint() { @@ -370,41 +347,26 @@ public class GenericConstraintImpl extends TraceableSpecificationImpl implements /** * <!-- begin-user-doc --> * <!-- end-user-doc --> - * * @generated */ public void setBase_Constraint(Constraint newBase_Constraint) { Constraint oldBase_Constraint = base_Constraint; base_Constraint = newBase_Constraint; - if(eNotificationRequired()) + if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, GenericconstraintsPackage.GENERIC_CONSTRAINT__BASE_CONSTRAINT, oldBase_Constraint, base_Constraint)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> - * - * @generated - */ - public void setGenericConstraintValue(String newGenericConstraintValue) { - String oldGenericConstraintValue = genericConstraintValue; - genericConstraintValue = newGenericConstraintValue; - if(eNotificationRequired()) - eNotify(new ENotificationImpl(this, Notification.SET, GenericconstraintsPackage.GENERIC_CONSTRAINT__GENERIC_CONSTRAINT_VALUE, oldGenericConstraintValue, genericConstraintValue)); - } - - /** - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * * @generated */ public org.eclipse.uml2.uml.Class getBase_Class() { - if(base_Class != null && base_Class.eIsProxy()) { + if (base_Class != null && base_Class.eIsProxy()) { InternalEObject oldBase_Class = (InternalEObject)base_Class; base_Class = (org.eclipse.uml2.uml.Class)eResolveProxy(oldBase_Class); - if(base_Class != oldBase_Class) { - if(eNotificationRequired()) + if (base_Class != oldBase_Class) { + if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, GenericconstraintsPackage.GENERIC_CONSTRAINT__BASE_CLASS, oldBase_Class, base_Class)); } } @@ -414,7 +376,6 @@ public class GenericConstraintImpl extends TraceableSpecificationImpl implements /** * <!-- begin-user-doc --> * <!-- end-user-doc --> - * * @generated */ public org.eclipse.uml2.uml.Class basicGetBase_Class() { @@ -424,32 +385,27 @@ public class GenericConstraintImpl extends TraceableSpecificationImpl implements /** * <!-- begin-user-doc --> * <!-- end-user-doc --> - * * @generated */ public void setBase_Class(org.eclipse.uml2.uml.Class newBase_Class) { org.eclipse.uml2.uml.Class oldBase_Class = base_Class; base_Class = newBase_Class; - if(eNotificationRequired()) + if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, GenericconstraintsPackage.GENERIC_CONSTRAINT__BASE_CLASS, oldBase_Class, base_Class)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> - * * @generated */ @Override public String toString() { - if(eIsProxy()) - return super.toString(); + if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); - result.append(" (designConstraintType: "); - result.append(designConstraintType); - result.append(", genericConstraintValue: "); - result.append(genericConstraintValue); + result.append(" (kind: "); + result.append(kind); result.append(')'); return result.toString(); } |