diff options
author | OszkarSemerath <oszkar.semerath@gmail.com> | 2018-08-10 21:28:26 +0200 |
---|---|---|
committer | OszkarSemerath <oszkar.semerath@gmail.com> | 2018-08-10 21:28:26 +0200 |
commit | 049256ab3001e4cd78d484211b9b53419c64256f (patch) | |
tree | 6d10abba65e05f1dbc20406fa05b10115dc88188 /Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/GenerationTaskExecutor.xtend | |
parent | Updated type provider to support java native types (diff) | |
download | VIATRA-Generator-049256ab3001e4cd78d484211b9b53419c64256f.tar.gz VIATRA-Generator-049256ab3001e4cd78d484211b9b53419c64256f.tar.zst VIATRA-Generator-049256ab3001e4cd78d484211b9b53419c64256f.zip |
Application puts hyperlinks of the generated files to the console
Diffstat (limited to 'Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/GenerationTaskExecutor.xtend')
-rw-r--r-- | Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/GenerationTaskExecutor.xtend | 54 |
1 files changed, 51 insertions, 3 deletions
diff --git a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/GenerationTaskExecutor.xtend b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/GenerationTaskExecutor.xtend index 9a8ac8a3..975da665 100644 --- a/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/GenerationTaskExecutor.xtend +++ b/Application/hu.bme.mit.inf.dslreasoner.application/src/hu/bme/mit/inf/dslreasoner/application/execution/GenerationTaskExecutor.xtend | |||
@@ -26,6 +26,8 @@ import java.util.Scanner | |||
26 | import org.eclipse.core.runtime.IProgressMonitor | 26 | import org.eclipse.core.runtime.IProgressMonitor |
27 | import org.eclipse.emf.common.util.URI | 27 | import org.eclipse.emf.common.util.URI |
28 | import hu.bme.mit.inf.dslreasoner.workspace.URIBasedWorkspace | 28 | import hu.bme.mit.inf.dslreasoner.workspace.URIBasedWorkspace |
29 | import java.util.LinkedList | ||
30 | import java.io.File | ||
29 | 31 | ||
30 | class GenerationTaskExecutor { | 32 | class GenerationTaskExecutor { |
31 | val metamodelLoader = new MetamodelLoader | 33 | val metamodelLoader = new MetamodelLoader |
@@ -212,25 +214,62 @@ class GenerationTaskExecutor { | |||
212 | outputWorkspace | 214 | outputWorkspace |
213 | } | 215 | } |
214 | 216 | ||
217 | val emfRepresentations = new LinkedList | ||
218 | val gmlRepresentations = new LinkedList | ||
219 | val dotRepresentations = new LinkedList | ||
220 | |||
215 | for(interpretationIndex : 0..<interpretations.size) { | 221 | for(interpretationIndex : 0..<interpretations.size) { |
216 | monitor.subTask('''Solving problem«IF runs>0» «run»/«runs»«ENDIF»: Visualising solution «interpretationIndex+1»/«interpretations.size»''') | 222 | monitor.subTask('''Solving problem«IF runs>0» «run»/«runs»«ENDIF»: Visualising solution «interpretationIndex+1»/«interpretations.size»''') |
217 | val interpretation = interpretations.get(interpretationIndex) | 223 | val interpretation = interpretations.get(interpretationIndex) |
218 | val model = logic2Ecore.transformInterpretation(interpretation,modelGeneration.trace) | 224 | val model = logic2Ecore.transformInterpretation(interpretation,modelGeneration.trace) |
219 | outputWorkspaceForRun.writeModel(model,'''model«IF runs>1»_«run»«ENDIF»_«interpretationIndex+1».xmi''') | 225 | val emfFileName = '''«IF runs>1»«run»_«ENDIF»«interpretationIndex+1».xmi''' |
226 | outputWorkspaceForRun.writeModel(model,emfFileName) | ||
227 | emfRepresentations += outputWorkspaceForRun.getFile(emfFileName) | ||
220 | 228 | ||
221 | val representation = solution.representation.get(interpretationIndex) | 229 | val representation = solution.representation.get(interpretationIndex) |
222 | if(representation instanceof PartialInterpretation) { | 230 | if(representation instanceof PartialInterpretation) { |
223 | val vis1 = new PartialInterpretation2Gml | 231 | val vis1 = new PartialInterpretation2Gml |
224 | val gml = vis1.transform(representation) | 232 | val gml = vis1.transform(representation) |
225 | outputWorkspaceForRun.writeText('''model«IF runs>1»_«run»«ENDIF»_«interpretationIndex+1».gml''',gml) | 233 | val glmFilename = '''«IF runs>1»«run»_«ENDIF»«interpretationIndex+1».gml''' |
234 | outputWorkspaceForRun.writeText(glmFilename,gml) | ||
235 | gmlRepresentations += outputWorkspaceForRun.getFile(glmFilename) | ||
226 | if(representation.newElements.size + representation.problem.elements.size < 150) { | 236 | if(representation.newElements.size + representation.problem.elements.size < 150) { |
227 | val vis2 = new GraphvizVisualiser | 237 | val vis2 = new GraphvizVisualiser |
228 | val dot = vis2.visualiseConcretization(representation) | 238 | val dot = vis2.visualiseConcretization(representation) |
229 | dot.writeToFile(outputWorkspaceForRun,'''model«IF runs>1»_«run»«ENDIF»_«interpretationIndex+1».png''') | 239 | val dotFileName = '''«IF runs>1»«run»_«ENDIF»«interpretationIndex+1».png''' |
240 | dot.writeToFile(outputWorkspaceForRun,dotFileName) | ||
241 | dotRepresentations += outputWorkspaceForRun.getFile(dotFileName) | ||
242 | } | ||
243 | else { | ||
244 | dotRepresentations += null | ||
230 | } | 245 | } |
246 | } else { | ||
247 | gmlRepresentations += null | ||
248 | dotRepresentations += null | ||
231 | } | 249 | } |
232 | monitor.worked(100) | 250 | monitor.worked(100) |
233 | } | 251 | } |
252 | console.writeMessage( | ||
253 | '''Models: «FOR f : emfRepresentations»#«ENDFOR»''', | ||
254 | "#", | ||
255 | emfRepresentations.map[ | ||
256 | new ScriptConsoleDecorator('''«it.fileRepresentationInConsole»''',it) | ||
257 | ] | ||
258 | ) | ||
259 | console.writeMessage( | ||
260 | '''Visualisations: «FOR f : gmlRepresentations»#«ENDFOR»''', | ||
261 | "#", | ||
262 | gmlRepresentations.map[ | ||
263 | new ScriptConsoleDecorator('''«it.fileRepresentationInConsole»''',it) | ||
264 | ] | ||
265 | ) | ||
266 | console.writeMessage( | ||
267 | '''Visualisations: «FOR f : dotRepresentations»#«ENDFOR»''', | ||
268 | "#", | ||
269 | dotRepresentations.map[ | ||
270 | new ScriptConsoleDecorator('''«it.fileRepresentationInConsole»''',it) | ||
271 | ] | ||
272 | ) | ||
234 | } else { | 273 | } else { |
235 | monitor.worked(solverConfig.solutionScope.numberOfRequiredSolution*100) | 274 | monitor.worked(solverConfig.solutionScope.numberOfRequiredSolution*100) |
236 | } | 275 | } |
@@ -261,6 +300,15 @@ class GenerationTaskExecutor { | |||
261 | } | 300 | } |
262 | } | 301 | } |
263 | 302 | ||
303 | private def fileRepresentationInConsole(File file) { | ||
304 | // if(file.name.contains('.')) { | ||
305 | // return file.name.substring(0,file.name.lastIndexOf('.')) | ||
306 | // } else { | ||
307 | // file.name | ||
308 | // } | ||
309 | file.name | ||
310 | } | ||
311 | |||
264 | private def dispatch soutionDescription(InconsistencyResult s) { | 312 | private def dispatch soutionDescription(InconsistencyResult s) { |
265 | if(s.representation.size == 0) { | 313 | if(s.representation.size == 0) { |
266 | '''Problem is inconsistent, no model is created!''' | 314 | '''Problem is inconsistent, no model is created!''' |