Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Willink2015-04-30 18:24:40 +0000
committerEd Willink2015-04-30 19:50:05 +0000
commit78ba827c4fbe01c31c57bf6040dcc1668195be12 (patch)
treee2ff1ba690be0cef27641c1489be2cc772000d3f
parent34ccd49bde49a4d1934a59b2c0a0284322a34640 (diff)
downloadorg.eclipse.qvtd-78ba827c4fbe01c31c57bf6040dcc1668195be12.tar.gz
org.eclipse.qvtd-78ba827c4fbe01c31c57bf6040dcc1668195be12.tar.xz
org.eclipse.qvtd-78ba827c4fbe01c31c57bf6040dcc1668195be12.zip
[465913] Update for unrealized variables in middle bottom only
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/model/QVTimperative.ocl4
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiEvaluationVisitor.java16
-rw-r--r--plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/as2cs/QVTimperativeDeclarationVisitor.java2
-rw-r--r--plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/formatting/QVTimperativeFormatter.java12
-rw-r--r--tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/SimpleUML2RDBMS/SimpleUML2RDBMS.qvti18
5 files changed, 26 insertions, 26 deletions
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/model/QVTimperative.ocl b/plugins/org.eclipse.qvtd.pivot.qvtimperative/model/QVTimperative.ocl
index a8e3b9fad..b7f55735f 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/model/QVTimperative.ocl
+++ b/plugins/org.eclipse.qvtd.pivot.qvtimperative/model/QVTimperative.ocl
@@ -28,7 +28,7 @@ def: unboundGuardVariables : Set(ocl::Variable) = guardVariables - boundGuardVar
/* No mapping refinement */
-- inv NoRefinement: noInheritance and noParents
inv NoMiddleGuardPatternVariables: guardPattern.variable->isEmpty()
-inv NoMiddleBottomPatternVariables: bottomPattern.variable->isEmpty() and bottomPattern.realizedVariable->isEmpty()
+--inv NoMiddleBottomPatternVariables: bottomPattern.variable->isEmpty() and bottomPattern.realizedVariable->isEmpty()
context MappingCall
def: referredNames : Set(String) = referredMapping.unboundGuardVariables.name->asSet()
@@ -54,7 +54,7 @@ def: isTarget : Boolean = mapping.isFromMiddle and oclIsKindOf(CoreDomain)
context CoreDomain
def: mapping : qvtimperative::Mapping = rule.oclAsType(qvtimperative::Mapping)
inv CheckableXorEnforceable: isCheckable xor isEnforceable
-inv NoSourceBottomPatternVariables: isCheckable implies bottomPattern.variable->isEmpty()
+inv NoSideBottomPatternVariables: bottomPattern.variable->isEmpty()
inv NoSideBottomPatternAssignments: bottomPattern.assignment->isEmpty()
inv NoSideBottomPatternEnforcements: bottomPattern.enforcementOperation->isEmpty()
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiEvaluationVisitor.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiEvaluationVisitor.java
index 1efe470cd..4a18d6841 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiEvaluationVisitor.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiEvaluationVisitor.java
@@ -70,6 +70,7 @@ public class QVTiEvaluationVisitor extends QVTiAbstractEvaluationVisitor {
Area area = bottomPattern.getArea();
if (area instanceof CoreDomain) {
assert bottomPattern.getAssignment().isEmpty();
+ assert bottomPattern.getVariable().isEmpty();
for (Predicate predicate : bottomPattern.getPredicate()) {
result = predicate.accept(undecoratedVisitor);
if (result != Boolean.TRUE) {
@@ -79,13 +80,6 @@ public class QVTiEvaluationVisitor extends QVTiAbstractEvaluationVisitor {
for (RealizedVariable rVar : bottomPattern.getRealizedVariable()) {
rVar.accept(undecoratedVisitor);
}
- for (Variable rVar : bottomPattern.getVariable()) {
- OCLExpression ownedInit = rVar.getOwnedInit();
- if (ownedInit != null) {
- Object initValue = ownedInit.accept(undecoratedVisitor);
- evaluationEnvironment.replace(rVar, initValue);
- }
- }
// for (Assignment assigment : bottomPattern.getAssignment()) {
// assigment.accept(undecoratedVisitor);
// }
@@ -101,8 +95,14 @@ public class QVTiEvaluationVisitor extends QVTiAbstractEvaluationVisitor {
assert area instanceof Mapping;
assert bottomPattern.getPredicate().isEmpty();
assert bottomPattern.getRealizedVariable().isEmpty();
- assert bottomPattern.getVariable().isEmpty();
assert bottomPattern.getEnforcementOperation().isEmpty();
+ for (Variable rVar : bottomPattern.getVariable()) {
+ OCLExpression ownedInit = rVar.getOwnedInit();
+ if (ownedInit != null) {
+ Object initValue = ownedInit.accept(undecoratedVisitor);
+ evaluationEnvironment.replace(rVar, initValue);
+ }
+ }
// for (RealizedVariable rVar : bottomPattern.getRealizedVariable()) {
// rVar.accept(undecoratedVisitor);
// }
diff --git a/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/as2cs/QVTimperativeDeclarationVisitor.java b/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/as2cs/QVTimperativeDeclarationVisitor.java
index a0290d953..5c3e733a5 100644
--- a/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/as2cs/QVTimperativeDeclarationVisitor.java
+++ b/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/as2cs/QVTimperativeDeclarationVisitor.java
@@ -82,10 +82,10 @@ public class QVTimperativeDeclarationVisitor extends QVTcoreBaseDeclarationVisit
List<Element> asConstraints = new ArrayList<Element>(asBottomPattern.getAssignment());
asConstraints.addAll(asBottomPattern.getPredicate());
context.refreshList(csBottomPattern.getOwnedConstraints(), context.visitDeclarations(PredicateOrAssignmentCS.class, asConstraints, null));
+ context.refreshList(csBottomPattern.getOwnedUnrealizedVariables(), context.visitDeclarations(UnrealizedVariableCS.class, asBottomPattern.getVariable(), null));
}
else {
context.refreshList(csBottomPattern.getOwnedRealizedVariables(), context.visitDeclarations(RealizedVariableCS.class, asBottomPattern.getRealizedVariable(), null));
- context.refreshList(csBottomPattern.getOwnedUnrealizedVariables(), context.visitDeclarations(UnrealizedVariableCS.class, asBottomPattern.getVariable(), null));
}
return csBottomPattern;
}
diff --git a/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/formatting/QVTimperativeFormatter.java b/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/formatting/QVTimperativeFormatter.java
index 246b49a8f..8e96a0dad 100644
--- a/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/formatting/QVTimperativeFormatter.java
+++ b/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/formatting/QVTimperativeFormatter.java
@@ -173,13 +173,13 @@ public class QVTimperativeFormatter extends QVTcoreBaseFormatter
TargetBottomPatternCSElements a = f.getTargetBottomPatternCSAccess();
c.setNoLinewrap().before(a.getLeftCurlyBracketKeyword_1());
c.setLinewrap().after(a.getLeftCurlyBracketKeyword_1());
- c.setNoSpace().before(a.getCommaKeyword_3_0());
- c.setLinewrap().after(a.getCommaKeyword_3_0());
- c.setLinewrap().before(a.getRightCurlyBracketKeyword_4());
- c.setLinewrap().after(a.getRightCurlyBracketKeyword_4());
+ c.setNoSpace().before(a.getCommaKeyword_2_1_0());
+ c.setLinewrap().after(a.getCommaKeyword_2_1_0());
+ c.setLinewrap().before(a.getRightCurlyBracketKeyword_3());
+ c.setLinewrap().after(a.getRightCurlyBracketKeyword_3());
//
- c.setIndentation(a.getLeftCurlyBracketKeyword_1(), a.getRightCurlyBracketKeyword_4());
- c.setNoSpace().between(a.getLeftCurlyBracketKeyword_1(), a.getRightCurlyBracketKeyword_4());
+ c.setIndentation(a.getLeftCurlyBracketKeyword_1(), a.getRightCurlyBracketKeyword_3());
+ c.setNoSpace().between(a.getLeftCurlyBracketKeyword_1(), a.getRightCurlyBracketKeyword_3());
}
{
TargetGuardPatternCSElements a = f.getTargetGuardPatternCSAccess();
diff --git a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/SimpleUML2RDBMS/SimpleUML2RDBMS.qvti b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/SimpleUML2RDBMS/SimpleUML2RDBMS.qvti
index e9a5a0d68..9fbbace47 100644
--- a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/SimpleUML2RDBMS/SimpleUML2RDBMS.qvti
+++ b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/SimpleUML2RDBMS/SimpleUML2RDBMS.qvti
@@ -51,24 +51,24 @@ map integerToNumber_LM in SimpleUML2RDBMS
map integerToNumber_MR in SimpleUML2RDBMS
{
- enforce rdbms() {
- sqlType : String := 'NUMBER'
- }
+ enforce rdbms() {}
check middle(p2s : PackageToSchema,
p2n : IntegerToNumber) {}
where (p2n.owner = p2s;) {
+ sqlType : String := 'NUMBER'
+ |
p2n.typeName := sqlType;
}
}
map booleanToBoolean_MR in SimpleUML2RDBMS
{
- enforce rdbms() {
- sqlType : String
- }
+ enforce rdbms() {}
check middle(p2s : PackageToSchema,
p2n : BooleanToBoolean) {}
where (p2n.owner = p2s;) {
+ sqlType : String
+ |
p2n.typeName := sqlType;
sqlType := 'BOOLEAN';
}
@@ -92,12 +92,12 @@ map booleanToBoolean_LM in SimpleUML2RDBMS
map stringToVarchar_MR in SimpleUML2RDBMS
{
- enforce rdbms() {
- sqlType : String := 'VARCHAR'
- }
+ enforce rdbms() {}
check middle(p2s : PackageToSchema,
p2n : StringToVarchar) {}
where (p2n.owner = p2s;) {
+ sqlType : String := 'VARCHAR'
+ |
p2n.typeName := sqlType;
}
}

Back to the top