diff options
Diffstat (limited to 'Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/src/hu/bme/mit/inf/dlsreasoner/alloy/reasoner/AlloySolver.xtend')
-rw-r--r-- | Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/src/hu/bme/mit/inf/dlsreasoner/alloy/reasoner/AlloySolver.xtend | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/src/hu/bme/mit/inf/dlsreasoner/alloy/reasoner/AlloySolver.xtend b/Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/src/hu/bme/mit/inf/dlsreasoner/alloy/reasoner/AlloySolver.xtend index a29af455..9c2d7bf1 100644 --- a/Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/src/hu/bme/mit/inf/dlsreasoner/alloy/reasoner/AlloySolver.xtend +++ b/Solvers/Alloy-Solver/hu.bme.mit.inf.dlsreasoner.alloy.reasoner/src/hu/bme/mit/inf/dlsreasoner/alloy/reasoner/AlloySolver.xtend | |||
@@ -9,6 +9,7 @@ import hu.bme.mit.inf.dlsreasoner.alloy.reasoner.builder.Logic2AlloyLanguageMapp | |||
9 | import hu.bme.mit.inf.dlsreasoner.alloy.reasoner.builder.Logic2AlloyLanguageMapper_TypeMapper_FilteredTypes | 9 | import hu.bme.mit.inf.dlsreasoner.alloy.reasoner.builder.Logic2AlloyLanguageMapper_TypeMapper_FilteredTypes |
10 | import hu.bme.mit.inf.dslreasoner.AlloyLanguageStandaloneSetupGenerated | 10 | import hu.bme.mit.inf.dslreasoner.AlloyLanguageStandaloneSetupGenerated |
11 | import hu.bme.mit.inf.dslreasoner.alloyLanguage.AlloyLanguagePackage | 11 | import hu.bme.mit.inf.dslreasoner.alloyLanguage.AlloyLanguagePackage |
12 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.DocumentationLevel | ||
12 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicReasoner | 13 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicReasoner |
13 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicReasonerException | 14 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicReasonerException |
14 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicSolverConfiguration | 15 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicSolverConfiguration |
@@ -32,6 +33,9 @@ class AlloySolver extends LogicReasoner{ | |||
32 | 33 | ||
33 | override solve(LogicProblem problem, LogicSolverConfiguration configuration, ReasonerWorkspace workspace) throws LogicReasonerException { | 34 | override solve(LogicProblem problem, LogicSolverConfiguration configuration, ReasonerWorkspace workspace) throws LogicReasonerException { |
34 | val alloyConfig = configuration.asConfig | 35 | val alloyConfig = configuration.asConfig |
36 | val writeToFile = ( | ||
37 | configuration.documentationLevel===DocumentationLevel::NORMAL || | ||
38 | configuration.documentationLevel===DocumentationLevel::FULL) | ||
35 | 39 | ||
36 | // Start: Logic -> Alloy mapping | 40 | // Start: Logic -> Alloy mapping |
37 | val transformationStart = System.currentTimeMillis | 41 | val transformationStart = System.currentTimeMillis |
@@ -41,7 +45,7 @@ class AlloySolver extends LogicReasoner{ | |||
41 | 45 | ||
42 | var String fileURI = null; | 46 | var String fileURI = null; |
43 | var String alloyCode = null; | 47 | var String alloyCode = null; |
44 | if(alloyConfig.writeToFile) { | 48 | if(writeToFile) { |
45 | fileURI = workspace.writeModel(alloyProblem,fileName).toFileString | 49 | fileURI = workspace.writeModel(alloyProblem,fileName).toFileString |
46 | } else { | 50 | } else { |
47 | alloyCode = workspace.writeModelToString(alloyProblem,fileName) | 51 | alloyCode = workspace.writeModelToString(alloyProblem,fileName) |
@@ -57,7 +61,7 @@ class AlloySolver extends LogicReasoner{ | |||
57 | val solverFinish = System.currentTimeMillis-solverStart | 61 | val solverFinish = System.currentTimeMillis-solverStart |
58 | // Finish: Solving Alloy problem | 62 | // Finish: Solving Alloy problem |
59 | 63 | ||
60 | if(alloyConfig.writeToFile) workspace.deactivateModel(fileName) | 64 | if(writeToFile) workspace.deactivateModel(fileName) |
61 | 65 | ||
62 | return logicResult | 66 | return logicResult |
63 | } | 67 | } |
@@ -66,7 +70,7 @@ class AlloySolver extends LogicReasoner{ | |||
66 | if(configuration instanceof AlloySolverConfiguration) { | 70 | if(configuration instanceof AlloySolverConfiguration) { |
67 | return configuration | 71 | return configuration |
68 | } else { | 72 | } else { |
69 | throw new IllegalArgumentException('''The configuration have to be an «AlloySolverConfiguration.simpleName»!''') | 73 | throw new IllegalArgumentException('''The configuration has to be an «AlloySolverConfiguration.simpleName»!''') |
70 | } | 74 | } |
71 | } | 75 | } |
72 | 76 | ||