| modeltype mm_ecore "strict" uses 'http://www.eclipse.org/emf/2002/Ecore'; |
| |
| transformation dicttype(); |
| |
| property DICT_MAP = Dict { |
| 'key1' = 'value1', |
| 'key2' = 'value2', |
| 'key1' = 'value3' |
| }; |
| |
| // Symbol table |
| intermediate class Symbols { |
| types : Dict(String, EAttribute); |
| } |
| |
| intermediate property EPackage::symbols : Symbols; |
| |
| main() { |
| assert fatal (DICT_MAP->size() = 2); |
| assert fatal (DICT_MAP->get('key1') = 'value3'); |
| assert fatal (DICT_MAP->get('key2') = 'value2'); |
| |
| var mappedPackage := object EPackage{}.xmap transEPackage(); |
| assert fatal (mappedPackage.symbols.types->size() = 1); |
| assert fatal (mappedPackage.symbols.types->get('k1').name = 'foo'); |
| } |
| |
| // Copy mapping for type "EPackage". |
| mapping EPackage::transEPackage() : EPackage { |
| symbols := object Symbols { |
| types := Dict{ |
| 'k1' = object EAttribute{name := 'foo'} |
| }; |
| }; |
| } |