|
2 | 2 |
|
3 | 3 | import java.io.File; |
4 | 4 | import java.io.IOException; |
5 | | -import java.util.ArrayList; |
6 | 5 | import java.util.Arrays; |
7 | 6 | import java.util.List; |
8 | 7 |
|
9 | 8 | import org.eclipse.equinox.app.IApplication; |
10 | 9 | import org.eclipse.equinox.app.IApplicationContext; |
11 | | - |
| 10 | +import fr.lip6.move.ahg.AttackHyperGraph; |
| 11 | +import fr.lip6.move.ahg.togal.transform.AHGToGALTransformer; |
12 | 12 | import fr.lip6.move.gal.CTLProp; |
13 | 13 | import fr.lip6.move.gal.LTLProp; |
14 | | -import fr.lip6.move.gal.Property; |
15 | 14 | import fr.lip6.move.gal.SafetyProp; |
16 | 15 | import fr.lip6.move.gal.Specification; |
17 | 16 | import fr.lip6.move.gal.instantiate.GALRewriter; |
18 | 17 | import fr.lip6.move.gal.itstools.CommandLineBuilder; |
19 | 18 | import fr.lip6.move.gal.process.CommandLine; |
20 | 19 | import fr.lip6.move.gal.process.Runner; |
21 | 20 | import fr.lip6.move.gal.itstools.BinaryToolsPlugin.Tool; |
| 21 | +import fr.lip6.move.serialization.AHGSerializationUtil; |
22 | 22 | import fr.lip6.move.serialization.SerializationUtil; |
23 | 23 |
|
24 | 24 | public class Application implements IApplication { |
@@ -96,8 +96,27 @@ public Object start(IApplicationContext context) throws Exception { |
96 | 96 | SerializationUtil.setStandalone(true); |
97 | 97 |
|
98 | 98 | long time = System.currentTimeMillis(); |
99 | | - Specification spec = SerializationUtil.fileToGalSystem(inputff); |
100 | | - System.out.println("Successfully read input file : " + inputff +" in " + (time - System.currentTimeMillis()) + " ms."); |
| 99 | + Specification spec = null; |
| 100 | + |
| 101 | + if (ff.getName().endsWith(".gal")) { |
| 102 | + spec = SerializationUtil.fileToGalSystem(inputff); |
| 103 | + System.out.println("Successfully read input file : " + inputff +" in " + (time - System.currentTimeMillis()) + " ms."); |
| 104 | + } else if (ff.getName().endsWith(".ahg")) { |
| 105 | + AttackHyperGraph ahg = AHGSerializationUtil.fileToAttackHyperGraph(inputff); |
| 106 | + spec = AHGToGALTransformer.transformToGAL(ahg, modelName); |
| 107 | + System.out.println("Successfully read input file : " + inputff + " and translated to GAL in " |
| 108 | + + (time - System.currentTimeMillis()) + " ms."); |
| 109 | + String [] nitsflags = new String[itsflags.length+2] ; |
| 110 | + for (int i = 0; i < itsflags.length; i++) { |
| 111 | + nitsflags[i] = itsflags[i]; |
| 112 | + } |
| 113 | + nitsflags[nitsflags.length-2] = "--shortestAttacks"; |
| 114 | + nitsflags[nitsflags.length-1] = ff.getCanonicalPath()+".att"; |
| 115 | + itsflags = nitsflags; |
| 116 | + } else { |
| 117 | + System.err.println("Input file must be a .gal or .ahg file"); |
| 118 | + return null; |
| 119 | + } |
101 | 120 |
|
102 | 121 | String cwd = pwd + "/work"; |
103 | 122 | File fcwd = new File(cwd); |
|
0 commit comments