diff options
Diffstat (limited to 'Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/test/DslTest.java')
-rw-r--r-- | Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/test/DslTest.java | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/test/DslTest.java b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/test/DslTest.java new file mode 100644 index 00000000..7b4849e1 --- /dev/null +++ b/Tests/ca.mcgill.ecse.dslreasoner.vampire.test/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/test/DslTest.java | |||
@@ -0,0 +1,111 @@ | |||
1 | package ca.mcgill.ecse.dslreasoner.vampire.test; | ||
2 | |||
3 | import ca.mcgill.ecse.dslreasoner.vampire.reasoner.VampireSolver; | ||
4 | import ca.mcgill.ecse.dslreasoner.vampire.reasoner.VampireSolverConfiguration; | ||
5 | import com.google.common.collect.Iterables; | ||
6 | import functionalarchitecture.FunctionalarchitecturePackage; | ||
7 | import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic; | ||
8 | import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2LogicConfiguration; | ||
9 | import hu.bme.mit.inf.dslreasoner.ecore2logic.Ecore2Logic_Trace; | ||
10 | import hu.bme.mit.inf.dslreasoner.ecore2logic.EcoreMetamodelDescriptor; | ||
11 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicReasoner; | ||
12 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.TracedOutput; | ||
13 | import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.LogicProblem; | ||
14 | import hu.bme.mit.inf.dslreasoner.logic.model.logicresult.LogicResult; | ||
15 | import hu.bme.mit.inf.dslreasoner.logic2ecore.Logic2Ecore; | ||
16 | import hu.bme.mit.inf.dslreasoner.viatra2logic.Viatra2Logic; | ||
17 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretation2logic.InstanceModel2Logic; | ||
18 | import hu.bme.mit.inf.dslreasoner.workspace.FileSystemWorkspace; | ||
19 | import hu.bme.mit.inf.dslreasoner.workspace.ReasonerWorkspace; | ||
20 | import java.util.Collections; | ||
21 | import java.util.List; | ||
22 | import java.util.Map; | ||
23 | import org.eclipse.emf.common.util.EList; | ||
24 | import org.eclipse.emf.ecore.EAttribute; | ||
25 | import org.eclipse.emf.ecore.EClass; | ||
26 | import org.eclipse.emf.ecore.EEnum; | ||
27 | import org.eclipse.emf.ecore.EEnumLiteral; | ||
28 | import org.eclipse.emf.ecore.EObject; | ||
29 | import org.eclipse.emf.ecore.EReference; | ||
30 | import org.eclipse.emf.ecore.resource.Resource; | ||
31 | import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl; | ||
32 | import org.eclipse.xtend2.lib.StringConcatenation; | ||
33 | import org.eclipse.xtext.xbase.lib.CollectionLiterals; | ||
34 | import org.eclipse.xtext.xbase.lib.Exceptions; | ||
35 | import org.eclipse.xtext.xbase.lib.Functions.Function1; | ||
36 | import org.eclipse.xtext.xbase.lib.InputOutput; | ||
37 | import org.eclipse.xtext.xbase.lib.IterableExtensions; | ||
38 | import org.eclipse.xtext.xbase.lib.IteratorExtensions; | ||
39 | import org.eclipse.xtext.xbase.lib.ListExtensions; | ||
40 | import org.eclipse.xtext.xbase.lib.ObjectExtensions; | ||
41 | import org.eclipse.xtext.xbase.lib.Procedures.Procedure1; | ||
42 | |||
43 | @SuppressWarnings("all") | ||
44 | public class DslTest { | ||
45 | public static void main(final String[] args) { | ||
46 | try { | ||
47 | StringConcatenation _builder = new StringConcatenation(); | ||
48 | _builder.append("initialModels/"); | ||
49 | final FileSystemWorkspace inputs = new FileSystemWorkspace(_builder.toString(), ""); | ||
50 | StringConcatenation _builder_1 = new StringConcatenation(); | ||
51 | _builder_1.append("outputDslModels/"); | ||
52 | final FileSystemWorkspace workspace = new FileSystemWorkspace(_builder_1.toString(), ""); | ||
53 | workspace.initAndClear(); | ||
54 | InputOutput.<String>println("Input and output workspaces are created"); | ||
55 | final EcoreMetamodelDescriptor metamodel = DslTest.loadMetamodel(); | ||
56 | final List<EObject> partialModel = DslTest.loadPartialModel(inputs); | ||
57 | InputOutput.<String>println("DSL loaded"); | ||
58 | final Ecore2Logic ecore2Logic = new Ecore2Logic(); | ||
59 | final Logic2Ecore logic2Ecore = new Logic2Ecore(ecore2Logic); | ||
60 | final Viatra2Logic viatra2Logic = new Viatra2Logic(ecore2Logic); | ||
61 | final InstanceModel2Logic instanceModel2Logic = new InstanceModel2Logic(); | ||
62 | Ecore2LogicConfiguration _ecore2LogicConfiguration = new Ecore2LogicConfiguration(); | ||
63 | final TracedOutput<LogicProblem, Ecore2Logic_Trace> modelGenerationProblem = ecore2Logic.transformMetamodel(metamodel, _ecore2LogicConfiguration); | ||
64 | final LogicProblem logicProblem = modelGenerationProblem.getOutput(); | ||
65 | InputOutput.<String>println("Problem created"); | ||
66 | LogicResult solution = null; | ||
67 | LogicReasoner reasoner = null; | ||
68 | VampireSolver _vampireSolver = new VampireSolver(); | ||
69 | reasoner = _vampireSolver; | ||
70 | VampireSolverConfiguration _vampireSolverConfiguration = new VampireSolverConfiguration(); | ||
71 | final Procedure1<VampireSolverConfiguration> _function = (VampireSolverConfiguration it) -> { | ||
72 | it.writeToFile = false; | ||
73 | }; | ||
74 | final VampireSolverConfiguration vampireConfig = ObjectExtensions.<VampireSolverConfiguration>operator_doubleArrow(_vampireSolverConfiguration, _function); | ||
75 | solution = reasoner.solve(logicProblem, vampireConfig, workspace); | ||
76 | InputOutput.<String>println("Problem solved"); | ||
77 | } catch (Throwable _e) { | ||
78 | throw Exceptions.sneakyThrow(_e); | ||
79 | } | ||
80 | } | ||
81 | |||
82 | private static EcoreMetamodelDescriptor loadMetamodel() { | ||
83 | final FunctionalarchitecturePackage pckg = FunctionalarchitecturePackage.eINSTANCE; | ||
84 | final List<EClass> classes = IterableExtensions.<EClass>toList(Iterables.<EClass>filter(pckg.getEClassifiers(), EClass.class)); | ||
85 | final List<EEnum> enums = IterableExtensions.<EEnum>toList(Iterables.<EEnum>filter(pckg.getEClassifiers(), EEnum.class)); | ||
86 | final Function1<EEnum, EList<EEnumLiteral>> _function = (EEnum it) -> { | ||
87 | return it.getELiterals(); | ||
88 | }; | ||
89 | final List<EEnumLiteral> literals = IterableExtensions.<EEnumLiteral>toList(Iterables.<EEnumLiteral>concat(ListExtensions.<EEnum, EList<EEnumLiteral>>map(enums, _function))); | ||
90 | final Function1<EClass, EList<EReference>> _function_1 = (EClass it) -> { | ||
91 | return it.getEReferences(); | ||
92 | }; | ||
93 | final List<EReference> references = IterableExtensions.<EReference>toList(Iterables.<EReference>concat(ListExtensions.<EClass, EList<EReference>>map(classes, _function_1))); | ||
94 | final Function1<EClass, EList<EAttribute>> _function_2 = (EClass it) -> { | ||
95 | return it.getEAttributes(); | ||
96 | }; | ||
97 | final List<EAttribute> attributes = IterableExtensions.<EAttribute>toList(Iterables.<EAttribute>concat(ListExtensions.<EClass, EList<EAttribute>>map(classes, _function_2))); | ||
98 | return new EcoreMetamodelDescriptor(classes, Collections.<EClass>unmodifiableSet(CollectionLiterals.<EClass>newHashSet()), false, enums, literals, references, attributes); | ||
99 | } | ||
100 | |||
101 | private static List<EObject> loadPartialModel(final ReasonerWorkspace inputs) { | ||
102 | List<EObject> _xblockexpression = null; | ||
103 | { | ||
104 | Map<String, Object> _extensionToFactoryMap = Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap(); | ||
105 | XMIResourceFactoryImpl _xMIResourceFactoryImpl = new XMIResourceFactoryImpl(); | ||
106 | _extensionToFactoryMap.put("*", _xMIResourceFactoryImpl); | ||
107 | _xblockexpression = IteratorExtensions.<EObject>toList(inputs.<EObject>readModel(EObject.class, "FunctionalArchitectureModel.xmi").eResource().getAllContents()); | ||
108 | } | ||
109 | return _xblockexpression; | ||
110 | } | ||
111 | } | ||