aboutsummaryrefslogtreecommitdiffstats
path: root/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/VisualiseAllModelInDirectory.xtend
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/VisualiseAllModelInDirectory.xtend')
-rw-r--r--Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/VisualiseAllModelInDirectory.xtend67
1 files changed, 38 insertions, 29 deletions
diff --git a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/VisualiseAllModelInDirectory.xtend b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/VisualiseAllModelInDirectory.xtend
index f0059a85..6b74d161 100644
--- a/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/VisualiseAllModelInDirectory.xtend
+++ b/Tests/hu.bme.mit.inf.dslreasoner.run/src/hu/bme/mit/inf/dslreasoner/run/VisualiseAllModelInDirectory.xtend
@@ -26,39 +26,48 @@ class VisualiseAllModelInDirectory {
26// val folderName = new File("D:/Data/ICSE18/FAM+WF/Largest-by-Graph-Solver") 26// val folderName = new File("D:/Data/ICSE18/FAM+WF/Largest-by-Graph-Solver")
27// for(subFolderName : folderName.listFiles) { 27// for(subFolderName : folderName.listFiles) {
28// subFolderName.absolutePath.visualiseModel 28// subFolderName.absolutePath.visualiseModel
29// } 29// }
30 visualise('''D:\FASE18Meas\OneMinus_Alloy''')
30 } 31 }
31 32
32 def static visualiseModel(String folderName) { 33 def static void visualise(String path) {
33 val file = new File(folderName+"/"+"solution1.partialinterpretation") 34 val file = new File(path)
34 val hasSource = file.exists 35 if(file.isDirectory) {
35 36 for(subFileName : file.list) {
36 37 (path + "/" + subFileName).visualise
37 if(hasSource) {
38 val hasPng = new File(folderName+"/"+"solution1.png").exists
39 val hasGml = new File(folderName+"/"+"solution1.gml").exists
40
41 val workspace = new FileSystemWorkspace(folderName,"")
42 val model = workspace.readModel(PartialInterpretation,"solution1.partialinterpretation")
43
44 if(!hasGml) {
45 val partialInterpretation2GML = new PartialInterpretation2Gml
46 val gmlText = partialInterpretation2GML.transform(model)
47 workspace.writeText('''solution1.gml''',gmlText)
48 println('''solution1.gml''')
49 } 38 }
50 39 } else if(file.isFile) {
51 if(!hasPng && model.newElements.size <160) { 40 if(path.endsWith("partialinterpretation")) {
52 val visualiser = new GraphvizVisualisation 41 visualiseModel(file,path)
53 val visualisation = visualiser.visualiseConcretization(model)
54 visualisation.writeToFile(workspace,"solution1")
55 println("solution1.png")
56 println("Need png!")
57 } 42 }
58 43 }
59 println('''«folderName» visualised''') 44 }
60 } else { 45
61 println('''«folderName» missing''') 46 def static visualiseModel(File file, String fileName) {
47 val list = file.name.split("\\.")
48 val fileNameWithoutExtension = list.subList(0,list.length-1).join('.')
49 val parent = file.parent
50
51 val hasPng = new File(parent + "/" + fileNameWithoutExtension+".png").exists
52 val hasGml = new File(parent + "/" + fileNameWithoutExtension+".gml").exists
53
54 val workspace = new FileSystemWorkspace(parent,"")
55 val model = workspace.readModel(PartialInterpretation,'''«fileNameWithoutExtension».partialinterpretation''')
56
57 if(!hasGml) {
58 val partialInterpretation2GML = new PartialInterpretation2Gml
59 val gmlText = partialInterpretation2GML.transform(model)
60 workspace.writeText('''«fileNameWithoutExtension».gml''',gmlText)
61 println('''«fileNameWithoutExtension».gml''')
62 } 62 }
63
64 if(!hasPng && model.newElements.size <160) {
65 val visualiser = new GraphvizVisualisation
66 val visualisation = visualiser.visualiseConcretization(model)
67 visualisation.writeToFile(workspace,fileNameWithoutExtension)
68 println('''«fileNameWithoutExtension».png''')
69 }
70
71 println('''«parent»/«fileNameWithoutExtension» visualised''')
63 } 72 }
64} 73}