~yrke/tapaal/slimImageIcons-2

« back to all changes in this revision

Viewing changes to src/dk/aau/cs/io/PNMLWriter.java

  • Committer: Jiri Srba
  • Date: 2020-04-28 19:15:28 UTC
  • mfrom: (998.2.376 testbranch)
  • Revision ID: srba@cs.aau.dk-20200428191528-3xxjqa1r4jcob5ur
merged in lp:~yrke/tapaal/testbranch doing majour refactoring of the GUI

Show diffs side-by-side

added added

removed removed

Lines of Context:
129
129
 
130
130
        private void appendPlaces(Document document, DataLayer guiModel, Element NET) {
131
131
                Place[] places = guiModel.getPlaces();
132
 
                for (int i = 0; i < places.length; i++) {
133
 
                        NET.appendChild(createPlaceElement((TimedPlaceComponent) places[i], guiModel, document));
 
132
                for (Place place : places) {
 
133
                        NET.appendChild(createPlaceElement((TimedPlaceComponent) place, guiModel, document));
134
134
                }
135
135
        }
136
136
 
137
137
        private void appendTransitions(Document document, DataLayer guiModel, Element NET) {
138
138
                Transition[] transitions = guiModel.getTransitions();
139
 
                for (int i = 0; i < transitions.length; i++) {
140
 
                        NET.appendChild(createTransitionElement((TimedTransitionComponent)transitions[i],       document));
 
139
                for (Transition transition : transitions) {
 
140
                        NET.appendChild(createTransitionElement((TimedTransitionComponent) transition, document));
141
141
                }
142
142
        }
143
143
        
144
144
        private void appendArcs(Document document, DataLayer guiModel, Element NET) {
145
145
                Arc[] arcs = guiModel.getArcs();
146
 
                for (int i = 0; i < arcs.length; i++) {
147
 
                        NET.appendChild(createArcElement(arcs[i], guiModel, document));
 
146
                for (Arc arc : arcs) {
 
147
                        NET.appendChild(createArcElement(arc, guiModel, document));
148
148
                }
149
149
        }
150
150
 
228
228
                arcElement.setAttribute("source", (arc.getSource().getId() != null ? arc.getSource().getId() : ""));
229
229
                arcElement.setAttribute("target", (arc.getTarget().getId() != null ? arc.getTarget().getId() : ""));
230
230
                
231
 
                if (arc instanceof TimedOutputArcComponent && ((TimedOutputArcComponent)arc).getWeight().value() > 1 ) {
 
231
                if (arc instanceof TimedOutputArcComponent && arc.getWeight().value() > 1 ) {
232
232
                        Element inscription = document.createElement("inscription");
233
233
                        arcElement.appendChild(inscription);
234
234
                        Element text = document.createElement("text");
235
235
                        inscription.appendChild(text);
236
 
                        text.setTextContent(((TimedOutputArcComponent)arc).getWeight().nameForSaving(false)+"");
 
236
                        text.setTextContent(arc.getWeight().nameForSaving(false)+"");
237
237
                } 
238
238
                
239
239
                if(arc instanceof TimedInhibitorArcComponent){