diff options
author | Horacio Hoyos | 2014-12-24 16:01:04 +0000 |
---|---|---|
committer | Horacio Hoyos | 2014-12-24 16:01:04 +0000 |
commit | b2b860742c670cd8dd58f257cc6af5cc7b71135f (patch) | |
tree | acb5e43f0e9874f3aad880bc1510555c14bf51fa | |
parent | 3a7504fe2d828f80e8760ad667d572b114645429 (diff) | |
download | org.eclipse.qvtd-b2b860742c670cd8dd58f257cc6af5cc7b71135f.tar.gz org.eclipse.qvtd-b2b860742c670cd8dd58f257cc6af5cc7b71135f.tar.xz org.eclipse.qvtd-b2b860742c670cd8dd58f257cc6af5cc7b71135f.zip |
[fb46] Provided additioanl methods to search for variables as sometimes the source variable is available and others a target variable must be created from a name and type. The first case generates a var-to-var trace, the second one not.
-rw-r--r-- | plugins/org.eclipse.qvtd.build.qvtrtoqvtc/src/org/eclipse/qvtd/build/qvtrtoqvtc/QvtrToQvtcTransformation.java | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/plugins/org.eclipse.qvtd.build.qvtrtoqvtc/src/org/eclipse/qvtd/build/qvtrtoqvtc/QvtrToQvtcTransformation.java b/plugins/org.eclipse.qvtd.build.qvtrtoqvtc/src/org/eclipse/qvtd/build/qvtrtoqvtc/QvtrToQvtcTransformation.java index eb68c3f64..e74f0edac 100644 --- a/plugins/org.eclipse.qvtd.build.qvtrtoqvtc/src/org/eclipse/qvtd/build/qvtrtoqvtc/QvtrToQvtcTransformation.java +++ b/plugins/org.eclipse.qvtd.build.qvtrtoqvtc/src/org/eclipse/qvtd/build/qvtrtoqvtc/QvtrToQvtcTransformation.java @@ -356,7 +356,29 @@ public class QvtrToQvtcTransformation return p; } - public @NonNull RealizedVariable findRealizedVariable(@NonNull String name, + public @NonNull RealizedVariable findRealizedVariable(@NonNull Variable sv, + @NonNull CorePattern pattern) { + + RealizedVariable rv = null; + String name = sv.getName(); + Type type = sv.getType(); + assert (name != null) && (type != null); + if (doGlobalSearch) { + rv = (RealizedVariable) realizedVariables.get(name, type, pattern); + } + if (rv == null) { + rv = QVTcoreBaseFactory.eINSTANCE.createRealizedVariable(); + assert rv!= null; + rv.setName(name); + rv.setType(type); + realizedVariables.add(rv, pattern); + pattern.getVariable().add(rv); + putVariableTrace(sv, rv); + } + return rv; + } + + public @NonNull RealizedVariable findTraceRealizedVariable(@NonNull String name, @NonNull Type type, @NonNull CorePattern pattern) { RealizedVariable rv = null; @@ -374,6 +396,27 @@ public class QvtrToQvtcTransformation return rv; } + public @NonNull Variable findVariable(@NonNull Variable sv, + @NonNull CorePattern pattern) { + + Variable v = null; + String name = sv.getName(); + Type type = sv.getType(); + assert (name != null) && (type != null); + if (doGlobalSearch) { + v = (Variable) variables.get(name, type, pattern); + } + if (v == null) { + v = PivotFactory.eINSTANCE.createVariable(); + assert v!= null; + v.setName(name); + v.setType(type); + variables.add(v, pattern); + pattern.getVariable().add(v); + putVariableTrace(sv, v); + } + return v; + } public @NonNull Variable findVariable(@NonNull String name, @NonNull Type type, @NonNull CorePattern pattern) { |