Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions kerml/src/examples/Simple Tests/Associations.kerml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package Associations {
package Associations {
datatype X;
class Y;

assoc A {
end x;
end [1..*] feature y;
end x_cross [1..1] feature x : X;
end y_cross [1..*] feature y : Y;
}

assoc B specializes A {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*******************************************************************************
* SysML 2 Pilot Implementation
* Copyright (c) 2021 Model Driven Solutions, Inc.
* Copyright (c) 2021, 2025 Model Driven Solutions, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
Expand Down Expand Up @@ -36,6 +36,17 @@ public ConnectionUsage getTarget() {
return (ConnectionUsage)super.getTarget();
}

/**
* @satisfies checkPartUsageSubpartSpecialization
*/
@Override
public void addDefaultGeneralType() {
super.addDefaultGeneralType();
if (isSubitem()) {
addDefaultGeneralType("subpart");
}
}

/**
* @satisfies checkConnectionUsageSpecialization
* @satisfies checkAllocationUsageSpecialization
Expand Down
4 changes: 3 additions & 1 deletion org.omg.sysml/src/org/omg/sysml/adapter/FeatureAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -228,12 +228,14 @@ protected Feature getBoundValueResult() {
*/
@Override
public void addDefaultGeneralType() {
// Note: This must happen before call to super, because default supertype depends on ownedTyping.
addOwnedCrossFeatureSpecialization();

super.addDefaultGeneralType();

addBoundValueSubsetting();
addParticipantSubsetting();
addCrossingSpecialization();
addOwnedCrossFeatureSpecialization();
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.omg.sysml.lang.sysml.ReferenceUsage;
import org.omg.sysml.lang.sysml.SuccessionAsUsage;
import org.omg.sysml.lang.sysml.util.SysMLLibraryUtil;
import org.omg.sysml.util.FeatureUtil;
import org.omg.sysml.util.TypeUtil;
import org.omg.sysml.util.UsageUtil;

Expand All @@ -56,10 +57,12 @@ public void addDefaultGeneralType() {
ReferenceUsage target = getTarget();
Type type = target.getOwningType();
if (type instanceof TransitionUsage) {
// checkTransitionUsagePayloadSpecialization
if (target == UsageUtil.getPayloadParameterOf((TransitionUsage)type)) {
Feature accepterParameter = UsageUtil.getAccepterPayloadParameterOf((TransitionUsage)type);
if (accepterParameter != null) {
addImplicitGeneralType(SysMLPackage.eINSTANCE.getSubsetting(), accepterParameter);
addImplicitGeneralType(SysMLPackage.eINSTANCE.getSubsetting(),
FeatureUtil.chainFeatures((Feature)accepterParameter.getOwningType(), accepterParameter));
target.setDeclaredName(accepterParameter.getDeclaredName());
return;
}
Expand Down
11 changes: 11 additions & 0 deletions org.omg.sysml/src/org/omg/sysml/adapter/RenderingUsageAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,17 @@ public RenderingUsageAdapter(RenderingUsage element) {
super(element);
}

/**
* @satisfies checkPartUsageSubpartSpecialization
*/
@Override
public void addDefaultGeneralType() {
super.addDefaultGeneralType();
if (isSubitem()) {
addDefaultGeneralType("subpart");
}
}

@Override
public RenderingUsage getTarget() {
return (RenderingUsage)super.getTarget();
Expand Down
11 changes: 11 additions & 0 deletions org.omg.sysml/src/org/omg/sysml/adapter/ViewUsageAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,17 @@ public ViewUsage getTarget() {
return (ViewUsage)super.getTarget();
}

/**
* @satisfies checkPartUsageSubpartSpecialization
*/
@Override
public void addDefaultGeneralType() {
super.addDefaultGeneralType();
if (isSubitem()) {
addDefaultGeneralType("subpart");
}
}

/**
* @satisfies checkViewUsageSubviewSpecialization
* @satisfies checkViewpointUsageSpecialization
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,8 @@ protected ImplicitGeneralizationMap() {
put(ConnectionUsageImpl.class, "base", "Connections::connections");
//checkConnectionUsageBinarySpecialization
put(ConnectionUsageImpl.class, "binary", "Connections::binaryConnections");
//checkPartUsageSubpartSpecialization (a ConnectionUsage is a PartUsage)
put(ConnectionUsageImpl.class, "subpart", "Items::Item::subparts");

//checkConstraintDefinitionSpecialization
put(ConstraintDefinitionImpl.class, "base", "Constraints::ConstraintCheck");
Expand Down Expand Up @@ -474,6 +476,8 @@ protected ImplicitGeneralizationMap() {
put(RenderingUsageImpl.class, "subrendering", "Views::Rendering::subrenderings");
//checkRenderingUsageRedefinition
put(RenderingUsageImpl.class, "viewRendering", "Views::View::viewRendering");
//checkPartUsageSubpartSpecialization (a RenderingUsage is a PartUsage)
put(RenderingUsageImpl.class, "subpart", "Items::Item::subparts");

//checkRequirementDefinitionSpecialization
put(RequirementDefinitionImpl.class, "base", "Requirements::RequirementCheck");
Expand Down Expand Up @@ -555,6 +559,8 @@ protected ImplicitGeneralizationMap() {
put(ViewUsageImpl.class, "base", "Views::views");
//checkViewUsageSubviewSpecialization
put(ViewUsageImpl.class, "subview", "Views::View::subviews");
//checkPartUsageSubpartSpecialization (a ViewUsage is a PartUsage)
put(ViewUsageImpl.class, "subpart", "Items::Item::subparts");

//checkViewpointDefinitionSpecialization
put(ViewpointDefinitionImpl.class, "base", "Views::ViewpointCheck");
Expand Down
2 changes: 1 addition & 1 deletion org.omg.sysml/src/org/omg/sysml/util/TypeUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ private static Feature getResultParameterOf(Type type, Set<Type> visited) {
getTypeAdapter(type).addAdditionalMembers();
Feature resultParameter = getOwnedResultParameterOf(type);
if (resultParameter == null) {
for (Type general: getSupertypesOf(type)) {
for (Type general: getGeneralTypesOf(type)) {
if (general != null && !visited.contains(general)) {
resultParameter = getResultParameterOf(general, visited);
if (resultParameter != null) {
Expand Down
1 change: 1 addition & 0 deletions sysml/src/examples/Simple Tests/AllocationTest.sysml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package AllocationTest {
part :>> assembly {
part :>> element;
}
allocate l.component to assembly.element;
}

allocation def A;
Expand Down