Skip to content
Snippets Groups Projects
Commit e9405089 authored by apvrille's avatar apvrille
Browse files

Update on graph viz. from TTool

parent 18c16728
No related branches found
No related tags found
No related merge requests found
...@@ -64,7 +64,7 @@ TTOOL_PATH := $(shell /bin/pwd) ...@@ -64,7 +64,7 @@ TTOOL_PATH := $(shell /bin/pwd)
TTOOL_SRC = $(TTOOL_PATH)/src TTOOL_SRC = $(TTOOL_PATH)/src
TTOOL_WEBCRAWLER_SRC = $(TTOOL_PATH)/src/web/crawler TTOOL_WEBCRAWLER_SRC = $(TTOOL_PATH)/src/web/crawler
TTOOL_BIN = $(TTOOL_PATH)/bin 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)/modeling
#TTOOL_MODELING = $(TTOOL_PATH)/figures #TTOOL_MODELING = $(TTOOL_PATH)/figures
TTOOL_EXECUTABLECODE = $(TTOOL_PATH)/executablecode TTOOL_EXECUTABLECODE = $(TTOOL_PATH)/executablecode
......
File added
...@@ -49,6 +49,7 @@ import java.util.*; ...@@ -49,6 +49,7 @@ import java.util.*;
import java.io.*; import java.io.*;
import myutil.*; import myutil.*;
import org.graphstream.graph.implementations.*;
public class AUTGraph implements myutil.Graph { public class AUTGraph implements myutil.Graph {
...@@ -385,4 +386,24 @@ 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();
}
} }
/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille /**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
ludovic.apvrille AT enst.fr ludovic.apvrille AT enst.fr
This software is a computer program whose purpose is to allow the This software is a computer program whose purpose is to allow the
edition of TURTLE analysis, design and deployment diagrams, to edition of TURTLE analysis, design and deployment diagrams, to
allow the generation of RT-LOTOS or Java code from this diagram, allow the generation of RT-LOTOS or Java code from this diagram,
and at last to allow the analysis of formal validation traces and at last to allow the analysis of formal validation traces
obtained from external tools, e.g. RTL from LAAS-CNRS and CADP obtained from external tools, e.g. RTL from LAAS-CNRS and CADP
from INRIA Rhone-Alpes. from INRIA Rhone-Alpes.
This software is governed by the CeCILL license under French law and This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can use, abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info". "http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy, 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 modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited economic rights, and the successive licensors have only limited
liability. liability.
In this respect, the user's attention is drawn to the risks associated In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software, 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 that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or 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 data to be ensured and, more generally, to use and operate it in the
same conditions as regards security. same conditions as regards security.
The fact that you are presently reading this means that you have had The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms. knowledge of the CeCILL license and that you accept its terms.
/** /**
* Class AUTState * Class AUTState
* Creation : 05/03/2008 * Creation : 05/03/2008
** @version 1.0 05/03/2008 ** @version 1.0 05/03/2008
* @author Ludovic APVRILLE * @author Ludovic APVRILLE
* @see * @see
*/ */
package ui.graph; package ui.graph;
import java.util.*; import java.util.*;
public class AUTState { public class AUTState {
public int id; public int id;
public ArrayList<AUTTransition> inTransitions; // Arriving to that state public ArrayList<AUTTransition> inTransitions; // Arriving to that state
public ArrayList<AUTTransition> outTransitions; // Departing from that state public ArrayList<AUTTransition> outTransitions; // Departing from that state
public boolean met = false; public boolean met = false;
public AUTState(int _id) { public AUTState(int _id) {
id = _id; id = _id;
inTransitions = new ArrayList<AUTTransition>(); inTransitions = new ArrayList<AUTTransition>();
outTransitions = 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) { public int getNbInTransitions() {
inTransitions.add(tr); return inTransitions.size();
} }
public void addOutTransition(AUTTransition tr) { public int getNbOutTransitions() {
outTransitions.add(tr); return outTransitions.size();
} }
public int getNbInTransitions() { public boolean hasTransitionTo(int destination) {
return inTransitions.size(); for(AUTTransition aut1 : outTransitions) {
} if (aut1.destination == destination) {
return true;
public int getNbOutTransitions() { }
return outTransitions.size(); }
} return false;
}
public boolean hasTransitionTo(int destination) {
for(AUTTransition aut1 : outTransitions) { public AUTTransition returnRandomTransition() {
if (aut1.destination == destination) { int size = outTransitions.size();
return true; if (size == 0) {
} return null;
} }
return false;
} if (size == 1) {
return outTransitions.get(0);
public AUTTransition returnRandomTransition() { }
int size = outTransitions.size();
if (size == 0) { Random generator = new Random();
return null; int choice = generator.nextInt(size);
} return outTransitions.get(choice);
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
...@@ -99,6 +99,7 @@ public class JFrameStatistics extends JFrame implements ActionListener, Stoppab ...@@ -99,6 +99,7 @@ public class JFrameStatistics extends JFrame implements ActionListener, Stoppab
JTextField combo1, combo2, combo3, combo4; JTextField combo1, combo2, combo3, combo4;
JTextField text1, text2; JTextField text1, text2;
JButton goPath, goPathL, savePath, savePathL; JButton goPath, goPathL, savePath, savePathL;
private JButton showGraph;
public synchronized void stopElement() { public synchronized void stopElement() {
if (computingPath) { if (computingPath) {
...@@ -289,6 +290,14 @@ public class JFrameStatistics extends JFrame implements ActionListener, Stoppab ...@@ -289,6 +290,14 @@ public class JFrameStatistics extends JFrame implements ActionListener, Stoppab
transition.setText(String.valueOf(graph.getNbOfTransitions())); transition.setText(String.valueOf(graph.getNbOfTransitions()));
jp.add(transition); jp.add(transition);
showGraph = new JButton("Display graph");
showGraph.addActionListener(this);
if (graph.getNbOfStates() < 10000) {
jp.add(showGraph);
}
if (shouldIStop()) { if (shouldIStop()) {
return; return;
} }
...@@ -555,7 +564,9 @@ public class JFrameStatistics extends JFrame implements ActionListener, Stoppab ...@@ -555,7 +564,9 @@ public class JFrameStatistics extends JFrame implements ActionListener, Stoppab
saveAutomata(lastShortestAutomata); saveAutomata(lastShortestAutomata);
} else if (evt.getSource() == savePathL) { } else if (evt.getSource() == savePathL) {
saveAutomata(lastLongestAutomata); saveAutomata(lastLongestAutomata);
} } else if (evt.getSource() == showGraph) {
graph.display();
}
} }
private void saveAutomata(Automata aut) { private void saveAutomata(Automata aut) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment