Merge lp:~boegholm/juppaal/SARTS-sync into lp:juppaal

Proposed by Thomas Bøgholm
Status: Needs review
Proposed branch: lp:~boegholm/juppaal/SARTS-sync
Merge into: lp:juppaal
Diff against target: 166 lines (+54/-10)
5 files modified
src/uppaal/Automaton.java (+11/-1)
src/uppaal/Location.java (+2/-1)
src/uppaal/SystemDeclaration.java (+5/-2)
src/uppaal/Transition.java (+6/-4)
src/uppaal/UPPAALPrettyfy.java (+30/-2)
To merge this branch: bzr merge lp:~boegholm/juppaal/SARTS-sync
Reviewer Review Type Date Requested Status
Kasper Søe Luckow Pending
Review via email: mp+138436@code.launchpad.net

Description of the change

Sync with SARTS-juppaal
 - replaced:
 return automaton.getName().getName() + id;
 - with
 return "id" + String.valueOf(id);

Which is correct?

To post a comment you must log in.

Unmerged revisions

5. By Thomas Bøgholm (<email address hidden>)

synced with SARTS-juppaal

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/uppaal/Automaton.java'
2--- src/uppaal/Automaton.java 2012-12-05 15:16:00 +0000
3+++ src/uppaal/Automaton.java 2012-12-06 12:13:28 +0000
4@@ -89,7 +89,8 @@
5 boolean dbg_matchresult = matcher.find();
6 assert dbg_matchresult;
7 String s = matcher.group();
8- init = id_locationMap.get(this.getName().getName() + s);
9+ init = id_locationMap.get("id" + s);
10+ //init = id_locationMap.get(this.getName().getName() + s);
11 }
12 }
13
14@@ -157,6 +158,10 @@
15 public ArrayList<Location> getLocations() {
16 return locations;
17 }
18+
19+// public void removeLocation(Location loc) {
20+// this.locations.remove(loc);
21+// }
22
23 public Location getInit() {
24 if(this.init== null){
25@@ -179,11 +184,16 @@
26 return transitions;
27 }
28
29+// public void removeTransition(Transition removeTrans) {
30+// this.transitions.remove(removeTrans);
31+// }
32+
33 public void addLocation(Location location) {
34 assert !getLocations().contains(location) : "Template already contains this location";
35 assert location.getAutomaton() == null || this.equals(location.getAutomaton()) : "Cannot add from other automata yet";
36 if(location.getAutomaton() == null)
37 location.setAutomaton(this);
38+ this.id_locationMap.put(location.getUniqueIdString(), location);
39 this.locations.add(location);
40 }
41
42
43=== modified file 'src/uppaal/Location.java'
44--- src/uppaal/Location.java 2012-12-05 15:16:00 +0000
45+++ src/uppaal/Location.java 2012-12-06 12:13:28 +0000
46@@ -153,7 +153,8 @@
47 }
48
49 public String getUniqueIdString(){
50- return automaton.getName().getName()+id;
51+ return "id" + String.valueOf(id);
52+ //return automaton.getName().getName() + id;
53 }
54
55 public Invariant getInvariant() {
56
57=== modified file 'src/uppaal/SystemDeclaration.java'
58--- src/uppaal/SystemDeclaration.java 2012-08-09 13:03:06 +0000
59+++ src/uppaal/SystemDeclaration.java 2012-12-06 12:13:28 +0000
60@@ -36,6 +36,9 @@
61 public List<String> getDeclarations() {
62 return this.declarations;
63 }
64+ public void addSystemDeclaration(String string) {
65+ this.addDeclaration(string);
66+ }
67 @Override
68 public String getXMLElementName() {
69 return "system";
70@@ -52,9 +55,9 @@
71 for(String decl : declarations)
72 sb.append(decl+"\n");
73 if(systemInstances.size()>0){
74- sb.append("system ");
75+ sb.append("system \n\t");
76 for(int index=0;index<systemInstances.size();index++){
77- sb.append(systemInstances.get(index) + ((index+1)<systemInstances.size()?",":";"));
78+ sb.append(systemInstances.get(index) + ((index+1)<systemInstances.size()?",\n\t":";"));
79 }
80 }
81 Element result = super.generateXMLElement();
82
83=== modified file 'src/uppaal/Transition.java'
84--- src/uppaal/Transition.java 2012-12-05 15:16:00 +0000
85+++ src/uppaal/Transition.java 2012-12-06 12:13:28 +0000
86@@ -111,13 +111,15 @@
87 boolean dbg_matchresult = matcher.find();
88 assert dbg_matchresult;
89
90- source = automaton.id_locationMap.get(automaton.getName().getName() + matcher.group(1));
91+ //source = automaton.id_locationMap.get(automaton.getName().getName() + matcher.group(1));
92+ source = automaton.id_locationMap.get("id" + matcher.group(1));
93 String targetString = transitionElement.getChild("target").getAttributeValue("ref");
94 matcher = locationIdRegExPattern.matcher(targetString);
95 dbg_matchresult = matcher.find();
96 assert dbg_matchresult;
97
98- destination = automaton.id_locationMap.get(automaton.getName().getName() + matcher.group(1));
99+ //destination = automaton.id_locationMap.get(automaton.getName().getName() + matcher.group(1));
100+ destination = automaton.id_locationMap.get("id" + matcher.group(1));
101
102 @SuppressWarnings("unchecked")
103 List<Element> children = transitionElement.getChildren();
104@@ -162,8 +164,8 @@
105 return nails;
106 }
107
108- public void setNails(ArrayList<Nail> nails) {
109- this.nails = nails;
110+ public void setNails(List<Nail> list) {
111+ this.nails = list;
112 }
113
114 public void addNail(Nail nail){
115
116=== modified file 'src/uppaal/UPPAALPrettyfy.java'
117--- src/uppaal/UPPAALPrettyfy.java 2012-08-09 13:03:06 +0000
118+++ src/uppaal/UPPAALPrettyfy.java 2012-12-06 12:13:28 +0000
119@@ -28,6 +28,34 @@
120 List<Element> templates = rootElement.getChildren("template");
121
122 for(Element template : templates){
123+ List<Element> transitions = template.getChildren("transition");
124+ for(Element transition : transitions) {
125+ List<Element> labels = transition.getChildren("label");
126+ for(Element label : labels) {
127+ label.removeAttribute("x");
128+ label.removeAttribute("y");
129+ }
130+ transition.removeChildren("nail");
131+
132+ }
133+ List<Element> locations = template.getChildren("location");
134+ for(Element location : locations) {
135+ location.removeAttribute("x");
136+ location.removeAttribute("y");
137+
138+ List<Element> labels = location.getChildren("label");
139+ for(Element label : labels) {
140+ label.removeAttribute("x");
141+ label.removeAttribute("y");
142+ }
143+ List<Element> names = location.getChildren("name");
144+ for(Element name : names) {
145+ name.removeAttribute("x");
146+ name.removeAttribute("y");
147+ }
148+ }
149+
150+
151 Graph graph = new Graph(template.getChildText("name"));
152
153 graph = loadGraph( template, graph);
154@@ -55,10 +83,10 @@
155 }
156 }
157 }
158-
159 return uppaalXml;
160-
161 }
162+
163+
164 private static File writeGraph(Element template, Graph graph) throws FileNotFoundException, IOException, InterruptedException {
165 File folder = new File("/tmp/juppaal/");
166 folder.mkdirs();

Subscribers

People subscribed via source and target branches

to all changes: