diff --git a/Makefile b/Makefile index a8b7fca1b2173efd6f36680cebc34d68feee973b..95e1a3fc304e7b91f8b371c232f02d47edaed374 100755 --- a/Makefile +++ b/Makefile @@ -64,7 +64,7 @@ TTOOL_PATH := $(shell /bin/pwd) TTOOL_SRC = $(TTOOL_PATH)/src TTOOL_WEBCRAWLER_SRC = $(TTOOL_PATH)/src/web/crawler TTOOL_BIN = $(TTOOL_PATH)/bin -TTOOL_CLASSPATH_BINARY = $(TTOOL_BIN)/JavaPlot.jar:$(TTOOL_BIN)/commons-codec-1.10.jar:$(TTOOL_BIN)/commons-io-2.4-javadoc.jar:$(TTOOL_BIN)/commons-io-2.4.jar:$(TTOOL_BIN)/derby.jar:$(TTOOL_BIN)/derbyclient-10.9.1.0.jar:$(TTOOL_BIN)/derbynet.jar:$(TTOOL_BIN)/dom4j-1.6.1.jar:$(TTOOL_BIN)/jaxen-1.1.6.jar:$(TTOOL_BIN)/jsoup-1.8.1.jar:$(TTOOL_BIN)/opencloud.jar:. +TTOOL_CLASSPATH_BINARY = $(TTOOL_BIN)/JavaPlot.jar:$(TTOOL_BIN)/commons-codec-1.10.jar:$(TTOOL_BIN)/commons-io-2.4-javadoc.jar:$(TTOOL_BIN)/commons-io-2.4.jar:$(TTOOL_BIN)/derby.jar:$(TTOOL_BIN)/derbyclient-10.9.1.0.jar:$(TTOOL_BIN)/derbynet.jar:$(TTOOL_BIN)/dom4j-1.6.1.jar:$(TTOOL_BIN)/jaxen-1.1.6.jar:$(TTOOL_BIN)/jsoup-1.8.1.jar:$(TTOOL_BIN)/opencloud.jar:$(TTOOL_BIN)/gs-core-1.3.jar:. TTOOL_MODELING = $(TTOOL_PATH)/modeling #TTOOL_MODELING = $(TTOOL_PATH)/figures TTOOL_EXECUTABLECODE = $(TTOOL_PATH)/executablecode diff --git a/bin/gs-core-1.3.jar b/bin/gs-core-1.3.jar new file mode 100644 index 0000000000000000000000000000000000000000..c8f50fdb351542ba539e0972e6bd75b962044a0a Binary files /dev/null and b/bin/gs-core-1.3.jar differ diff --git a/src/ui/graph/AUTGraph.java b/src/ui/graph/AUTGraph.java index e6b8b5347fc8fe7f7903e6487636e211c7ad44f6..94e4beb269795b32b6f4b19cd72d37428956e5ab 100755 --- a/src/ui/graph/AUTGraph.java +++ b/src/ui/graph/AUTGraph.java @@ -49,6 +49,7 @@ import java.util.*; import java.io.*; import myutil.*; +import org.graphstream.graph.implementations.*; public class AUTGraph implements myutil.Graph { @@ -385,4 +386,24 @@ public class AUTGraph implements myutil.Graph { } } + public void display() { + MultiNode node; + AbstractEdge edge; + + MultiGraph graph = new MultiGraph("TTool graph"); + for(AUTState state: states) { + node = graph.addNode("" + state.id); + node.addAttribute("ui.label", "" + state.id); + } + int cpt = 0; + for(AUTTransition transition: transitions) { + edge = graph.addEdge(""+cpt, ""+transition.origin, ""+transition.destination, true); + edge.addAttribute("ui.label", transition.transition); + cpt ++; + } + //graph.addAttribute("ui.stylesheet", "graph { fill-color: red; }"); + graph.display(); + + } + } diff --git a/src/ui/graph/AUTState.java b/src/ui/graph/AUTState.java index 01ba7c8ef09408362500b05c09a4717173100ffe..d54b6cdb14484e4840e346724d518301f363644b 100755 --- a/src/ui/graph/AUTState.java +++ b/src/ui/graph/AUTState.java @@ -1,104 +1,104 @@ /**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille -ludovic.apvrille AT enst.fr - -This software is a computer program whose purpose is to allow the -edition of TURTLE analysis, design and deployment diagrams, to -allow the generation of RT-LOTOS or Java code from this diagram, -and at last to allow the analysis of formal validation traces -obtained from external tools, e.g. RTL from LAAS-CNRS and CADP -from INRIA Rhone-Alpes. - -This software is governed by the CeCILL license under French law and -abiding by the rules of distribution of free software. You can use, -modify and/ or redistribute the software under the terms of the CeCILL -license as circulated by CEA, CNRS and INRIA at the following URL -"http://www.cecill.info". - -As a counterpart to the access to the source code and rights to copy, -modify and redistribute granted by the license, users are provided only -with a limited warranty and the software's author, the holder of the -economic rights, and the successive licensors have only limited -liability. - -In this respect, the user's attention is drawn to the risks associated -with loading, using, modifying and/or developing or reproducing the -software by the user in light of its specific status of free software, -that may mean that it is complicated to manipulate, and that also -therefore means that it is reserved for developers and experienced -professionals having in-depth computer knowledge. Users are therefore -encouraged to load and test the software's suitability as regards their -requirements in conditions enabling the security of their systems and/or -data to be ensured and, more generally, to use and operate it in the -same conditions as regards security. - -The fact that you are presently reading this means that you have had -knowledge of the CeCILL license and that you accept its terms. - -/** - * Class AUTState - * Creation : 05/03/2008 - ** @version 1.0 05/03/2008 - * @author Ludovic APVRILLE - * @see - */ - + ludovic.apvrille AT enst.fr + + This software is a computer program whose purpose is to allow the + edition of TURTLE analysis, design and deployment diagrams, to + allow the generation of RT-LOTOS or Java code from this diagram, + and at last to allow the analysis of formal validation traces + obtained from external tools, e.g. RTL from LAAS-CNRS and CADP + from INRIA Rhone-Alpes. + + This software is governed by the CeCILL license under French law and + abiding by the rules of distribution of free software. You can use, + modify and/ or redistribute the software under the terms of the CeCILL + license as circulated by CEA, CNRS and INRIA at the following URL + "http://www.cecill.info". + + As a counterpart to the access to the source code and rights to copy, + modify and redistribute granted by the license, users are provided only + with a limited warranty and the software's author, the holder of the + economic rights, and the successive licensors have only limited + liability. + + In this respect, the user's attention is drawn to the risks associated + with loading, using, modifying and/or developing or reproducing the + software by the user in light of its specific status of free software, + that may mean that it is complicated to manipulate, and that also + therefore means that it is reserved for developers and experienced + professionals having in-depth computer knowledge. Users are therefore + encouraged to load and test the software's suitability as regards their + requirements in conditions enabling the security of their systems and/or + data to be ensured and, more generally, to use and operate it in the + same conditions as regards security. + + The fact that you are presently reading this means that you have had + knowledge of the CeCILL license and that you accept its terms. + + /** + * Class AUTState + * Creation : 05/03/2008 + ** @version 1.0 05/03/2008 + * @author Ludovic APVRILLE + * @see + */ + package ui.graph; import java.util.*; public class AUTState { - + public int id; public ArrayList<AUTTransition> inTransitions; // Arriving to that state - public ArrayList<AUTTransition> outTransitions; // Departing from that state - public boolean met = false; - + public ArrayList<AUTTransition> outTransitions; // Departing from that state + public boolean met = false; + public AUTState(int _id) { id = _id; - inTransitions = new ArrayList<AUTTransition>(); - outTransitions = new ArrayList<AUTTransition>(); + inTransitions = new ArrayList<AUTTransition>(); + outTransitions = new ArrayList<AUTTransition>(); + } + + public void addInTransition(AUTTransition tr) { + inTransitions.add(tr); + } + + public void addOutTransition(AUTTransition tr) { + outTransitions.add(tr); } - - public void addInTransition(AUTTransition tr) { - inTransitions.add(tr); - } - - public void addOutTransition(AUTTransition tr) { - outTransitions.add(tr); - } - - public int getNbInTransitions() { - return inTransitions.size(); - } - - public int getNbOutTransitions() { - return outTransitions.size(); - } - - public boolean hasTransitionTo(int destination) { - for(AUTTransition aut1 : outTransitions) { - if (aut1.destination == destination) { - return true; - } - } - return false; - } - - public AUTTransition returnRandomTransition() { - int size = outTransitions.size(); - if (size == 0) { - return null; - } - - if (size == 1) { - return outTransitions.get(0); - } - - Random generator = new Random(); - int choice = generator.nextInt(size); - return outTransitions.get(choice); - - } - -} \ No newline at end of file + + public int getNbInTransitions() { + return inTransitions.size(); + } + + public int getNbOutTransitions() { + return outTransitions.size(); + } + + public boolean hasTransitionTo(int destination) { + for(AUTTransition aut1 : outTransitions) { + if (aut1.destination == destination) { + return true; + } + } + return false; + } + + public AUTTransition returnRandomTransition() { + int size = outTransitions.size(); + if (size == 0) { + return null; + } + + if (size == 1) { + return outTransitions.get(0); + } + + Random generator = new Random(); + int choice = generator.nextInt(size); + return outTransitions.get(choice); + + } + +} diff --git a/src/ui/window/JFrameStatistics.java b/src/ui/window/JFrameStatistics.java index 01adedaea22250f626f5da2793e848815c5d9a76..0532a9e00ff31b23c7ff2da2fbe0fdd15a3732c0 100755 --- a/src/ui/window/JFrameStatistics.java +++ b/src/ui/window/JFrameStatistics.java @@ -99,6 +99,7 @@ public class JFrameStatistics extends JFrame implements ActionListener, Stoppab JTextField combo1, combo2, combo3, combo4; JTextField text1, text2; JButton goPath, goPathL, savePath, savePathL; + private JButton showGraph; public synchronized void stopElement() { if (computingPath) { @@ -289,6 +290,14 @@ public class JFrameStatistics extends JFrame implements ActionListener, Stoppab transition.setText(String.valueOf(graph.getNbOfTransitions())); jp.add(transition); + showGraph = new JButton("Display graph"); + showGraph.addActionListener(this); + if (graph.getNbOfStates() < 10000) { + jp.add(showGraph); + } + + + if (shouldIStop()) { return; } @@ -555,7 +564,9 @@ public class JFrameStatistics extends JFrame implements ActionListener, Stoppab saveAutomata(lastShortestAutomata); } else if (evt.getSource() == savePathL) { saveAutomata(lastLongestAutomata); - } + } else if (evt.getSource() == showGraph) { + graph.display(); + } } private void saveAutomata(Automata aut) {