diff options
author | 2018-05-08 17:03:07 +0200 | |
---|---|---|
committer | 2018-05-08 17:03:07 +0200 | |
commit | 4585a4d344da5498200548e7add61e5cccd44924 (patch) | |
tree | 3a030bea39db36db43d97b62124f6c2a7db111a7 /Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit | |
parent | Updated and fixed dependencies: (diff) | |
download | VIATRA-Generator-4585a4d344da5498200548e7add61e5cccd44924.tar.gz VIATRA-Generator-4585a4d344da5498200548e7add61e5cccd44924.tar.zst VIATRA-Generator-4585a4d344da5498200548e7add61e5cccd44924.zip |
Refactored to the milestone version of Viatra 2.0
Diffstat (limited to 'Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit')
2 files changed, 20 insertions, 24 deletions
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/TypeAnalysis.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/TypeAnalysis.xtend index 395aba85..2dd01343 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/TypeAnalysis.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/TypeAnalysis.xtend | |||
@@ -1,21 +1,21 @@ | |||
1 | package hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra | 1 | package hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra |
2 | 2 | ||
3 | import org.eclipse.xtend.lib.annotations.Data | 3 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.DefinedElement |
4 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Type | 4 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Type |
5 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.TypeDeclaration | ||
6 | import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.LogicProblem | ||
7 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.queries.DontHaveDefinedSupertype | ||
8 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.queries.NewElementMayTypeNegativeConstraint | ||
9 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.queries.NewElementTypeConstructor | ||
10 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.queries.NewElementTypeRefinementNegativeConstraint | ||
11 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.queries.NewElementTypeRefinementTarget | ||
12 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation | ||
13 | import java.util.ArrayList | ||
5 | import java.util.List | 14 | import java.util.List |
6 | import java.util.Map | 15 | import java.util.Map |
7 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialInterpretation | ||
8 | import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.LogicProblem | ||
9 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine | 16 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine |
10 | import org.eclipse.viatra.query.runtime.emf.EMFScope | 17 | import org.eclipse.viatra.query.runtime.emf.EMFScope |
11 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.queries.NewElementTypeConstructorMatcher | 18 | import org.eclipse.xtend.lib.annotations.Data |
12 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.queries.NewElementTypeRefinementTargetMatcher | ||
13 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.queries.NewElementTypeRefinementNegativeConstraintMatcher | ||
14 | import java.util.ArrayList | ||
15 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.queries.DontHaveDefinedSupertypeMatcher | ||
16 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.TypeDeclaration | ||
17 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.DefinedElement | ||
18 | import hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra.queries.NewElementMayTypeNegativeConstraintMatcher | ||
19 | 19 | ||
20 | @Data class TypeRefinementPrecondition { | 20 | @Data class TypeRefinementPrecondition { |
21 | Type targetType | 21 | Type targetType |
@@ -60,11 +60,11 @@ class TypeAnalysis { | |||
60 | 60 | ||
61 | def TypeAnalysisResult performTypeAnalysis(LogicProblem problem, PartialInterpretation interpretation) { | 61 | def TypeAnalysisResult performTypeAnalysis(LogicProblem problem, PartialInterpretation interpretation) { |
62 | val viatraEngine = ViatraQueryEngine.on(new EMFScope(problem)) | 62 | val viatraEngine = ViatraQueryEngine.on(new EMFScope(problem)) |
63 | val negativeMatcher = NewElementTypeRefinementNegativeConstraintMatcher.on(viatraEngine) | 63 | val negativeMatcher = NewElementTypeRefinementNegativeConstraint.Matcher.on(viatraEngine) |
64 | 64 | ||
65 | val possibleNewDynamicTypes = NewElementTypeConstructorMatcher.on(viatraEngine).allValuesOftype | 65 | val possibleNewDynamicTypes = NewElementTypeConstructor.Matcher.on(viatraEngine).allValuesOftype |
66 | 66 | ||
67 | val possibleNewTypeRefinementTargets = NewElementTypeRefinementTargetMatcher.on(viatraEngine).allValuesOfrefined | 67 | val possibleNewTypeRefinementTargets = NewElementTypeRefinementTarget.Matcher.on(viatraEngine).allValuesOfrefined |
68 | val possibleNewTypeRefinements = new ArrayList | 68 | val possibleNewTypeRefinements = new ArrayList |
69 | for(possibleNewTypeRefinementTarget : possibleNewTypeRefinementTargets) { | 69 | for(possibleNewTypeRefinementTarget : possibleNewTypeRefinementTargets) { |
70 | val inhibitorTypes = negativeMatcher.getAllValuesOfinhibitor(possibleNewTypeRefinementTarget) | 70 | val inhibitorTypes = negativeMatcher.getAllValuesOfinhibitor(possibleNewTypeRefinementTarget) |
@@ -73,8 +73,8 @@ class TypeAnalysis { | |||
73 | inhibitorTypes.toList) | 73 | inhibitorTypes.toList) |
74 | } | 74 | } |
75 | 75 | ||
76 | val possibleTypes = DontHaveDefinedSupertypeMatcher.on(viatraEngine).allValuesOftype | 76 | val possibleTypes = DontHaveDefinedSupertype.Matcher.on(viatraEngine).allValuesOftype |
77 | val newElementMayTypeMatcher = NewElementMayTypeNegativeConstraintMatcher.on(viatraEngine) | 77 | val newElementMayTypeMatcher = NewElementMayTypeNegativeConstraint.Matcher.on(viatraEngine) |
78 | 78 | ||
79 | val mayNewTypePreconditions = possibleTypes.toInvertedMap[type | | 79 | val mayNewTypePreconditions = possibleTypes.toInvertedMap[type | |
80 | val inhibitorTypes = newElementMayTypeMatcher.getAllValuesOfinhibitor(type as TypeDeclaration) | 80 | val inhibitorTypes = newElementMayTypeMatcher.getAllValuesOfinhibitor(type as TypeDeclaration) |
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/util/ParseUtil.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/util/ParseUtil.xtend index d315ac3f..6febe0a6 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/util/ParseUtil.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.logic2viatra/src/hu/bme/mit/inf/dslreasoner/viatrasolver/logic2viatra/util/ParseUtil.xtend | |||
@@ -12,21 +12,18 @@ import java.util.LinkedHashMap | |||
12 | import org.eclipse.emf.common.util.URI | 12 | import org.eclipse.emf.common.util.URI |
13 | import org.eclipse.emf.ecore.resource.Resource | 13 | import org.eclipse.emf.ecore.resource.Resource |
14 | import org.eclipse.emf.ecore.util.EcoreUtil | 14 | import org.eclipse.emf.ecore.util.EcoreUtil |
15 | import org.eclipse.viatra.query.patternlanguage.PatternLanguageStandaloneSetup | ||
16 | import org.eclipse.viatra.query.patternlanguage.annotations.ExtensionBasedAnnotationValidatorLoader | ||
17 | import org.eclipse.viatra.query.patternlanguage.annotations.IAnnotationValidatorLoader | ||
18 | import org.eclipse.viatra.query.patternlanguage.emf.EMFPatternLanguageRuntimeModule | 15 | import org.eclipse.viatra.query.patternlanguage.emf.EMFPatternLanguageRuntimeModule |
19 | import org.eclipse.viatra.query.patternlanguage.emf.EMFPatternLanguageStandaloneSetup | 16 | import org.eclipse.viatra.query.patternlanguage.emf.EMFPatternLanguageStandaloneSetup |
20 | import org.eclipse.viatra.query.patternlanguage.emf.GenmodelExtensionLoader | 17 | import org.eclipse.viatra.query.patternlanguage.emf.GenmodelExtensionLoader |
21 | import org.eclipse.viatra.query.patternlanguage.emf.IGenmodelMappingLoader | 18 | import org.eclipse.viatra.query.patternlanguage.emf.IGenmodelMappingLoader |
22 | import org.eclipse.viatra.query.patternlanguage.emf.eMFPatternLanguage.PatternModel | ||
23 | import org.eclipse.viatra.query.patternlanguage.emf.specification.SpecificationBuilder | 19 | import org.eclipse.viatra.query.patternlanguage.emf.specification.SpecificationBuilder |
20 | import org.eclipse.viatra.query.patternlanguage.emf.vql.PatternModel | ||
24 | import org.eclipse.xtext.resource.XtextResourceSet | 21 | import org.eclipse.xtext.resource.XtextResourceSet |
25 | 22 | ||
26 | class MyModule extends EMFPatternLanguageRuntimeModule implements Module{ | 23 | class MyModule extends EMFPatternLanguageRuntimeModule implements Module{ |
27 | def public Class<? extends IAnnotationValidatorLoader> bindAnnotationValidatorLoader() { | 24 | // def public Class<? extends IAnnotationValidatorLoader> bindAnnotationValidatorLoader() { |
28 | return typeof(ExtensionBasedAnnotationValidatorLoader); | 25 | // return typeof(ExtensionBasedAnnotationValidatorLoader); |
29 | } | 26 | // } |
30 | def public Class<? extends IGenmodelMappingLoader> bindGenmodelMappingLoader() { | 27 | def public Class<? extends IGenmodelMappingLoader> bindGenmodelMappingLoader() { |
31 | return typeof(GenmodelExtensionLoader); | 28 | return typeof(GenmodelExtensionLoader); |
32 | } | 29 | } |
@@ -35,7 +32,6 @@ class MyModule extends EMFPatternLanguageRuntimeModule implements Module{ | |||
35 | class ParseUtil { | 32 | class ParseUtil { |
36 | val Injector injector; | 33 | val Injector injector; |
37 | new() { | 34 | new() { |
38 | PatternLanguageStandaloneSetup.doSetup | ||
39 | EMFPatternLanguageStandaloneSetup.doSetup; | 35 | EMFPatternLanguageStandaloneSetup.doSetup; |
40 | PartialinterpretationPackage.eINSTANCE.class; | 36 | PartialinterpretationPackage.eINSTANCE.class; |
41 | LogicproblemPackage.eINSTANCE.class; | 37 | LogicproblemPackage.eINSTANCE.class; |