Skip to content

Commit 2892101

Browse files
committed
ST6RI-500 Corrected bug created by change to Feature::isOrdered impl.
- Also removed no longer existing file from list of test files for SysMLRepositorySaveTest.
1 parent 9ec7a05 commit 2892101

3 files changed

Lines changed: 24 additions & 25 deletions

File tree

org.omg.sysml.xtext/src/org/omg/sysml/xtext/util/SysMLRepositorySaveTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public class SysMLRepositorySaveTest extends SysMLRepositorySaveUtil {
3232
"02-Parts Interconnection/2a-Parts Interconnection.sysml",
3333
"03-Function-based Behavior/3a-Function-based Behavior-1.sysml",
3434
"03-Function-based Behavior/3a-Function-based Behavior-2.sysml",
35-
"03-Function-based Behavior/3a-Function-based Behavior-5.sysml",
35+
"03-Function-based Behavior/3a-Function-based Behavior-3.sysml",
3636
"04-Functional Allocation/4a-Functional Allocation.sysml",
3737
"05-State-based Behavior/5-State-based Behavior-1.sysml",
3838
"05-State-based Behavior/5-State-based Behavior-1a.sysml",
@@ -86,19 +86,19 @@ protected String[] processArgs(String[] args) {
8686

8787
public static void main(String[] args) {
8888
List<String> failedTests = new ArrayList<>();
89-
try {
90-
String[] args1 = Arrays.copyOf(args, args.length);
91-
for (String testFile: TEST_FILES) {
89+
String[] args1 = Arrays.copyOf(args, args.length);
90+
for (String testFile: TEST_FILES) {
91+
try {
9292
SysMLRepositorySaveTest test = new SysMLRepositorySaveTest(testFile);
9393
test.run(args1);
9494
if (!test.isCommitted()) {
9595
failedTests.add(testFile);
9696
}
97-
System.out.println();
97+
System.out.println();
98+
} catch (Exception e) {
99+
System.out.println("Error: " + e);
100+
failedTests.add(testFile);
98101
}
99-
100-
} catch (Exception e) {
101-
System.out.println("Error: " + e);
102102
}
103103

104104
if (failedTests.isEmpty()) {

org.omg.sysml/src/org/omg/sysml/util/FeatureUtil.java

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
import org.omg.sysml.lang.sysml.SysMLPackage;
5656
import org.omg.sysml.lang.sysml.Type;
5757
import org.omg.sysml.lang.sysml.TypeFeaturing;
58-
import org.omg.sysml.lang.sysml.impl.FeatureImpl;
5958

6059
public class FeatureUtil {
6160

@@ -231,21 +230,6 @@ public static List<Feature> getAllSubsettingFeaturesIn(Type type, Feature subset
231230
collect(Collectors.toList());
232231
}
233232

234-
public static boolean checkIsOrdered(FeatureImpl feature, Set<Feature> visited) {
235-
if (feature.isOrdered()) {
236-
return true;
237-
} else {
238-
visited.add(feature);
239-
for (Feature subsettedFeature: FeatureUtil.getSubsettedFeaturesOf(feature)) {
240-
if (subsettedFeature != null && !visited.contains(subsettedFeature) &&
241-
checkIsOrdered(((FeatureImpl)subsettedFeature), visited)) {
242-
return true;
243-
}
244-
}
245-
return false;
246-
}
247-
}
248-
249233
// Feature values
250234

251235
public static FeatureValue getValuationFor(Feature feature) {

org.omg.sysml/syntax-gen/org/omg/sysml/lang/sysml/impl/FeatureImpl.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,9 +447,24 @@ public void setIsUnique(boolean newIsUnique) {
447447
*/
448448
@Override
449449
public boolean isOrdered() {
450-
return FeatureUtil.checkIsOrdered(this, new HashSet<Feature>());
450+
return checkIsOrdered(this, new HashSet<Feature>());
451451
}
452452

453+
public static boolean checkIsOrdered(FeatureImpl feature, Set<Feature> visited) {
454+
if (feature.isOrdered) {
455+
return feature.isOrdered;
456+
} else {
457+
visited.add(feature);
458+
for (Feature subsettedFeature: FeatureUtil.getSubsettedFeaturesOf(feature)) {
459+
if (subsettedFeature != null && !visited.contains(subsettedFeature) &&
460+
checkIsOrdered(((FeatureImpl)subsettedFeature), visited)) {
461+
return true;
462+
}
463+
}
464+
return false;
465+
}
466+
}
467+
453468
/**
454469
* <!-- begin-user-doc -->
455470
* <!-- end-user-doc -->

0 commit comments

Comments
 (0)