diff options
author | 2019-06-09 15:13:00 -0400 | |
---|---|---|
committer | 2019-06-09 15:13:00 -0400 | |
commit | cd63ccf6fba2a812a9b115635bbd209c92cebad0 (patch) | |
tree | 6f2a04b6fd274dffe6bb72c1afdf87989c0ba6db /Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/SatelliteMdeOptimiserMain.java | |
parent | Simplify satellite metamodel further (diff) | |
download | VIATRA-Generator-cd63ccf6fba2a812a9b115635bbd209c92cebad0.tar.gz VIATRA-Generator-cd63ccf6fba2a812a9b115635bbd209c92cebad0.tar.zst VIATRA-Generator-cd63ccf6fba2a812a9b115635bbd209c92cebad0.zip |
Bump MDEOptimizer version
https://github.com/mde-optimiser/mde_optimiser/issues/49
Diffstat (limited to 'Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/SatelliteMdeOptimiserMain.java')
-rw-r--r-- | Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/SatelliteMdeOptimiserMain.java | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/SatelliteMdeOptimiserMain.java b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/SatelliteMdeOptimiserMain.java new file mode 100644 index 00000000..6cbb08fc --- /dev/null +++ b/Domains/hu.bme.mit.inf.dslreasoner.domains.satellite/xtend-gen/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/SatelliteMdeOptimiserMain.java | |||
@@ -0,0 +1,69 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.domains.satellite.mdeo; | ||
2 | |||
3 | import java.io.BufferedReader; | ||
4 | import java.io.BufferedWriter; | ||
5 | import java.io.FileReader; | ||
6 | import java.io.FileWriter; | ||
7 | import java.util.Collections; | ||
8 | import java.util.Map; | ||
9 | import java.util.Set; | ||
10 | import org.eclipse.emf.ecore.EPackage; | ||
11 | import org.eclipse.emf.ecore.resource.Resource; | ||
12 | import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl; | ||
13 | import org.eclipse.xtext.xbase.lib.CollectionLiterals; | ||
14 | import org.eclipse.xtext.xbase.lib.Exceptions; | ||
15 | import org.eclipse.xtext.xbase.lib.Pair; | ||
16 | import satellite.SatellitePackage; | ||
17 | import uk.ac.kcl.inf.mdeoptimiser.interfaces.cli.Run; | ||
18 | |||
19 | @SuppressWarnings("all") | ||
20 | public class SatelliteMdeOptimiserMain { | ||
21 | private static final String PROJECT_PATH = "."; | ||
22 | |||
23 | private static final String MOPT_PATH = "src/hu/bme/mit/inf/dslreasoner/domains/satellite/mdeo/satellite.mopt"; | ||
24 | |||
25 | private SatelliteMdeOptimiserMain() { | ||
26 | new IllegalStateException("This is a static utility class and should not be instantiated directly."); | ||
27 | } | ||
28 | |||
29 | public static void main(final String[] args) { | ||
30 | Map<String, Object> _extensionToFactoryMap = Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap(); | ||
31 | XMIResourceFactoryImpl _xMIResourceFactoryImpl = new XMIResourceFactoryImpl(); | ||
32 | _extensionToFactoryMap.put(Resource.Factory.Registry.DEFAULT_EXTENSION, _xMIResourceFactoryImpl); | ||
33 | EPackage.Registry.INSTANCE.put(SatellitePackage.eNS_URI, SatellitePackage.eINSTANCE); | ||
34 | Pair<String, String> _mappedTo = Pair.<String, String>of("satellite.ecore", SatellitePackage.eNS_URI); | ||
35 | SatelliteMdeOptimiserMain.fixupHenshinModel("model/satellite.henshin", "model/satellite_fixup.henshin", | ||
36 | Collections.<String, String>unmodifiableMap(CollectionLiterals.<String, String>newHashMap(_mappedTo))); | ||
37 | Run.main(new String[] { "-p", SatelliteMdeOptimiserMain.PROJECT_PATH, "-m", SatelliteMdeOptimiserMain.MOPT_PATH }); | ||
38 | } | ||
39 | |||
40 | private static void fixupHenshinModel(final String originalPath, final String outputPath, final Map<String, String> remapMap) { | ||
41 | try { | ||
42 | FileReader _fileReader = new FileReader(originalPath); | ||
43 | final BufferedReader reader = new BufferedReader(_fileReader); | ||
44 | try { | ||
45 | FileWriter _fileWriter = new FileWriter(outputPath); | ||
46 | final BufferedWriter writer = new BufferedWriter(_fileWriter); | ||
47 | try { | ||
48 | String line = null; | ||
49 | while (((line = reader.readLine()) != null)) { | ||
50 | { | ||
51 | Set<Map.Entry<String, String>> _entrySet = remapMap.entrySet(); | ||
52 | for (final Map.Entry<String, String> entry : _entrySet) { | ||
53 | line = line.replace(entry.getKey(), entry.getValue()); | ||
54 | } | ||
55 | writer.write(line); | ||
56 | writer.write("\n"); | ||
57 | } | ||
58 | } | ||
59 | } finally { | ||
60 | writer.close(); | ||
61 | } | ||
62 | } finally { | ||
63 | reader.close(); | ||
64 | } | ||
65 | } catch (Throwable _e) { | ||
66 | throw Exceptions.sneakyThrow(_e); | ||
67 | } | ||
68 | } | ||
69 | } | ||