Skip to content

Commit

Permalink
[829] Metamodel change to OccurrenceUsage's PortionKind cardinality a…
Browse files Browse the repository at this point in the history
…nd default value.

 * was snapshot, changed to null.
 * same thing for ConnectionUsage, which is a subclass of OccurrenceUsage, but java doesn't allow multiple inheritance.

Bug: eclipse-syson#829
Signed-off-by: Étienne Bausson <[email protected]>
  • Loading branch information
ebausson-obeo committed Nov 6, 2024
1 parent 4a7b30c commit 5692bd8
Show file tree
Hide file tree
Showing 7 changed files with 120 additions and 15 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ This reduces the time required to build SysON, especially when using Spring Tool
- https://github.com/eclipse-syson/syson/issues/803[#803] [libraries] All standard libraries have been updated to comply with the SysML Beta 2.2 specification.
- https://github.com/eclipse-syson/syson/issues/805[#805] [import] Improve non regression tests.
Added source sysml file and unaltered ast.json result.
- https://github.com/eclipse-syson/syson/issues/829[#829] [metamodel] Changed cardinality of PortionKind on OccurrenceUsage to [0..1], now unsettable. Now default to null.

=== New features

Expand Down
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 @@ -113,6 +113,7 @@ This reduces the time required to build SysON, especially when using Spring Tool
- All standard libraries have been updated to comply with the SysML Beta 2.2 specification.
- Improve import feature non regression tests.
Added source sysml file and unaltered ast.json result.
- Changed cardinality of PortionKind on OccurrenceUsage to [0..1], now unsettable. Now default to null.

== New features

Expand Down

0 comments on commit 5692bd8

Please sign in to comment.