|
@@ -275,16 +275,23 @@ Element function transform(host_model : Element, schedule_model : Element):
|
|
Element all_composites
|
|
Element all_composites
|
|
String composite
|
|
String composite
|
|
String current
|
|
String current
|
|
|
|
+ Element merged
|
|
|
|
+ Element original_mm
|
|
|
|
|
|
if (bool_not(schedule_model["metamodel"]["inplace"])):
|
|
if (bool_not(schedule_model["metamodel"]["inplace"])):
|
|
// Do some preliminary changes if it is deemed out-place!
|
|
// Do some preliminary changes if it is deemed out-place!
|
|
// Need to make sure that:
|
|
// Need to make sure that:
|
|
// 1) a fused language is created of source and target
|
|
// 1) a fused language is created of source and target
|
|
// 2) the host_model conforms to the fused language
|
|
// 2) the host_model conforms to the fused language
|
|
- // TODO
|
|
|
|
- log("Out place transformation!")
|
|
|
|
- log("Schedule model has: " + cast_v2s(schedule_model["inplace"]))
|
|
|
|
- return read_root()!
|
|
|
|
|
|
+
|
|
|
|
+ // 1) Merge the languages
|
|
|
|
+ merged = model_fuse(schedule_model["metamodel"]["source"], schedule_model["metamodel"]["target"])
|
|
|
|
+
|
|
|
|
+ // 2a) Copy host_model, as we will change its typing information and content out-place
|
|
|
|
+ host_model = model_copy(host_model)
|
|
|
|
+
|
|
|
|
+ // 2b) Retype all elements of host_model in the merged language
|
|
|
|
+ model_retype_on_name(host_model, merged, "+", "SOURCE/")
|
|
|
|
|
|
// Now start transforming for real
|
|
// Now start transforming for real
|
|
all_composites = allInstances(schedule_model, "Composite")
|
|
all_composites = allInstances(schedule_model, "Composite")
|
|
@@ -306,9 +313,9 @@ Element function transform(host_model : Element, schedule_model : Element):
|
|
return True!
|
|
return True!
|
|
else:
|
|
else:
|
|
// Prepare the model before sending it back
|
|
// Prepare the model before sending it back
|
|
- // 1) Strip the host model of all "SOURCE" elements
|
|
|
|
- // 2) Retype the model to the "TARGET" elements
|
|
|
|
- // TODO
|
|
|
|
|
|
+ // Only keep elements with TARGET types and retype them to original
|
|
|
|
+ model_retype_on_name(host_model, original_mm, "-", "TARGET/")
|
|
|
|
+
|
|
return read_root()!
|
|
return read_root()!
|
|
else:
|
|
else:
|
|
// Failure, so return False if it is in-place, or the root node if it is out-place
|
|
// Failure, so return False if it is in-place, or the root node if it is out-place
|