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
=== modified file 'src/uppaal/Automaton.java'
--- src/uppaal/Automaton.java 2012-12-05 15:16:00 +0000
+++ src/uppaal/Automaton.java 2012-12-06 12:13:28 +0000
@@ -89,7 +89,8 @@
89 boolean dbg_matchresult = matcher.find();89 boolean dbg_matchresult = matcher.find();
90 assert dbg_matchresult;90 assert dbg_matchresult;
91 String s = matcher.group();91 String s = matcher.group();
92 init = id_locationMap.get(this.getName().getName() + s);92 init = id_locationMap.get("id" + s);
93 //init = id_locationMap.get(this.getName().getName() + s);
93 }94 }
94 }95 }
95 96
@@ -157,6 +158,10 @@
157 public ArrayList<Location> getLocations() {158 public ArrayList<Location> getLocations() {
158 return locations;159 return locations;
159 }160 }
161
162// public void removeLocation(Location loc) {
163// this.locations.remove(loc);
164// }
160165
161 public Location getInit() {166 public Location getInit() {
162 if(this.init== null){167 if(this.init== null){
@@ -179,11 +184,16 @@
179 return transitions;184 return transitions;
180 }185 }
181186
187// public void removeTransition(Transition removeTrans) {
188// this.transitions.remove(removeTrans);
189// }
190
182 public void addLocation(Location location) {191 public void addLocation(Location location) {
183 assert !getLocations().contains(location) : "Template already contains this location";192 assert !getLocations().contains(location) : "Template already contains this location";
184 assert location.getAutomaton() == null || this.equals(location.getAutomaton()) : "Cannot add from other automata yet";193 assert location.getAutomaton() == null || this.equals(location.getAutomaton()) : "Cannot add from other automata yet";
185 if(location.getAutomaton() == null)194 if(location.getAutomaton() == null)
186 location.setAutomaton(this);195 location.setAutomaton(this);
196 this.id_locationMap.put(location.getUniqueIdString(), location);
187 this.locations.add(location);197 this.locations.add(location);
188 }198 }
189199
190200
=== modified file 'src/uppaal/Location.java'
--- src/uppaal/Location.java 2012-12-05 15:16:00 +0000
+++ src/uppaal/Location.java 2012-12-06 12:13:28 +0000
@@ -153,7 +153,8 @@
153 }153 }
154154
155 public String getUniqueIdString(){155 public String getUniqueIdString(){
156 return automaton.getName().getName()+id;156 return "id" + String.valueOf(id);
157 //return automaton.getName().getName() + id;
157 }158 }
158159
159 public Invariant getInvariant() {160 public Invariant getInvariant() {
160161
=== modified file 'src/uppaal/SystemDeclaration.java'
--- src/uppaal/SystemDeclaration.java 2012-08-09 13:03:06 +0000
+++ src/uppaal/SystemDeclaration.java 2012-12-06 12:13:28 +0000
@@ -36,6 +36,9 @@
36 public List<String> getDeclarations() {36 public List<String> getDeclarations() {
37 return this.declarations;37 return this.declarations;
38 }38 }
39 public void addSystemDeclaration(String string) {
40 this.addDeclaration(string);
41 }
39 @Override42 @Override
40 public String getXMLElementName() {43 public String getXMLElementName() {
41 return "system";44 return "system";
@@ -52,9 +55,9 @@
52 for(String decl : declarations)55 for(String decl : declarations)
53 sb.append(decl+"\n");56 sb.append(decl+"\n");
54 if(systemInstances.size()>0){57 if(systemInstances.size()>0){
55 sb.append("system ");58 sb.append("system \n\t");
56 for(int index=0;index<systemInstances.size();index++){59 for(int index=0;index<systemInstances.size();index++){
57 sb.append(systemInstances.get(index) + ((index+1)<systemInstances.size()?",":";"));60 sb.append(systemInstances.get(index) + ((index+1)<systemInstances.size()?",\n\t":";"));
58 }61 }
59 }62 }
60 Element result = super.generateXMLElement();63 Element result = super.generateXMLElement();
6164
=== modified file 'src/uppaal/Transition.java'
--- src/uppaal/Transition.java 2012-12-05 15:16:00 +0000
+++ src/uppaal/Transition.java 2012-12-06 12:13:28 +0000
@@ -111,13 +111,15 @@
111 boolean dbg_matchresult = matcher.find();111 boolean dbg_matchresult = matcher.find();
112 assert dbg_matchresult;112 assert dbg_matchresult;
113 113
114 source = automaton.id_locationMap.get(automaton.getName().getName() + matcher.group(1));114 //source = automaton.id_locationMap.get(automaton.getName().getName() + matcher.group(1));
115 source = automaton.id_locationMap.get("id" + matcher.group(1));
115 String targetString = transitionElement.getChild("target").getAttributeValue("ref");116 String targetString = transitionElement.getChild("target").getAttributeValue("ref");
116 matcher = locationIdRegExPattern.matcher(targetString);117 matcher = locationIdRegExPattern.matcher(targetString);
117 dbg_matchresult = matcher.find();118 dbg_matchresult = matcher.find();
118 assert dbg_matchresult;119 assert dbg_matchresult;
119 120
120 destination = automaton.id_locationMap.get(automaton.getName().getName() + matcher.group(1));121 //destination = automaton.id_locationMap.get(automaton.getName().getName() + matcher.group(1));
122 destination = automaton.id_locationMap.get("id" + matcher.group(1));
121123
122 @SuppressWarnings("unchecked")124 @SuppressWarnings("unchecked")
123 List<Element> children = transitionElement.getChildren();125 List<Element> children = transitionElement.getChildren();
@@ -162,8 +164,8 @@
162 return nails;164 return nails;
163 }165 }
164166
165 public void setNails(ArrayList<Nail> nails) {167 public void setNails(List<Nail> list) {
166 this.nails = nails;168 this.nails = list;
167 }169 }
168 170
169 public void addNail(Nail nail){171 public void addNail(Nail nail){
170172
=== modified file 'src/uppaal/UPPAALPrettyfy.java'
--- src/uppaal/UPPAALPrettyfy.java 2012-08-09 13:03:06 +0000
+++ src/uppaal/UPPAALPrettyfy.java 2012-12-06 12:13:28 +0000
@@ -28,6 +28,34 @@
28 List<Element> templates = rootElement.getChildren("template");28 List<Element> templates = rootElement.getChildren("template");
29 29
30 for(Element template : templates){30 for(Element template : templates){
31 List<Element> transitions = template.getChildren("transition");
32 for(Element transition : transitions) {
33 List<Element> labels = transition.getChildren("label");
34 for(Element label : labels) {
35 label.removeAttribute("x");
36 label.removeAttribute("y");
37 }
38 transition.removeChildren("nail");
39
40 }
41 List<Element> locations = template.getChildren("location");
42 for(Element location : locations) {
43 location.removeAttribute("x");
44 location.removeAttribute("y");
45
46 List<Element> labels = location.getChildren("label");
47 for(Element label : labels) {
48 label.removeAttribute("x");
49 label.removeAttribute("y");
50 }
51 List<Element> names = location.getChildren("name");
52 for(Element name : names) {
53 name.removeAttribute("x");
54 name.removeAttribute("y");
55 }
56 }
57
58
31 Graph graph = new Graph(template.getChildText("name"));59 Graph graph = new Graph(template.getChildText("name"));
32 60
33 graph = loadGraph( template, graph);61 graph = loadGraph( template, graph);
@@ -55,10 +83,10 @@
55 }83 }
56 }84 }
57 }85 }
58
59 return uppaalXml;86 return uppaalXml;
60
61 }87 }
88
89
62 private static File writeGraph(Element template, Graph graph) throws FileNotFoundException, IOException, InterruptedException {90 private static File writeGraph(Element template, Graph graph) throws FileNotFoundException, IOException, InterruptedException {
63 File folder = new File("/tmp/juppaal/");91 File folder = new File("/tmp/juppaal/");
64 folder.mkdirs();92 folder.mkdirs();

Subscribers

People subscribed via source and target branches

to all changes: