diff options
author | 2019-08-30 15:53:24 +0200 | |
---|---|---|
committer | 2019-08-30 15:53:24 +0200 | |
commit | a21a898301a172c56cfb99b749844db1d308babe (patch) | |
tree | 9c6132bf13a6f23bf969f2d913cdbf632ac78abc /Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/src/hu/bme/mit/inf/dlsreasoner/alloy/reasoner/builder/Logic2AlloyLanguageMapper_TypeScopeMapping.xtend | |
parent | FAM metamodel loader experiments (diff) | |
parent | scopes added to alloy (diff) | |
download | VIATRA-Generator-a21a898301a172c56cfb99b749844db1d308babe.tar.gz VIATRA-Generator-a21a898301a172c56cfb99b749844db1d308babe.tar.zst VIATRA-Generator-a21a898301a172c56cfb99b749844db1d308babe.zip |
Merge remote-tracking branch 'origin/master' into kris
Diffstat (limited to 'Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/src/hu/bme/mit/inf/dlsreasoner/alloy/reasoner/builder/Logic2AlloyLanguageMapper_TypeScopeMapping.xtend')
-rw-r--r-- | Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/src/hu/bme/mit/inf/dlsreasoner/alloy/reasoner/builder/Logic2AlloyLanguageMapper_TypeScopeMapping.xtend | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/src/hu/bme/mit/inf/dlsreasoner/alloy/reasoner/builder/Logic2AlloyLanguageMapper_TypeScopeMapping.xtend b/Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/src/hu/bme/mit/inf/dlsreasoner/alloy/reasoner/builder/Logic2AlloyLanguageMapper_TypeScopeMapping.xtend new file mode 100644 index 00000000..a270cb73 --- /dev/null +++ b/Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/src/hu/bme/mit/inf/dlsreasoner/alloy/reasoner/builder/Logic2AlloyLanguageMapper_TypeScopeMapping.xtend | |||
@@ -0,0 +1,44 @@ | |||
1 | package hu.bme.mit.inf.dlsreasoner.alloy.reasoner.builder | ||
2 | |||
3 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Type | ||
4 | import hu.bme.mit.inf.dslreasoner.alloyLanguage.ALSDocument | ||
5 | import hu.bme.mit.inf.dslreasoner.alloyLanguage.AlloyLanguageFactory | ||
6 | |||
7 | interface Logic2AlloyLanguageMapper_TypeScopeMapping { | ||
8 | def void addLowerMultiplicity(ALSDocument document, Type type, int lowerMultiplicty, Logic2AlloyLanguageMapper mapper, Logic2AlloyLanguageMapperTrace trace) | ||
9 | def void addUpperMultiplicity(ALSDocument document, Type type, int upperMultiplicty, Logic2AlloyLanguageMapper mapper, Logic2AlloyLanguageMapperTrace trace) | ||
10 | } | ||
11 | |||
12 | class Logic2AlloyLanguageMapper_AsConstraint implements Logic2AlloyLanguageMapper_TypeScopeMapping { | ||
13 | val extension AlloyLanguageFactory factory = AlloyLanguageFactory.eINSTANCE | ||
14 | val Logic2AlloyLanguageMapper_Support support = new Logic2AlloyLanguageMapper_Support; | ||
15 | val Logic2AlloyLanguageMapper_TypeMapper typeMapper | ||
16 | |||
17 | new(Logic2AlloyLanguageMapper_TypeMapper mapper) { | ||
18 | this.typeMapper = mapper | ||
19 | } | ||
20 | |||
21 | override addLowerMultiplicity(ALSDocument document, Type type, int lowerMultiplicty, Logic2AlloyLanguageMapper mapper, Logic2AlloyLanguageMapperTrace trace) { | ||
22 | document.factDeclarations += createALSFactDeclaration => [ | ||
23 | it.name = support.toID(#["LowerMultiplicity",support.toID(type.name),lowerMultiplicty.toString]) | ||
24 | it.term = createALSLeq => [ | ||
25 | it.leftOperand = createALSCardinality => [ | ||
26 | it.operand = support.unfoldPlus(typeMapper.transformTypeReference(type,mapper,trace).map[t|createALSReference => [it.referred = t]].toList) | ||
27 | ] | ||
28 | it.rightOperand = createALSNumberLiteral => [it.value = lowerMultiplicty] | ||
29 | ] | ||
30 | ] | ||
31 | } | ||
32 | |||
33 | override addUpperMultiplicity(ALSDocument document, Type type, int upperMultiplicty, Logic2AlloyLanguageMapper mapper, Logic2AlloyLanguageMapperTrace trace) { | ||
34 | document.factDeclarations += createALSFactDeclaration => [ | ||
35 | it.name = support.toID(#["UpperMultiplicity",support.toID(type.name),upperMultiplicty.toString]) | ||
36 | it.term = createALSMeq => [ | ||
37 | it.leftOperand = createALSCardinality => [ | ||
38 | it.operand = support.unfoldPlus(typeMapper.transformTypeReference(type,mapper,trace).map[t|createALSReference => [it.referred = t]].toList) | ||
39 | ] | ||
40 | it.rightOperand = createALSNumberLiteral => [it.value = upperMultiplicty] | ||
41 | ] | ||
42 | ] | ||
43 | } | ||
44 | } \ No newline at end of file | ||