Skip to content

Commit

Permalink
[829] Change OccurrenceUsage#portionKind to unsettable
Browse files Browse the repository at this point in the history
Bug: eclipse-syson#829
Signed-off-by: Étienne Bausson <[email protected]>
  • Loading branch information
ebausson-obeo authored and AxelRICHARD committed Nov 7, 2024
1 parent eebfb45 commit c9bbe6a
Show file tree
Hide file tree
Showing 8 changed files with 124 additions and 17 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

=== Improvements

- https://github.com/eclipse-syson/syson/issues/829[#829] [metamodel] `OccurrenceUsag#portionKind` is now unsettable and its default value is `null`.

=== New features


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@
"isReference": "false",
"isVariation": "false",
"isIndividual": "false",
"portionKind": "snapshot",
"portionKind": null,
"documentation": [],
"ownedAnnotation": [],
"ownedElement": [],
Expand Down Expand Up @@ -4621,4 +4621,4 @@
"variantMembership": [],
"lifeClass": null
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,11 @@ public interface OccurrenceUsage extends Usage {
*
* @return the value of the '<em>Portion Kind</em>' attribute.
* @see org.eclipse.syson.sysml.PortionKind
* @see #isSetPortionKind()
* @see #unsetPortionKind()
* @see #setPortionKind(PortionKind)
* @see org.eclipse.syson.sysml.SysmlPackage#getOccurrenceUsage_PortionKind()
* @model ordered="false"
* @model unsettable="true" ordered="false"
* @generated
*/
PortionKind getPortionKind();
Expand All @@ -98,9 +100,34 @@ public interface OccurrenceUsage extends Usage {
* @param value
* the new value of the '<em>Portion Kind</em>' attribute.
* @see org.eclipse.syson.sysml.PortionKind
* @see #isSetPortionKind()
* @see #unsetPortionKind()
* @see #getPortionKind()
* @generated
*/
void setPortionKind(PortionKind value);

/**
* Unsets the value of the '{@link org.eclipse.syson.sysml.OccurrenceUsage#getPortionKind <em>Portion Kind</em>}'
* attribute. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @see #isSetPortionKind()
* @see #getPortionKind()
* @see #setPortionKind(PortionKind)
* @generated
*/
void unsetPortionKind();

/**
* Returns whether the value of the '{@link org.eclipse.syson.sysml.OccurrenceUsage#getPortionKind <em>Portion
* Kind</em>}' attribute is set. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @return whether the value of the '<em>Portion Kind</em>' attribute is set.
* @see #unsetPortionKind()
* @see #getPortionKind()
* @see #setPortionKind(PortionKind)
* @generated
*/
boolean isSetPortionKind();

} // OccurrenceUsage
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ public class ConnectionUsageImpl extends ConnectorAsUsageImpl implements Connect
* <!-- end-user-doc -->
*
* @see #getPortionKind()
* @generated
* @generated NOT
* @ordered
*/
protected static final PortionKind PORTION_KIND_EDEFAULT = PortionKind.SNAPSHOT;
protected static final PortionKind PORTION_KIND_EDEFAULT = null;

/**
* The cached value of the '{@link #getPortionKind() <em>Portion Kind</em>}' attribute. <!-- begin-user-doc --> <!--
Expand All @@ -96,6 +96,14 @@ public class ConnectionUsageImpl extends ConnectorAsUsageImpl implements Connect
*/
protected PortionKind portionKind = PORTION_KIND_EDEFAULT;

/**
* This is true if the Portion Kind attribute has been set. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
* @ordered
*/
protected boolean portionKindESet;

/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
Expand Down Expand Up @@ -191,8 +199,35 @@ public PortionKind getPortionKind() {
public void setPortionKind(PortionKind newPortionKind) {
PortionKind oldPortionKind = this.portionKind;
this.portionKind = newPortionKind == null ? PORTION_KIND_EDEFAULT : newPortionKind;
boolean oldPortionKindESet = this.portionKindESet;
this.portionKindESet = true;
if (this.eNotificationRequired())
this.eNotify(new ENotificationImpl(this, Notification.SET, SysmlPackage.CONNECTION_USAGE__PORTION_KIND, oldPortionKind, this.portionKind, !oldPortionKindESet));
}

/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public void unsetPortionKind() {
PortionKind oldPortionKind = this.portionKind;
boolean oldPortionKindESet = this.portionKindESet;
this.portionKind = PORTION_KIND_EDEFAULT;
this.portionKindESet = false;
if (this.eNotificationRequired())
this.eNotify(new ENotificationImpl(this, Notification.SET, SysmlPackage.CONNECTION_USAGE__PORTION_KIND, oldPortionKind, this.portionKind));
this.eNotify(new ENotificationImpl(this, Notification.UNSET, SysmlPackage.CONNECTION_USAGE__PORTION_KIND, oldPortionKind, PORTION_KIND_EDEFAULT, oldPortionKindESet));
}

/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public boolean isSetPortionKind() {
return this.portionKindESet;
}

/**
Expand Down Expand Up @@ -287,7 +322,7 @@ public void eUnset(int featureID) {
this.setIsIndividual(IS_INDIVIDUAL_EDEFAULT);
return;
case SysmlPackage.CONNECTION_USAGE__PORTION_KIND:
this.setPortionKind(PORTION_KIND_EDEFAULT);
this.unsetPortionKind();
return;
}
super.eUnset(featureID);
Expand All @@ -304,7 +339,7 @@ public boolean eIsSet(int featureID) {
case SysmlPackage.CONNECTION_USAGE__IS_INDIVIDUAL:
return this.isIndividual != IS_INDIVIDUAL_EDEFAULT;
case SysmlPackage.CONNECTION_USAGE__PORTION_KIND:
return this.portionKind != PORTION_KIND_EDEFAULT;
return this.isSetPortionKind();
case SysmlPackage.CONNECTION_USAGE__INDIVIDUAL_DEFINITION:
return this.basicGetIndividualDefinition() != null;
case SysmlPackage.CONNECTION_USAGE__OCCURRENCE_DEFINITION:
Expand Down Expand Up @@ -413,7 +448,10 @@ public String toString() {
result.append(" (isIndividual: ");
result.append(this.isIndividual);
result.append(", portionKind: ");
result.append(this.portionKind);
if (this.portionKindESet)
result.append(this.portionKind);
else
result.append("<unset>");
result.append(')');
return result.toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ public class OccurrenceUsageImpl extends UsageImpl implements OccurrenceUsage {
* <!-- end-user-doc -->
*
* @see #getPortionKind()
* @generated
* @generated NOT
* @ordered
*/
protected static final PortionKind PORTION_KIND_EDEFAULT = PortionKind.SNAPSHOT;
protected static final PortionKind PORTION_KIND_EDEFAULT = null;

/**
* The cached value of the '{@link #getPortionKind() <em>Portion Kind</em>}' attribute. <!-- begin-user-doc --> <!--
Expand All @@ -86,6 +86,14 @@ public class OccurrenceUsageImpl extends UsageImpl implements OccurrenceUsage {
*/
protected PortionKind portionKind = PORTION_KIND_EDEFAULT;

/**
* This is true if the Portion Kind attribute has been set. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
* @ordered
*/
protected boolean portionKindESet;

/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
Expand Down Expand Up @@ -181,8 +189,35 @@ public PortionKind getPortionKind() {
public void setPortionKind(PortionKind newPortionKind) {
PortionKind oldPortionKind = this.portionKind;
this.portionKind = newPortionKind == null ? PORTION_KIND_EDEFAULT : newPortionKind;
boolean oldPortionKindESet = this.portionKindESet;
this.portionKindESet = true;
if (this.eNotificationRequired())
this.eNotify(new ENotificationImpl(this, Notification.SET, SysmlPackage.OCCURRENCE_USAGE__PORTION_KIND, oldPortionKind, this.portionKind, !oldPortionKindESet));
}

/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public void unsetPortionKind() {
PortionKind oldPortionKind = this.portionKind;
boolean oldPortionKindESet = this.portionKindESet;
this.portionKind = PORTION_KIND_EDEFAULT;
this.portionKindESet = false;
if (this.eNotificationRequired())
this.eNotify(new ENotificationImpl(this, Notification.SET, SysmlPackage.OCCURRENCE_USAGE__PORTION_KIND, oldPortionKind, this.portionKind));
this.eNotify(new ENotificationImpl(this, Notification.UNSET, SysmlPackage.OCCURRENCE_USAGE__PORTION_KIND, oldPortionKind, PORTION_KIND_EDEFAULT, oldPortionKindESet));
}

/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public boolean isSetPortionKind() {
return this.portionKindESet;
}

/**
Expand Down Expand Up @@ -238,7 +273,7 @@ public void eUnset(int featureID) {
this.setIsIndividual(IS_INDIVIDUAL_EDEFAULT);
return;
case SysmlPackage.OCCURRENCE_USAGE__PORTION_KIND:
this.setPortionKind(PORTION_KIND_EDEFAULT);
this.unsetPortionKind();
return;
}
super.eUnset(featureID);
Expand All @@ -255,7 +290,7 @@ public boolean eIsSet(int featureID) {
case SysmlPackage.OCCURRENCE_USAGE__IS_INDIVIDUAL:
return this.isIndividual != IS_INDIVIDUAL_EDEFAULT;
case SysmlPackage.OCCURRENCE_USAGE__PORTION_KIND:
return this.portionKind != PORTION_KIND_EDEFAULT;
return this.isSetPortionKind();
case SysmlPackage.OCCURRENCE_USAGE__INDIVIDUAL_DEFINITION:
return this.basicGetIndividualDefinition() != null;
case SysmlPackage.OCCURRENCE_USAGE__OCCURRENCE_DEFINITION:
Expand All @@ -278,7 +313,10 @@ public String toString() {
result.append(" (isIndividual: ");
result.append(this.isIndividual);
result.append(", portionKind: ");
result.append(this.portionKind);
if (this.portionKindESet)
result.append(this.portionKind);
else
result.append("<unset>");
result.append(')');
return result.toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9790,7 +9790,7 @@ public void initializePackageContents() {
this.initEAttribute(this.getOccurrenceUsage_IsIndividual(), this.ecorePackage.getEBoolean(), "isIndividual", "false", 1, 1, OccurrenceUsage.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE,
!IS_UNSETTABLE,
!IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
this.initEAttribute(this.getOccurrenceUsage_PortionKind(), this.getPortionKind(), "portionKind", null, 0, 1, OccurrenceUsage.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE,
this.initEAttribute(this.getOccurrenceUsage_PortionKind(), this.getPortionKind(), "portionKind", null, 0, 1, OccurrenceUsage.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE,
!IS_ID,
IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
this.initEReference(this.getOccurrenceUsage_IndividualDefinition(), this.getOccurrenceDefinition(), null, "individualDefinition", null, 0, 1, OccurrenceUsage.class, IS_TRANSIENT, IS_VOLATILE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1226,7 +1226,7 @@
lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
defaultValueLiteral="false"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="portionKind" ordered="false"
eType="#//PortionKind"/>
eType="#//PortionKind" unsettable="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="individualDefinition" ordered="false"
eType="#//OccurrenceDefinition" changeable="false" volatile="true" transient="true"
derived="true">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@

== Improvements

- `OccurrenceUsag#portionKind` is now unsettable and its default value is `null` in the SysMLv2 metamodel to conform to the specification.

== New features

0 comments on commit c9bbe6a

Please sign in to comment.