Skip to content

Commit 50abf69

Browse files
committed
Issue #34 - Fixed mapping of template parameters with constraints.
1 parent e521176 commit 50abf69

File tree

6 files changed

+121204
-121170
lines changed

6 files changed

+121204
-121170
lines changed

org.modeldriven.alf.eclipse/UML/Expressions_Template.uml

Lines changed: 7986 additions & 7986 deletions
Large diffs are not rendered by default.

org.modeldriven.alf.eclipse/UML/_RunTests.uml

Lines changed: 113179 additions & 113179 deletions
Large diffs are not rendered by default.
554 Bytes
Binary file not shown.
554 Bytes
Binary file not shown.

org.modeldriven.alf/src/org/modeldriven/alf/execution/AlfBase.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright 2011-2016 Data Access Technologies, Inc. (Model Driven Solutions)
2+
* Copyright 2011-2017 Data Access Technologies, Inc. (Model Driven Solutions)
33
* All rights reserved worldwide. This program and the accompanying materials
44
* are made available for use under the terms of the GNU General Public License
55
* (GPL) version 3 that accompanies this distribution and is available at
@@ -24,7 +24,7 @@
2424

2525
public abstract class AlfBase {
2626

27-
public static final String ALF_VERSION = "1.0.4";
27+
public static final String ALF_VERSION = "1.0.4a/maint-01";
2828

2929
protected boolean isVerbose = false;
3030

org.modeldriven.alf/src/org/modeldriven/alf/fuml/mapping/units/ClassifierTemplateParameterMapping.java

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
/*******************************************************************************
3-
* Copyright 2011-2013 Data Access Technologies, Inc. (Model Driven Solutions)
3+
* Copyright 2011-2017 Data Access Technologies, Inc. (Model Driven Solutions)
44
* All rights reserved worldwide. This program and the accompanying materials
55
* are made available for use under the terms of the GNU General Public License
66
* (GPL) version 3 that accompanies this distribution and is available at
@@ -10,15 +10,21 @@
1010

1111
package org.modeldriven.alf.fuml.mapping.units;
1212

13+
import org.modeldriven.alf.fuml.mapping.FumlMapping;
14+
import org.modeldriven.alf.fuml.mapping.common.ElementReferenceMapping;
1315
import org.modeldriven.alf.fuml.mapping.units.ClassifierDefinitionMapping;
1416
import org.modeldriven.alf.mapping.MappingError;
15-
17+
import org.modeldriven.alf.syntax.common.ElementReference;
1618
import org.modeldriven.alf.syntax.units.ClassifierTemplateParameter;
17-
19+
import org.modeldriven.alf.uml.Activity;
20+
import org.modeldriven.alf.uml.Association;
21+
import org.modeldriven.alf.uml.Class_;
1822
import org.modeldriven.alf.uml.Classifier;
1923
import org.modeldriven.alf.uml.DataType;
2024
import org.modeldriven.alf.uml.Element;
25+
import org.modeldriven.alf.uml.Enumeration;
2126
import org.modeldriven.alf.uml.NamedElement;
27+
import org.modeldriven.alf.uml.Signal;
2228

2329
import java.util.ArrayList;
2430
import java.util.List;
@@ -30,6 +36,34 @@ public class ClassifierTemplateParameterMapping extends
3036

3137
@Override
3238
public Classifier mapClassifier() {
39+
ClassifierTemplateParameter source = this.getClassifierTemplateParameter();
40+
41+
for (ElementReference specializationReferent: source.getSpecializationReferent()) {
42+
Classifier constrainingClassifier = (Classifier)specializationReferent.getImpl().getUml();
43+
if (constrainingClassifier == null) {
44+
FumlMapping mapping = this.fumlMap(specializationReferent);
45+
if (mapping instanceof ElementReferenceMapping) {
46+
mapping = ((ElementReferenceMapping)mapping).getMapping();
47+
}
48+
if (mapping instanceof ClassifierDefinitionMapping) {
49+
constrainingClassifier = ((ClassifierDefinitionMapping)mapping).getClassifierOnly();
50+
}
51+
}
52+
if (constrainingClassifier instanceof Activity) {
53+
return (Classifier)this.create(Activity.class);
54+
} else if (constrainingClassifier instanceof Class_) {
55+
return (Classifier)this.create(Class_.class);
56+
} else if (constrainingClassifier instanceof DataType) {
57+
return (Classifier)this.create(DataType.class);
58+
} else if (constrainingClassifier instanceof Association) {
59+
return (Classifier)this.create(Association.class);
60+
} else if (constrainingClassifier instanceof Enumeration) {
61+
return (Classifier)this.create(Enumeration.class);
62+
} else if (constrainingClassifier instanceof Signal) {
63+
return (Classifier)this.create(Signal.class);
64+
}
65+
}
66+
3367
return (Classifier)this.create(DataType.class);
3468
}
3569

0 commit comments

Comments
 (0)