diff options
author | 2018-09-14 16:38:34 +0200 | |
---|---|---|
committer | 2018-09-14 16:38:34 +0200 | |
commit | 94d65ce02c5ef302f91bf383643c2535001ae6a9 (patch) | |
tree | f7b559d2d0f281bc7ceb50f2be4ea2a71725ae8a /Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage | |
parent | Update support for java and emf DATATYPES, and basic scope propagator (diff) | |
download | VIATRA-Generator-94d65ce02c5ef302f91bf383643c2535001ae6a9.tar.gz VIATRA-Generator-94d65ce02c5ef302f91bf383643c2535001ae6a9.tar.zst VIATRA-Generator-94d65ce02c5ef302f91bf383643c2535001ae6a9.zip |
Scope initialisation is default
Diffstat (limited to 'Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage')
1 files changed, 15 insertions, 0 deletions
diff --git a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/PartialInterpretationInitialiser.xtend b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/PartialInterpretationInitialiser.xtend index cc76ce3f..d0fdeac4 100644 --- a/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/PartialInterpretationInitialiser.xtend +++ b/Solvers/VIATRA-Solver/hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage/src/hu/bme/mit/inf/dslreasoner/viatrasolver/partialinterpretationlanguage/PartialInterpretationInitialiser.xtend | |||
@@ -41,6 +41,7 @@ import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.BoolLiteral | |||
41 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.IntLiteral | 41 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.IntLiteral |
42 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.RealLiteral | 42 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.RealLiteral |
43 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.StringLiteral | 43 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.StringLiteral |
44 | import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.PartialTypeInterpratation | ||
44 | 45 | ||
45 | @Data class Problem2PartialInterpretationTrace { | 46 | @Data class Problem2PartialInterpretationTrace { |
46 | Map<TypeDeclaration, PartialComplexTypeInterpretation> type2Interpretation | 47 | Map<TypeDeclaration, PartialComplexTypeInterpretation> type2Interpretation |
@@ -201,11 +202,25 @@ class PartialInterpretationInitialiser { | |||
201 | val typeInterpretation = typeDeclaration.initialisePartialTypeInterpretation(engine) | 202 | val typeInterpretation = typeDeclaration.initialisePartialTypeInterpretation(engine) |
202 | interpretation.partialtypeinterpratation += typeInterpretation | 203 | interpretation.partialtypeinterpratation += typeInterpretation |
203 | type2Interpretation.put(typeDeclaration,typeInterpretation) | 204 | type2Interpretation.put(typeDeclaration,typeInterpretation) |
205 | interpretation.scopes += initialiseTypeScope(typeInterpretation, minNewElementsByType.get(typeDeclaration),maxNewElementsByType.get(typeDeclaration)) | ||
206 | |||
204 | } | 207 | } |
205 | interpretation.problem.connectSuperypes(type2Interpretation) | 208 | interpretation.problem.connectSuperypes(type2Interpretation) |
206 | return type2Interpretation | 209 | return type2Interpretation |
207 | } | 210 | } |
208 | 211 | ||
212 | def private initialiseTypeScope(PartialTypeInterpratation interpretation, Integer min, Integer max) { | ||
213 | val res = createScope | ||
214 | res.targetTypeInterpretation = interpretation | ||
215 | if(min !== null) { | ||
216 | res.minNewElements = min | ||
217 | } | ||
218 | if(max !== null) { | ||
219 | res.maxNewElements = max | ||
220 | } | ||
221 | return res | ||
222 | } | ||
223 | |||
209 | def private connectSuperypes(LogicProblem problem, Map<TypeDeclaration, PartialComplexTypeInterpretation> trace) { | 224 | def private connectSuperypes(LogicProblem problem, Map<TypeDeclaration, PartialComplexTypeInterpretation> trace) { |
210 | for(typeDeclaration : problem.types.filter(TypeDeclaration)) { | 225 | for(typeDeclaration : problem.types.filter(TypeDeclaration)) { |
211 | val supertypes = typeDeclaration.<Type>transitiveClosurePlus[it.supertypes] | 226 | val supertypes = typeDeclaration.<Type>transitiveClosurePlus[it.supertypes] |