PGMLStackParser.java

1
/* $Id: PGMLStackParser.java 19907 2012-12-30 13:06:01Z closettop_nightlybuild $
2
 *****************************************************************************
3
 * Copyright (c) 2009-2012 Contributors - see below
4
 * All rights reserved. This program and the accompanying materials
5
 * are made available under the terms of the Eclipse Public License v1.0
6
 * which accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 *
9
 * Contributors:
10
 *    Michiel Van Der Wulp
11
 *    Bob Tarling
12
 *    Thomas Neustupny
13
 *****************************************************************************
14
 *
15
 * Some portions of this file was previously release using the BSD License:
16
 */
17
// Copyright (c) 2005-2009 The Regents of the University of California. All
18
// Rights Reserved. Permission to use, copy, modify, and distribute this
19
// software and its documentation without fee, and without a written
20
// agreement is hereby granted, provided that the above copyright notice
21
// and this paragraph appear in all copies.  This software program and
22
// documentation are copyrighted by The Regents of the University of
23
// California. The software program and documentation are supplied "AS
24
// IS", without any accompanying services from The Regents. The Regents
25
// does not warrant that the operation of the program will be
26
// uninterrupted or error-free. The end-user understands that the program
27
// was developed for research purposes and is advised not to rely
28
// exclusively on the program for any reason.  IN NO EVENT SHALL THE
29
// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
30
// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
31
// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
32
// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
33
// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
34
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
35
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
36
// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
37
// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
38
// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
39
40
package org.argouml.persistence;
41
42
import java.awt.Rectangle;
43
import java.io.InputStream;
44
import java.lang.reflect.Constructor;
45
import java.lang.reflect.InvocationTargetException;
46
import java.net.URL;
47
import java.util.ArrayList;
48
import java.util.HashMap;
49
import java.util.LinkedHashMap;
50
import java.util.List;
51
import java.util.Map;
52
import java.util.StringTokenizer;
53
import java.util.logging.Level;
54
import java.util.logging.Logger;
55
56
import org.argouml.model.Model;
57
import org.argouml.uml.diagram.ArgoDiagram;
58
import org.argouml.uml.diagram.DiagramEdgeSettings;
59
import org.argouml.uml.diagram.DiagramSettings;
60
import org.argouml.uml.diagram.PathContainer;
61
import org.argouml.uml.diagram.StereotypeContainer;
62
import org.argouml.uml.diagram.VisibilityContainer;
63
import org.argouml.uml.diagram.ui.FigCompartmentBox;
64
import org.argouml.uml.diagram.ui.FigEdgeModelElement;
65
import org.argouml.uml.diagram.ui.FigEdgePort;
66
import org.tigris.gef.base.Diagram;
67
import org.tigris.gef.persistence.pgml.Container;
68
import org.tigris.gef.persistence.pgml.FigEdgeHandler;
69
import org.tigris.gef.persistence.pgml.FigGroupHandler;
70
import org.tigris.gef.persistence.pgml.HandlerStack;
71
import org.tigris.gef.presentation.Fig;
72
import org.tigris.gef.presentation.FigEdge;
73
import org.tigris.gef.presentation.FigGroup;
74
import org.tigris.gef.presentation.FigNode;
75
import org.xml.sax.Attributes;
76
import org.xml.sax.InputSource;
77
import org.xml.sax.SAXException;
78
import org.xml.sax.helpers.DefaultHandler;
79
80
// TODO: Move to Diagram subsystem?
81
82
/**
83
 * The PGML Parser.
84
 * <p>
85
 *
86
 * This replaces much of the identically named class from GEF.
87
 */
88
class PGMLStackParser extends org.tigris.gef.persistence.pgml.PGMLStackParser {
89
90
    private static final Logger LOG =
91
        Logger.getLogger(PGMLStackParser.class.getName());
92
93
    private List<EdgeData> figEdges = new ArrayList<EdgeData>(50);
94
95
    private LinkedHashMap<FigEdge, Object> modelElementsByFigEdge =
96
        new LinkedHashMap<FigEdge, Object>(50);
97
98
    private DiagramSettings diagramSettings;
99
100
    // TODO: Use stylesheet to convert or wait till we use Fig
101
    // factories in diagram subsystem.
102
    // What is the last version that used FigNote?
103
    private void addTranslations() {
104 1 1. addTranslations : removed call to org/argouml/persistence/PGMLStackParser::addTranslation → NO_COVERAGE
        addTranslation("org.argouml.uml.diagram.ui.FigNote",
105
                "org.argouml.uml.diagram.static_structure.ui.FigComment");
106 1 1. addTranslations : removed call to org/argouml/persistence/PGMLStackParser::addTranslation → NO_COVERAGE
        addTranslation("org.argouml.uml.diagram.static_structure.ui.FigNote",
107
                "org.argouml.uml.diagram.static_structure.ui.FigComment");
108 1 1. addTranslations : removed call to org/argouml/persistence/PGMLStackParser::addTranslation → NO_COVERAGE
        addTranslation("org.argouml.uml.diagram.state.ui.FigState",
109
                "org.argouml.uml.diagram.state.ui.FigSimpleState");
110 1 1. addTranslations : removed call to org/argouml/persistence/PGMLStackParser::addTranslation → NO_COVERAGE
        addTranslation("org.argouml.uml.diagram.ui.FigCommentPort",
111
                "org.argouml.uml.diagram.ui.FigEdgePort");
112 1 1. addTranslations : removed call to org/argouml/persistence/PGMLStackParser::addTranslation → NO_COVERAGE
        addTranslation("org.tigris.gef.presentation.FigText",
113
                "org.argouml.uml.diagram.ui.ArgoFigText");
114 1 1. addTranslations : removed call to org/argouml/persistence/PGMLStackParser::addTranslation → NO_COVERAGE
        addTranslation("org.tigris.gef.presentation.FigLine",
115
                "org.argouml.gefext.ArgoFigLine");
116 1 1. addTranslations : removed call to org/argouml/persistence/PGMLStackParser::addTranslation → NO_COVERAGE
        addTranslation("org.tigris.gef.presentation.FigPoly",
117
                "org.argouml.gefext.ArgoFigPoly");
118 1 1. addTranslations : removed call to org/argouml/persistence/PGMLStackParser::addTranslation → NO_COVERAGE
        addTranslation("org.tigris.gef.presentation.FigCircle",
119
                "org.argouml.gefext.ArgoFigCircle");
120 1 1. addTranslations : removed call to org/argouml/persistence/PGMLStackParser::addTranslation → NO_COVERAGE
        addTranslation("org.tigris.gef.presentation.FigRect",
121
                "org.argouml.gefext.ArgoFigRect");
122 1 1. addTranslations : removed call to org/argouml/persistence/PGMLStackParser::addTranslation → NO_COVERAGE
        addTranslation("org.tigris.gef.presentation.FigRRect",
123
                "org.argouml.gefext.ArgoFigRRect");
124 1 1. addTranslations : removed call to org/argouml/persistence/PGMLStackParser::addTranslation → NO_COVERAGE
        addTranslation(
125
                "org.argouml.uml.diagram.deployment.ui.FigMNodeInstance",
126
                "org.argouml.uml.diagram.deployment.ui.FigNodeInstance");
127 1 1. addTranslations : removed call to org/argouml/persistence/PGMLStackParser::addTranslation → NO_COVERAGE
        addTranslation("org.argouml.uml.diagram.ui.FigRealization",
128
                "org.argouml.uml.diagram.ui.FigAbstraction");
129
    }
130
131
    /**
132
     * Construct a PGML parser with the given HREF/Object map and default
133
     * diagram settings.
134
     *
135
     * @param modelElementsByUuid map of HREF ids to objects used to associate
136
     *            Figs with their owning model elements
137
     * @param defaultSettings default diagram settings to use for newly created
138
     *            diagram and its contained Figs
139
     */
140
    public PGMLStackParser(Map<String, Object> modelElementsByUuid,
141
            DiagramSettings defaultSettings) {
142
        super(modelElementsByUuid);
143 1 1. : removed call to org/argouml/persistence/PGMLStackParser::addTranslations → NO_COVERAGE
        addTranslations();
144
        // Create a new diagram wide settings block which is backed by
145
        // the project-wide defaults that we were passed
146
        diagramSettings = new DiagramSettings(defaultSettings);
147
    }
148
149
    /*
150
     * @see org.tigris.gef.persistence.pgml.HandlerFactory#getHandler(
151
     * HandlerStack, Object, String, String, String, Attributes)
152
     */
153
    @Override
154
    public DefaultHandler getHandler(HandlerStack stack, Object container,
155
            String uri, String localname, String qname, Attributes attributes)
156
        throws SAXException {
157
158
        String href = attributes.getValue("href");
159
        Object owner = null;
160
161 1 1. getHandler : negated conditional → NO_COVERAGE
        if (href != null) {
162
            owner = findOwner(href);
163 1 1. getHandler : negated conditional → NO_COVERAGE
            if (owner == null) {
164
                LOG.log(Level.WARNING, "Found href of " + href
165
                        + " with no matching element in model");
166 1 1. getHandler : mutated return of Object value for org/argouml/persistence/PGMLStackParser::getHandler to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
                return null;
167
            }
168
        }
169
170
        // Ignore non-private elements within FigNode groups
171 1 1. getHandler : negated conditional → NO_COVERAGE
        if (container instanceof FigGroupHandler) {
172
            FigGroup group = ((FigGroupHandler) container).getFigGroup();
173 2 1. getHandler : negated conditional → NO_COVERAGE
2. getHandler : negated conditional → NO_COVERAGE
            if (group instanceof FigNode && !qname.equals("private")) {
174 1 1. getHandler : mutated return of Object value for org/argouml/persistence/PGMLStackParser::getHandler to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
                return null;
175
            }
176
        }
177
178
        // Handle ItemUID in container contents
179 2 1. getHandler : negated conditional → NO_COVERAGE
2. getHandler : negated conditional → NO_COVERAGE
        if (qname.equals("private") && (container instanceof Container)) {
180 1 1. getHandler : mutated return of Object value for org/argouml/persistence/PGMLStackParser::getHandler to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
            return new PrivateHandler(this, (Container) container);
181
        }
182
183
        DefaultHandler handler = super.getHandler(stack, container, uri,
184
                localname, qname, attributes);
185
186 1 1. getHandler : negated conditional → NO_COVERAGE
        if (handler instanceof FigEdgeHandler) {
187 1 1. getHandler : mutated return of Object value for org/argouml/persistence/PGMLStackParser::getHandler to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
            return new org.argouml.persistence.FigEdgeHandler(this,
188
                    ((FigEdgeHandler) handler).getFigEdge());
189
        }
190
191 1 1. getHandler : mutated return of Object value for org/argouml/persistence/PGMLStackParser::getHandler to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return handler;
192
193
    }
194
195
    /*
196
     * @see org.tigris.gef.persistence.pgml.PGMLStackParser#setAttrs(
197
     * org.tigris.gef.presentation.Fig, org.xml.sax.Attributes)
198
     */
199
    @Override
200
    protected final void setAttrs(Fig f, Attributes attrList)
201
        throws SAXException {
202
203 1 1. setAttrs : negated conditional → NO_COVERAGE
        if (f instanceof FigGroup) {
204
            FigGroup group = (FigGroup) f;
205
            String clsNameBounds = attrList.getValue("description");
206 1 1. setAttrs : negated conditional → NO_COVERAGE
            if (clsNameBounds != null) {
207
                StringTokenizer st =
208
                    new StringTokenizer(clsNameBounds, ",;[] ");
209
                // Discard class name, x y w h
210 1 1. setAttrs : negated conditional → NO_COVERAGE
                if (st.hasMoreElements()) {
211
                    st.nextToken();
212
                }
213 1 1. setAttrs : negated conditional → NO_COVERAGE
                if (st.hasMoreElements()) {
214
                    st.nextToken();
215
                }
216 1 1. setAttrs : negated conditional → NO_COVERAGE
                if (st.hasMoreElements()) {
217
                    st.nextToken();
218
                }
219 1 1. setAttrs : negated conditional → NO_COVERAGE
                if (st.hasMoreElements()) {
220
                    st.nextToken();
221
                }
222 1 1. setAttrs : negated conditional → NO_COVERAGE
                if (st.hasMoreElements()) {
223
                    st.nextToken();
224
                }
225
226
                Map<String, String> attributeMap = interpretStyle(st);
227 1 1. setAttrs : removed call to org/argouml/persistence/PGMLStackParser::setStyleAttributes → NO_COVERAGE
                setStyleAttributes(group, attributeMap);
228
            }
229
        }
230
231
        // TODO: Attempt to move the following code to GEF
232
233
        String name = attrList.getValue("name");
234 2 1. setAttrs : negated conditional → NO_COVERAGE
2. setAttrs : negated conditional → NO_COVERAGE
        if (name != null && !name.equals("")) {
235 1 1. setAttrs : removed call to org/argouml/persistence/PGMLStackParser::registerFig → NO_COVERAGE
            registerFig(f, name);
236
        }
237
238 1 1. setAttrs : removed call to org/argouml/persistence/PGMLStackParser::setCommonAttrs → NO_COVERAGE
        setCommonAttrs(f, attrList);
239
240
        final String href = attrList.getValue("href");
241 2 1. setAttrs : negated conditional → NO_COVERAGE
2. setAttrs : negated conditional → NO_COVERAGE
        if (href != null && !href.equals("")) {
242
            Object modelElement = findOwner(href);
243 1 1. setAttrs : negated conditional → NO_COVERAGE
            if (modelElement == null) {
244
                LOG.log(Level.SEVERE, "Can't find href of " + href);
245
                throw new SAXException("Found href of " + href
246
                        + " with no matching element in model");
247
            }
248
            // The owner should always have already been set in the constructor
249 1 1. setAttrs : negated conditional → NO_COVERAGE
            if (f.getOwner() != modelElement) {
250
                // Assign nodes immediately but edges later. See issue 4310.
251 1 1. setAttrs : negated conditional → NO_COVERAGE
                if (f instanceof FigEdge) {
252
                    modelElementsByFigEdge.put((FigEdge) f, modelElement);
253
                } else {
254 1 1. setAttrs : removed call to org/tigris/gef/presentation/Fig::setOwner → NO_COVERAGE
                    f.setOwner(modelElement);
255
                }
256
            } else {
257
                LOG.log(Level.FINE,
258
                        "Ignoring href on {0} as it's already set",
259
                        f.getClass().getName());
260
            }
261
        }
262
    }
263
264
    /**
265
     * The StringTokenizer is expected to be positioned at the start of a string
266
     * of style identifiers in the format name=value;name=value;name=value....
267
     * Each name value pair is interpreted and the Fig configured accordingly.
268
     * The value is optional and will default to a value applicable for its
269
     * name. The current applicable names are operationsVisible and
270
     * attributesVisible and are used to show or hide the compartments within
271
     * Class and Interface. The default values are true.
272
     *
273
     * @param st The StrinkTokenizer positioned at the first style identifier
274
     * @return a map of attributes
275
     */
276
    private Map<String, String> interpretStyle(StringTokenizer st) {
277
        Map<String, String> map = new HashMap<String, String>();
278
        String name;
279
        String value;
280
281 1 1. interpretStyle : negated conditional → NO_COVERAGE
        while (st.hasMoreElements()) {
282
            String namevaluepair = st.nextToken();
283
            int equalsPos = namevaluepair.indexOf('=');
284 2 1. interpretStyle : changed conditional boundary → NO_COVERAGE
2. interpretStyle : negated conditional → NO_COVERAGE
            if (equalsPos < 0) {
285
                name = namevaluepair;
286
                value = "true";
287
            } else {
288
                name = namevaluepair.substring(0, equalsPos);
289 1 1. interpretStyle : Replaced integer addition with subtraction → NO_COVERAGE
                value = namevaluepair.substring(equalsPos + 1);
290
            }
291
292
            map.put(name, value);
293
        }
294 1 1. interpretStyle : mutated return of Object value for org/argouml/persistence/PGMLStackParser::interpretStyle to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return map;
295
    }
296
297
    /**
298
     * Set the fig style attributes.
299
     * <p>
300
     *
301
     * TODO: This should move into the render factories as described in issue
302
     * 859.
303
     *
304
     * @param fig the fig to style.
305
     * @param attributeMap a map of name value pairs
306
     */
307
    private void setStyleAttributes(Fig fig, Map<String, String> attributeMap) {
308
309 1 1. setStyleAttributes : negated conditional → NO_COVERAGE
        for (Map.Entry<String, String> entry : attributeMap.entrySet()) {
310
            final String name = entry.getKey();
311
            final String value = entry.getValue();
312
313 1 1. setStyleAttributes : negated conditional → NO_COVERAGE
            if (fig instanceof FigCompartmentBox) {
314
                FigCompartmentBox fcb = (FigCompartmentBox) fig;
315 1 1. setStyleAttributes : negated conditional → NO_COVERAGE
                if ("operationsVisible".equals(name)) {
316 1 1. setStyleAttributes : removed call to org/argouml/uml/diagram/ui/FigCompartmentBox::showCompartment → NO_COVERAGE
                    fcb.showCompartment(Model.getMetaTypes().getOperation(),
317
                            value.equalsIgnoreCase("true"));
318 1 1. setStyleAttributes : negated conditional → NO_COVERAGE
                } else if ("attributesVisible".equals(name)) {
319 1 1. setStyleAttributes : removed call to org/argouml/uml/diagram/ui/FigCompartmentBox::showCompartment → NO_COVERAGE
                    fcb.showCompartment(Model.getMetaTypes().getAttribute(),
320
                            value.equalsIgnoreCase("true"));
321 1 1. setStyleAttributes : negated conditional → NO_COVERAGE
                } else if ("enumerationLiteralsVisible".equals(name)) {
322 1 1. setStyleAttributes : removed call to org/argouml/uml/diagram/ui/FigCompartmentBox::showCompartment → NO_COVERAGE
                    fcb.showCompartment(Model.getMetaTypes()
323
                            .getEnumerationLiteral(), value
324
                            .equalsIgnoreCase("true"));
325 1 1. setStyleAttributes : negated conditional → NO_COVERAGE
                } else if ("extensionPointVisible".equals(name)) {
326 1 1. setStyleAttributes : removed call to org/argouml/uml/diagram/ui/FigCompartmentBox::showCompartment → NO_COVERAGE
                    fcb.showCompartment(Model.getMetaTypes()
327
                            .getExtensionPoint(), value
328
                            .equalsIgnoreCase("true"));
329
                }
330
            }
331 1 1. setStyleAttributes : negated conditional → NO_COVERAGE
            if ("stereotypeVisible".equals(name)) {
332 1 1. setStyleAttributes : removed call to org/argouml/uml/diagram/StereotypeContainer::setStereotypeVisible → NO_COVERAGE
                ((StereotypeContainer) fig).setStereotypeVisible(value
333
                        .equalsIgnoreCase("true"));
334 1 1. setStyleAttributes : negated conditional → NO_COVERAGE
            } else if ("visibilityVisible".equals(name)) {
335 1 1. setStyleAttributes : removed call to org/argouml/uml/diagram/VisibilityContainer::setVisibilityVisible → NO_COVERAGE
                ((VisibilityContainer) fig).setVisibilityVisible(value
336
                        .equalsIgnoreCase("true"));
337 1 1. setStyleAttributes : negated conditional → NO_COVERAGE
            } else if ("pathVisible".equals(name)) {
338 1 1. setStyleAttributes : removed call to org/argouml/uml/diagram/PathContainer::setPathVisible → NO_COVERAGE
                ((PathContainer) fig).setPathVisible(value
339
                        .equalsIgnoreCase("true"));
340
            }
341
        }
342
    }
343
344
    /**
345
     * Read and parse the input stream to create a new diagram and return it.
346
     *
347
     * @param is the input stream
348
     * @param closeStream true to close the stream when parsing is complete
349
     * @return the diagram created as a result of the parse
350
     * @throws SAXException
351
     */
352
    public ArgoDiagram readArgoDiagram(InputSource is, boolean closeStream)
353
        throws SAXException {
354
355
        InputStream stream = is.getByteStream();
356 1 1. readArgoDiagram : negated conditional → NO_COVERAGE
        if (stream == null) {
357
            try {
358
                // happens when 'is' comes from a zip file
359
                URL url = new URL(is.getSystemId());
360
                stream = url.openStream();
361
                closeStream = true;
362
            } catch (Exception e) {
363
                // continue with null stream, readDiagram(...) will take care of
364
                // it
365
            }
366
        }
367 1 1. readArgoDiagram : mutated return of Object value for org/argouml/persistence/PGMLStackParser::readArgoDiagram to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return (ArgoDiagram) readDiagram(stream, closeStream);
368
    }
369
370
    /**
371
     * Read and parse the input stream to create a new diagram and return it.
372
     *
373
     * @param is the input stream
374
     * @param closeStream true to close the stream when parsing is complete
375
     * @return the diagram created as a result of the parse
376
     * @throws SAXException
377
     */
378
    public ArgoDiagram readArgoDiagram(InputStream is, boolean closeStream)
379
        throws SAXException {
380
381 1 1. readArgoDiagram : mutated return of Object value for org/argouml/persistence/PGMLStackParser::readArgoDiagram to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return (ArgoDiagram) readDiagram(is, closeStream);
382
    }
383
384
    @Override
385
    public Diagram readDiagram(InputStream is, boolean closeStream)
386
        throws SAXException {
387
388
        // TODO: we really want to be able replace the initial content handler
389
        // which is passed to SAX, but we can't do this without cloning a
390
        // whole bunch of code because it's private in the super class.
391
392
        Diagram d = super.readDiagram(is, closeStream);
393
394 1 1. readDiagram : removed call to org/argouml/persistence/PGMLStackParser::attachEdges → NO_COVERAGE
        attachEdges(d);
395
396 1 1. readDiagram : mutated return of Object value for org/argouml/persistence/PGMLStackParser::readDiagram to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return d;
397
    }
398
399
    /**
400
     * This is called when all nodes and edges have been read and placed on the
401
     * diagram. This method then attaches the edges to the correct node,
402
     * including the nodes contained within edges allowing edge to edge
403
     * connections for comment edges, association classes and dependencies.
404
     *
405
     * @param d the Diagram
406
     */
407
    private void attachEdges(Diagram d) {
408 1 1. attachEdges : negated conditional → NO_COVERAGE
        for (EdgeData edgeData : figEdges) {
409
            final FigEdge edge = edgeData.getFigEdge();
410
411
            Object modelElement = modelElementsByFigEdge.get(edge);
412 1 1. attachEdges : negated conditional → NO_COVERAGE
            if (modelElement != null) {
413 1 1. attachEdges : negated conditional → NO_COVERAGE
                if (edge.getOwner() == null) {
414 1 1. attachEdges : removed call to org/tigris/gef/presentation/FigEdge::setOwner → NO_COVERAGE
                    edge.setOwner(modelElement);
415
                }
416
            }
417
        }
418
419 1 1. attachEdges : negated conditional → NO_COVERAGE
        for (EdgeData edgeData : figEdges) {
420
            final FigEdge edge = edgeData.getFigEdge();
421
422
            Fig sourcePortFig = findFig(edgeData.getSourcePortFigId());
423
            Fig destPortFig = findFig(edgeData.getDestPortFigId());
424
            final FigNode sourceFigNode = getFigNode(edgeData
425
                    .getSourceFigNodeId());
426
            final FigNode destFigNode = getFigNode(edgeData.getDestFigNodeId());
427
428 1 1. attachEdges : negated conditional → NO_COVERAGE
            if (sourceFigNode instanceof FigEdgePort) {
429
                sourcePortFig = sourceFigNode;
430
            }
431
432 1 1. attachEdges : negated conditional → NO_COVERAGE
            if (destFigNode instanceof FigEdgePort) {
433
                destPortFig = destFigNode;
434
            }
435
436 2 1. attachEdges : negated conditional → NO_COVERAGE
2. attachEdges : negated conditional → NO_COVERAGE
            if (sourcePortFig == null && sourceFigNode != null) {
437
                sourcePortFig = getPortFig(sourceFigNode);
438
            }
439
440 2 1. attachEdges : negated conditional → NO_COVERAGE
2. attachEdges : negated conditional → NO_COVERAGE
            if (destPortFig == null && destFigNode != null) {
441
                destPortFig = getPortFig(destFigNode);
442
            }
443
444 2 1. attachEdges : negated conditional → NO_COVERAGE
2. attachEdges : negated conditional → NO_COVERAGE
            if (sourcePortFig == null || destPortFig == null
445 2 1. attachEdges : negated conditional → NO_COVERAGE
2. attachEdges : negated conditional → NO_COVERAGE
                    || sourceFigNode == null || destFigNode == null) {
446
                LOG.log(Level.SEVERE,
447
                        "Can't find nodes for FigEdge: " + edge.getId() + ":"
448
                        + edge.toString());
449 1 1. attachEdges : removed call to org/tigris/gef/presentation/FigEdge::removeFromDiagram → NO_COVERAGE
                edge.removeFromDiagram();
450
            } else {
451 1 1. attachEdges : removed call to org/tigris/gef/presentation/FigEdge::setSourcePortFig → NO_COVERAGE
                edge.setSourcePortFig(sourcePortFig);
452 1 1. attachEdges : removed call to org/tigris/gef/presentation/FigEdge::setDestPortFig → NO_COVERAGE
                edge.setDestPortFig(destPortFig);
453 1 1. attachEdges : removed call to org/tigris/gef/presentation/FigEdge::setSourceFigNode → NO_COVERAGE
                edge.setSourceFigNode(sourceFigNode);
454 1 1. attachEdges : removed call to org/tigris/gef/presentation/FigEdge::setDestFigNode → NO_COVERAGE
                edge.setDestFigNode(destFigNode);
455
            }
456
        }
457
458
        // Once all edges are connected do a compute route on each to make
459
        // sure that annotations and the edge port is positioned correctly
460
        // Only do this after all edges are connected as compute route
461
        // requires all edges to be connected to nodes.
462
        // TODO: It would be nice not to have to do this and restore annotation
463
        // positions instead.
464 1 1. attachEdges : negated conditional → NO_COVERAGE
        for (Object edge : d.getLayer().getContentsEdgesOnly()) {
465
            FigEdge figEdge = (FigEdge) edge;
466 1 1. attachEdges : removed call to org/tigris/gef/presentation/FigEdge::computeRouteImpl → NO_COVERAGE
            figEdge.computeRouteImpl();
467
        }
468
    }
469
470
    // TODO: Move to GEF
471
    /**
472
     * Store data of a FigEdge together with the id's of nodes to connect to
473
     *
474
     * @param figEdge The FigEdge
475
     * @param sourcePortFigId The id of the source port
476
     * @param destPortFigId The id of the destination port
477
     * @param sourceFigNodeId The id of the source node
478
     * @param destFigNodeId The id of the destination node
479
     */
480
    public void addFigEdge(final FigEdge figEdge, final String sourcePortFigId,
481
            final String destPortFigId, final String sourceFigNodeId,
482
            final String destFigNodeId) {
483
        figEdges.add(new EdgeData(figEdge, sourcePortFigId, destPortFigId,
484
                sourceFigNodeId, destFigNodeId));
485
    }
486
487
    // TODO: Move to GEF
488
    /**
489
     * Get the FigNode that the fig id represents.
490
     *
491
     * @param figId (In the form Figx.y.z)
492
     * @return the FigNode with the given id
493
     * @throws IllegalStateException if the figId supplied is not of a FigNode
494
     */
495
    private FigNode getFigNode(String figId) throws IllegalStateException {
496 1 1. getFigNode : negated conditional → NO_COVERAGE
        if (figId.contains(".")) {
497
            // If the id does not look like a top-level Fig then we can assume
498
            // that this is an id of a FigEdgePort inside some FigEdge.
499
            // So extract the FigEdgePort from the FigEdge and return that as
500
            // the FigNode.
501
            figId = figId.substring(0, figId.indexOf('.'));
502
            FigEdgeModelElement edge = (FigEdgeModelElement) findFig(figId);
503 1 1. getFigNode : negated conditional → NO_COVERAGE
            if (edge == null) {
504
                throw new IllegalStateException("Can't find a FigNode with id "
505
                        + figId);
506
            }
507 1 1. getFigNode : removed call to org/argouml/uml/diagram/ui/FigEdgeModelElement::makeEdgePort → NO_COVERAGE
            edge.makeEdgePort();
508 1 1. getFigNode : mutated return of Object value for org/argouml/persistence/PGMLStackParser::getFigNode to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
            return edge.getEdgePort();
509
        } else {
510
            // If there is no dot then this must be a top level Fig and can be
511
            // assumed to be a FigNode.
512
            Fig f = findFig(figId);
513 1 1. getFigNode : negated conditional → NO_COVERAGE
            if (f instanceof FigNode) {
514 1 1. getFigNode : mutated return of Object value for org/argouml/persistence/PGMLStackParser::getFigNode to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
                return (FigNode) f;
515
            } else {
516
                LOG.log(Level.SEVERE,
517
                        "FigID " + figId + " is not a node, edge ignored");
518 1 1. getFigNode : mutated return of Object value for org/argouml/persistence/PGMLStackParser::getFigNode to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
                return null;
519
            }
520
        }
521
    }
522
523
    // TODO: Move to GEF
524
    /**
525
     * Get the Fig from the FigNode that is the port.
526
     *
527
     * @param figNode the FigNode
528
     * @return the Fig that is the port on the given FigNode
529
     */
530
    private Fig getPortFig(FigNode figNode) {
531 1 1. getPortFig : negated conditional → NO_COVERAGE
        if (figNode instanceof FigEdgePort) {
532
            // TODO: Can we just do this every time, no need for else - Bob
533 1 1. getPortFig : mutated return of Object value for org/argouml/persistence/PGMLStackParser::getPortFig to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
            return figNode;
534
        } else {
535 1 1. getPortFig : mutated return of Object value for org/argouml/persistence/PGMLStackParser::getPortFig to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
            return (Fig) figNode.getPortFigs().get(0);
536
        }
537
    }
538
539
    // TODO: Move to GEF
540
541
    /**
542
     * The data from an edge extracted from the PGML before we can guarantee all
543
     * the nodes have been constructed. This stores the FigEdge and the id's of
544
     * the nodes to connect to later. If the nodes are not known then the ports
545
     * are returned instead.
546
     */
547
    private class EdgeData {
548
        private final FigEdge figEdge;
549
550
        private final String sourcePortFigId;
551
552
        private final String destPortFigId;
553
554
        private final String sourceFigNodeId;
555
556
        private final String destFigNodeId;
557
558
        /**
559
         * Constructor
560
         *
561
         * @param edge The FigEdge
562
         * @param sourcePortId The id of the source port
563
         * @param destPortId The id of the destination port
564
         * @param sourceNodeId The id of the source node
565
         * @param destNodeId The id of the destination node
566
         */
567
        public EdgeData(FigEdge edge, String sourcePortId, String destPortId,
568
                String sourceNodeId, String destNodeId) {
569 2 1. : negated conditional → NO_COVERAGE
2. : negated conditional → NO_COVERAGE
            if (sourcePortId == null || destPortId == null) {
570
                throw new IllegalArgumentException(
571
                        "source port and dest port must not be null"
572
                                + " source = " + sourcePortId + " dest = "
573
                                + destPortId + " figEdge = " + edge);
574
            }
575
            this.figEdge = edge;
576
            this.sourcePortFigId = sourcePortId;
577
            this.destPortFigId = destPortId;
578 1 1. : negated conditional → NO_COVERAGE
            this.sourceFigNodeId = sourceNodeId != null ? sourceNodeId
579
                    : sourcePortId;
580 1 1. : negated conditional → NO_COVERAGE
            this.destFigNodeId = destNodeId != null ? destNodeId : destPortId;
581
        }
582
583
        /**
584
         * Get the id of the destination FigNode
585
         *
586
         * @return the id
587
         */
588
        public String getDestFigNodeId() {
589 1 1. getDestFigNodeId : mutated return of Object value for org/argouml/persistence/PGMLStackParser$EdgeData::getDestFigNodeId to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
            return destFigNodeId;
590
        }
591
592
        /**
593
         * Get the id of the destination port
594
         *
595
         * @return the id
596
         */
597
        public String getDestPortFigId() {
598 1 1. getDestPortFigId : mutated return of Object value for org/argouml/persistence/PGMLStackParser$EdgeData::getDestPortFigId to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
            return destPortFigId;
599
        }
600
601
        /**
602
         * Get the FigEdge
603
         *
604
         * @return the FigEdge
605
         */
606
        public FigEdge getFigEdge() {
607 1 1. getFigEdge : mutated return of Object value for org/argouml/persistence/PGMLStackParser$EdgeData::getFigEdge to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
            return figEdge;
608
        }
609
610
        /**
611
         * Get the id of the source FigNode
612
         *
613
         * @return the id
614
         */
615
        public String getSourceFigNodeId() {
616 1 1. getSourceFigNodeId : mutated return of Object value for org/argouml/persistence/PGMLStackParser$EdgeData::getSourceFigNodeId to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
            return sourceFigNodeId;
617
        }
618
619
        /**
620
         * Get the id of the source port
621
         *
622
         * @return the id
623
         */
624
        public String getSourcePortFigId() {
625 1 1. getSourcePortFigId : mutated return of Object value for org/argouml/persistence/PGMLStackParser$EdgeData::getSourcePortFigId to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
            return sourcePortFigId;
626
        }
627
    }
628
629
    /**
630
     * Construct a new instance of the named Fig with the owner represented by
631
     * the given href and the bounds parsed from the PGML file. We look for
632
     * constructors of the form Fig(Object owner, Rectangle bounds,
633
     * DiagramSettings settings) which is typically used for subclasses of
634
     * FigNodeModelElement, then Fig(Object owner, DiagramSettings settings)
635
     * which is used for subclasses of FigEdgeModelElement.
636
     * <p>
637
     * If we fail to find any of the constructors that we know about, we'll call
638
     * GEF's version of this method to see if it can find a constructor.
639
     *
640
     * @param className fully qualified name of class to instantiate
641
     * @param href string representing UUID of owning element
642
     * @param bounds position and size of figure
643
     * @return
644
     * @throws SAXException
645
     * @see org.tigris.gef.persistence.pgml.PGMLStackParser#constructFig(java.lang.String,
646
     *      java.lang.String, java.awt.Rectangle)
647
     */
648
    @Override
649
    protected Fig constructFig(final String className, final String href,
650
            final Rectangle bounds, final Attributes attributes)
651
        throws SAXException {
652
653
        final DiagramSettings oldSettings =
654
            ((ArgoDiagram) getDiagram()).getDiagramSettings();
655
656
        Fig f = null;
657
        try {
658
            Class figClass = Class.forName(className);
659
660
            final Constructor[] constructors = figClass.getConstructors();
661
662
            // We are looking first to match with 3 different constructor
663
            // types. We would not expect a Fig to have any mix of these.
664
            // Any constructor other than these should be deprecated so we
665
            // look for these first.
666
            // Fig(DiagramEdgeSettings, DiagramSettings)
667
            // Fig(Object, Rectangle, DiagramSettings)
668
            // Fig(Rectangle, DiagramSettings)
669 3 1. constructFig : changed conditional boundary → NO_COVERAGE
2. constructFig : Changed increment from 1 to -1 → NO_COVERAGE
3. constructFig : negated conditional → NO_COVERAGE
            for (Constructor constructor : constructors) {
670
                Class[] parameterTypes = constructor.getParameterTypes();
671 1 1. constructFig : negated conditional → NO_COVERAGE
                if (parameterTypes.length == 3
672 1 1. constructFig : negated conditional → NO_COVERAGE
                        && parameterTypes[0].equals(Object.class)
673 1 1. constructFig : negated conditional → NO_COVERAGE
                        && parameterTypes[1].equals(Rectangle.class)
674 1 1. constructFig : negated conditional → NO_COVERAGE
                        && parameterTypes[2].equals(DiagramSettings.class)) {
675
                    // FigNodeModelElements should match here
676
                    final Object parameters[] = new Object[3];
677
                    final Object owner = getOwner(className, href);
678 1 1. constructFig : negated conditional → NO_COVERAGE
                    if (owner == null) {
679 1 1. constructFig : mutated return of Object value for org/argouml/persistence/PGMLStackParser::constructFig to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
                        return null;
680
                    }
681
                    parameters[0] = owner;
682
                    parameters[1] = bounds;
683
                    parameters[2] = oldSettings;
684
685 1 1. constructFig : removed call to java/lang/reflect/Constructor::setAccessible → NO_COVERAGE
                    constructor.setAccessible(true);
686
                    f = (Fig) constructor.newInstance(parameters);
687 1 1. constructFig : negated conditional → NO_COVERAGE
                } else if (parameterTypes.length == 2
688 1 1. constructFig : negated conditional → NO_COVERAGE
                        && parameterTypes[0].equals(DiagramEdgeSettings.class)
689 1 1. constructFig : negated conditional → NO_COVERAGE
                        && parameterTypes[1].equals(DiagramSettings.class)) {
690
                    // FigEdgeModelElements should match here (they have no
691
                    // bounds)
692
                    final Object parameters[] = new Object[2];
693
                    final Object owner = getOwner(className, href);
694 1 1. constructFig : negated conditional → NO_COVERAGE
                    if (owner == null) {
695 1 1. constructFig : mutated return of Object value for org/argouml/persistence/PGMLStackParser::constructFig to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
                        return null;
696
                    }
697
698
                    String sourceUuid = attributes.getValue("sourceConnector");
699
                    String destinationUuid = attributes
700
                            .getValue("destConnector");
701
702
                    final Object source;
703
                    final Object destination;
704 2 1. constructFig : negated conditional → NO_COVERAGE
2. constructFig : negated conditional → NO_COVERAGE
                    if (sourceUuid != null && destinationUuid != null) {
705
                        source = findOwner(sourceUuid);
706
                        destination = findOwner(destinationUuid);
707
                    } else {
708
                        source = null;
709
                        destination = null;
710
                    }
711
712
                    DiagramEdgeSettings newSettings = new DiagramEdgeSettings(
713
                            owner, source, destination);
714
                    parameters[0] = newSettings;
715
                    parameters[1] = oldSettings;
716
717 1 1. constructFig : removed call to java/lang/reflect/Constructor::setAccessible → NO_COVERAGE
                    constructor.setAccessible(true);
718
                    f = (Fig) constructor.newInstance(parameters);
719 1 1. constructFig : negated conditional → NO_COVERAGE
                } else if (parameterTypes.length == 2
720 1 1. constructFig : negated conditional → NO_COVERAGE
                        && parameterTypes[0].equals(Rectangle.class)
721 1 1. constructFig : negated conditional → NO_COVERAGE
                        && parameterTypes[1].equals(DiagramSettings.class)) {
722
                    // A FigNodeModelElement with no owner should match here
723
                    // TODO: This is a temporary solution due to FigPool
724
                    // extending
725
                    // FigNodeModelElement when in fact it should not do so.
726
                    Object parameters[] = new Object[2];
727
                    parameters[0] = bounds;
728
                    parameters[1] = oldSettings;
729
730 1 1. constructFig : removed call to java/lang/reflect/Constructor::setAccessible → NO_COVERAGE
                    constructor.setAccessible(true);
731
                    f = (Fig) constructor.newInstance(parameters);
732
                }
733
            }
734 1 1. constructFig : negated conditional → NO_COVERAGE
            if (f == null) {
735
                // If no Fig was created by the code above then we must go
736
                // look for the old style constructor that should have fallen
737
                // into disuse by now.
738
                // Fig(Object, Rectangle, DiagramSettings)
739
                // All of these constructors should have been deprecated
740
                // at least and replaced with the new signature. This is
741
                // here for paranoia only until all Figs have been reviewed.
742 3 1. constructFig : changed conditional boundary → NO_COVERAGE
2. constructFig : Changed increment from 1 to -1 → NO_COVERAGE
3. constructFig : negated conditional → NO_COVERAGE
                for (Constructor constructor : constructors) {
743
                    Class[] parameterTypes = constructor.getParameterTypes();
744 1 1. constructFig : negated conditional → NO_COVERAGE
                    if (parameterTypes.length == 2
745 1 1. constructFig : negated conditional → NO_COVERAGE
                            && parameterTypes[0].equals(Object.class)
746 1 1. constructFig : negated conditional → NO_COVERAGE
                            && parameterTypes[1].equals(DiagramSettings.class)) {
747
                        Object parameters[] = new Object[2];
748
749
                        final Object owner = getOwner(className, href);
750
                        // currently FigEdgeNote can be passed null
751
//                        if (owner == null) {
752
//                            return null;
753
//                        }
754
                        parameters[0] = owner;
755
                        parameters[1] = oldSettings;
756
757 1 1. constructFig : removed call to java/lang/reflect/Constructor::setAccessible → NO_COVERAGE
                        constructor.setAccessible(true);
758
                        f = (Fig) constructor.newInstance(parameters);
759
                        LOG.log(Level.WARNING,
760
                                "Fig created by old style constructor "
761
                                + f.getClass().getName());
762
                        break;
763
                    }
764
                }
765
            }
766
        } catch (ClassNotFoundException e) {
767
            throw new SAXException(e);
768
        } catch (IllegalAccessException e) {
769
            throw new SAXException(e);
770
        } catch (InstantiationException e) {
771
            throw new SAXException(e);
772
        } catch (InvocationTargetException e) {
773
            throw new SAXException(e);
774
        }
775
776
        // Fall back to GEF's handling if we couldn't find an appropriate
777
        // constructor
778 1 1. constructFig : negated conditional → NO_COVERAGE
        if (f == null) {
779
            LOG.log(Level.WARNING,
780
                    "No ArgoUML constructor found for " + className
781
                    + " falling back to GEF's default constructors");
782
            f = super.constructFig(className, href, bounds, attributes);
783
        }
784
785 1 1. constructFig : mutated return of Object value for org/argouml/persistence/PGMLStackParser::constructFig to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return f;
786
    }
787
788
    /**
789
     * Given the href extracted from the PGML return the model element with that
790
     * uuid.
791
     *
792
     * @param className Used only for logging should the href not be found
793
     * @param href The href
794
     * @return
795
     */
796
    private Object getOwner(String className, String id) {
797 1 1. getOwner : negated conditional → NO_COVERAGE
        if (id == null) {
798
            LOG.log(Level.WARNING,
799
                    "There is no href attribute provided for a " + className
800
                    + " so the diagram element is ignored on load");
801 1 1. getOwner : mutated return of Object value for org/argouml/persistence/PGMLStackParser::getOwner to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
            return null;
802
        }
803
        final Object owner = findOwner(id);
804 1 1. getOwner : negated conditional → NO_COVERAGE
        if (owner == null) {
805
            LOG.log(Level.WARNING,
806
                    "The href " + id + " is not found for a " + className
807
                    + " so the diagram element is ignored on load");
808 1 1. getOwner : mutated return of Object value for org/argouml/persistence/PGMLStackParser::getOwner to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
            return null;
809
        }
810 1 1. getOwner : mutated return of Object value for org/argouml/persistence/PGMLStackParser::getOwner to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return owner;
811
    }
812
813
    /**
814
     * Save the newly created Diagram for use by the parser. We take the
815
     * opportunity to attach our default diagram settings to it so we'll have
816
     * them if needed when constructing Figs.
817
     * <p>
818
     * Diagrams are created in GEF's PGMLHandler.initDiagram() which is private
819
     * and can't be overridden. Initialization sequence is:
820
     * <ul>
821
     * <li>load diagram class using name in PGML file
822
     * <li>instantiate using 0-arg constructor
823
     * <li>invoke this method (setDiagram(<newDiagramInstance))
824
     * <li>invoke diagram's initialize(Object owner) method
825
     * <li>diagram.setName()
826
     * <li>diagram.setScale()
827
     * <li>diagram.setShowSingleMultiplicity() (?!why does GEF care about
828
     * multiplicity?!)
829
     * </ul>
830
     *
831
     * @param diagram the new diagram
832
     * @see org.tigris.gef.persistence.pgml.PGMLStackParser#setDiagram(org.tigris.gef.base.Diagram)
833
     */
834
    @Override
835
    public void setDiagram(Diagram diagram) {
836
        // TODO: We could generalize this to initialize more stuff if needed
837 1 1. setDiagram : removed call to org/argouml/uml/diagram/ArgoDiagram::setDiagramSettings → NO_COVERAGE
        ((ArgoDiagram) diagram).setDiagramSettings(getDiagramSettings());
838 1 1. setDiagram : removed call to org/tigris/gef/persistence/pgml/PGMLStackParser::setDiagram → NO_COVERAGE
        super.setDiagram(diagram);
839
    }
840
841
    public DiagramSettings getDiagramSettings() {
842 1 1. getDiagramSettings : mutated return of Object value for org/argouml/persistence/PGMLStackParser::getDiagramSettings to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return diagramSettings;
843
    }
844
}

Mutations

104

1.1
Location : addTranslations
Killed by : none
removed call to org/argouml/persistence/PGMLStackParser::addTranslation → NO_COVERAGE

106

1.1
Location : addTranslations
Killed by : none
removed call to org/argouml/persistence/PGMLStackParser::addTranslation → NO_COVERAGE

108

1.1
Location : addTranslations
Killed by : none
removed call to org/argouml/persistence/PGMLStackParser::addTranslation → NO_COVERAGE

110

1.1
Location : addTranslations
Killed by : none
removed call to org/argouml/persistence/PGMLStackParser::addTranslation → NO_COVERAGE

112

1.1
Location : addTranslations
Killed by : none
removed call to org/argouml/persistence/PGMLStackParser::addTranslation → NO_COVERAGE

114

1.1
Location : addTranslations
Killed by : none
removed call to org/argouml/persistence/PGMLStackParser::addTranslation → NO_COVERAGE

116

1.1
Location : addTranslations
Killed by : none
removed call to org/argouml/persistence/PGMLStackParser::addTranslation → NO_COVERAGE

118

1.1
Location : addTranslations
Killed by : none
removed call to org/argouml/persistence/PGMLStackParser::addTranslation → NO_COVERAGE

120

1.1
Location : addTranslations
Killed by : none
removed call to org/argouml/persistence/PGMLStackParser::addTranslation → NO_COVERAGE

122

1.1
Location : addTranslations
Killed by : none
removed call to org/argouml/persistence/PGMLStackParser::addTranslation → NO_COVERAGE

124

1.1
Location : addTranslations
Killed by : none
removed call to org/argouml/persistence/PGMLStackParser::addTranslation → NO_COVERAGE

127

1.1
Location : addTranslations
Killed by : none
removed call to org/argouml/persistence/PGMLStackParser::addTranslation → NO_COVERAGE

143

1.1
Location :
Killed by : none
removed call to org/argouml/persistence/PGMLStackParser::addTranslations → NO_COVERAGE

161

1.1
Location : getHandler
Killed by : none
negated conditional → NO_COVERAGE

163

1.1
Location : getHandler
Killed by : none
negated conditional → NO_COVERAGE

166

1.1
Location : getHandler
Killed by : none
mutated return of Object value for org/argouml/persistence/PGMLStackParser::getHandler to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

171

1.1
Location : getHandler
Killed by : none
negated conditional → NO_COVERAGE

173

1.1
Location : getHandler
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : getHandler
Killed by : none
negated conditional → NO_COVERAGE

174

1.1
Location : getHandler
Killed by : none
mutated return of Object value for org/argouml/persistence/PGMLStackParser::getHandler to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

179

1.1
Location : getHandler
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : getHandler
Killed by : none
negated conditional → NO_COVERAGE

180

1.1
Location : getHandler
Killed by : none
mutated return of Object value for org/argouml/persistence/PGMLStackParser::getHandler to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

186

1.1
Location : getHandler
Killed by : none
negated conditional → NO_COVERAGE

187

1.1
Location : getHandler
Killed by : none
mutated return of Object value for org/argouml/persistence/PGMLStackParser::getHandler to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

191

1.1
Location : getHandler
Killed by : none
mutated return of Object value for org/argouml/persistence/PGMLStackParser::getHandler to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

203

1.1
Location : setAttrs
Killed by : none
negated conditional → NO_COVERAGE

206

1.1
Location : setAttrs
Killed by : none
negated conditional → NO_COVERAGE

210

1.1
Location : setAttrs
Killed by : none
negated conditional → NO_COVERAGE

213

1.1
Location : setAttrs
Killed by : none
negated conditional → NO_COVERAGE

216

1.1
Location : setAttrs
Killed by : none
negated conditional → NO_COVERAGE

219

1.1
Location : setAttrs
Killed by : none
negated conditional → NO_COVERAGE

222

1.1
Location : setAttrs
Killed by : none
negated conditional → NO_COVERAGE

227

1.1
Location : setAttrs
Killed by : none
removed call to org/argouml/persistence/PGMLStackParser::setStyleAttributes → NO_COVERAGE

234

1.1
Location : setAttrs
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : setAttrs
Killed by : none
negated conditional → NO_COVERAGE

235

1.1
Location : setAttrs
Killed by : none
removed call to org/argouml/persistence/PGMLStackParser::registerFig → NO_COVERAGE

238

1.1
Location : setAttrs
Killed by : none
removed call to org/argouml/persistence/PGMLStackParser::setCommonAttrs → NO_COVERAGE

241

1.1
Location : setAttrs
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : setAttrs
Killed by : none
negated conditional → NO_COVERAGE

243

1.1
Location : setAttrs
Killed by : none
negated conditional → NO_COVERAGE

249

1.1
Location : setAttrs
Killed by : none
negated conditional → NO_COVERAGE

251

1.1
Location : setAttrs
Killed by : none
negated conditional → NO_COVERAGE

254

1.1
Location : setAttrs
Killed by : none
removed call to org/tigris/gef/presentation/Fig::setOwner → NO_COVERAGE

281

1.1
Location : interpretStyle
Killed by : none
negated conditional → NO_COVERAGE

284

1.1
Location : interpretStyle
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : interpretStyle
Killed by : none
negated conditional → NO_COVERAGE

289

1.1
Location : interpretStyle
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

294

1.1
Location : interpretStyle
Killed by : none
mutated return of Object value for org/argouml/persistence/PGMLStackParser::interpretStyle to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

309

1.1
Location : setStyleAttributes
Killed by : none
negated conditional → NO_COVERAGE

313

1.1
Location : setStyleAttributes
Killed by : none
negated conditional → NO_COVERAGE

315

1.1
Location : setStyleAttributes
Killed by : none
negated conditional → NO_COVERAGE

316

1.1
Location : setStyleAttributes
Killed by : none
removed call to org/argouml/uml/diagram/ui/FigCompartmentBox::showCompartment → NO_COVERAGE

318

1.1
Location : setStyleAttributes
Killed by : none
negated conditional → NO_COVERAGE

319

1.1
Location : setStyleAttributes
Killed by : none
removed call to org/argouml/uml/diagram/ui/FigCompartmentBox::showCompartment → NO_COVERAGE

321

1.1
Location : setStyleAttributes
Killed by : none
negated conditional → NO_COVERAGE

322

1.1
Location : setStyleAttributes
Killed by : none
removed call to org/argouml/uml/diagram/ui/FigCompartmentBox::showCompartment → NO_COVERAGE

325

1.1
Location : setStyleAttributes
Killed by : none
negated conditional → NO_COVERAGE

326

1.1
Location : setStyleAttributes
Killed by : none
removed call to org/argouml/uml/diagram/ui/FigCompartmentBox::showCompartment → NO_COVERAGE

331

1.1
Location : setStyleAttributes
Killed by : none
negated conditional → NO_COVERAGE

332

1.1
Location : setStyleAttributes
Killed by : none
removed call to org/argouml/uml/diagram/StereotypeContainer::setStereotypeVisible → NO_COVERAGE

334

1.1
Location : setStyleAttributes
Killed by : none
negated conditional → NO_COVERAGE

335

1.1
Location : setStyleAttributes
Killed by : none
removed call to org/argouml/uml/diagram/VisibilityContainer::setVisibilityVisible → NO_COVERAGE

337

1.1
Location : setStyleAttributes
Killed by : none
negated conditional → NO_COVERAGE

338

1.1
Location : setStyleAttributes
Killed by : none
removed call to org/argouml/uml/diagram/PathContainer::setPathVisible → NO_COVERAGE

356

1.1
Location : readArgoDiagram
Killed by : none
negated conditional → NO_COVERAGE

367

1.1
Location : readArgoDiagram
Killed by : none
mutated return of Object value for org/argouml/persistence/PGMLStackParser::readArgoDiagram to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

381

1.1
Location : readArgoDiagram
Killed by : none
mutated return of Object value for org/argouml/persistence/PGMLStackParser::readArgoDiagram to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

394

1.1
Location : readDiagram
Killed by : none
removed call to org/argouml/persistence/PGMLStackParser::attachEdges → NO_COVERAGE

396

1.1
Location : readDiagram
Killed by : none
mutated return of Object value for org/argouml/persistence/PGMLStackParser::readDiagram to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

408

1.1
Location : attachEdges
Killed by : none
negated conditional → NO_COVERAGE

412

1.1
Location : attachEdges
Killed by : none
negated conditional → NO_COVERAGE

413

1.1
Location : attachEdges
Killed by : none
negated conditional → NO_COVERAGE

414

1.1
Location : attachEdges
Killed by : none
removed call to org/tigris/gef/presentation/FigEdge::setOwner → NO_COVERAGE

419

1.1
Location : attachEdges
Killed by : none
negated conditional → NO_COVERAGE

428

1.1
Location : attachEdges
Killed by : none
negated conditional → NO_COVERAGE

432

1.1
Location : attachEdges
Killed by : none
negated conditional → NO_COVERAGE

436

1.1
Location : attachEdges
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : attachEdges
Killed by : none
negated conditional → NO_COVERAGE

440

1.1
Location : attachEdges
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : attachEdges
Killed by : none
negated conditional → NO_COVERAGE

444

1.1
Location : attachEdges
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : attachEdges
Killed by : none
negated conditional → NO_COVERAGE

445

1.1
Location : attachEdges
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : attachEdges
Killed by : none
negated conditional → NO_COVERAGE

449

1.1
Location : attachEdges
Killed by : none
removed call to org/tigris/gef/presentation/FigEdge::removeFromDiagram → NO_COVERAGE

451

1.1
Location : attachEdges
Killed by : none
removed call to org/tigris/gef/presentation/FigEdge::setSourcePortFig → NO_COVERAGE

452

1.1
Location : attachEdges
Killed by : none
removed call to org/tigris/gef/presentation/FigEdge::setDestPortFig → NO_COVERAGE

453

1.1
Location : attachEdges
Killed by : none
removed call to org/tigris/gef/presentation/FigEdge::setSourceFigNode → NO_COVERAGE

454

1.1
Location : attachEdges
Killed by : none
removed call to org/tigris/gef/presentation/FigEdge::setDestFigNode → NO_COVERAGE

464

1.1
Location : attachEdges
Killed by : none
negated conditional → NO_COVERAGE

466

1.1
Location : attachEdges
Killed by : none
removed call to org/tigris/gef/presentation/FigEdge::computeRouteImpl → NO_COVERAGE

496

1.1
Location : getFigNode
Killed by : none
negated conditional → NO_COVERAGE

503

1.1
Location : getFigNode
Killed by : none
negated conditional → NO_COVERAGE

507

1.1
Location : getFigNode
Killed by : none
removed call to org/argouml/uml/diagram/ui/FigEdgeModelElement::makeEdgePort → NO_COVERAGE

508

1.1
Location : getFigNode
Killed by : none
mutated return of Object value for org/argouml/persistence/PGMLStackParser::getFigNode to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

513

1.1
Location : getFigNode
Killed by : none
negated conditional → NO_COVERAGE

514

1.1
Location : getFigNode
Killed by : none
mutated return of Object value for org/argouml/persistence/PGMLStackParser::getFigNode to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

518

1.1
Location : getFigNode
Killed by : none
mutated return of Object value for org/argouml/persistence/PGMLStackParser::getFigNode to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

531

1.1
Location : getPortFig
Killed by : none
negated conditional → NO_COVERAGE

533

1.1
Location : getPortFig
Killed by : none
mutated return of Object value for org/argouml/persistence/PGMLStackParser::getPortFig to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

535

1.1
Location : getPortFig
Killed by : none
mutated return of Object value for org/argouml/persistence/PGMLStackParser::getPortFig to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

569

1.1
Location :
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location :
Killed by : none
negated conditional → NO_COVERAGE

578

1.1
Location :
Killed by : none
negated conditional → NO_COVERAGE

580

1.1
Location :
Killed by : none
negated conditional → NO_COVERAGE

589

1.1
Location : getDestFigNodeId
Killed by : none
mutated return of Object value for org/argouml/persistence/PGMLStackParser$EdgeData::getDestFigNodeId to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

598

1.1
Location : getDestPortFigId
Killed by : none
mutated return of Object value for org/argouml/persistence/PGMLStackParser$EdgeData::getDestPortFigId to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

607

1.1
Location : getFigEdge
Killed by : none
mutated return of Object value for org/argouml/persistence/PGMLStackParser$EdgeData::getFigEdge to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

616

1.1
Location : getSourceFigNodeId
Killed by : none
mutated return of Object value for org/argouml/persistence/PGMLStackParser$EdgeData::getSourceFigNodeId to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

625

1.1
Location : getSourcePortFigId
Killed by : none
mutated return of Object value for org/argouml/persistence/PGMLStackParser$EdgeData::getSourcePortFigId to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

669

1.1
Location : constructFig
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : constructFig
Killed by : none
Changed increment from 1 to -1 → NO_COVERAGE

3.3
Location : constructFig
Killed by : none
negated conditional → NO_COVERAGE

671

1.1
Location : constructFig
Killed by : none
negated conditional → NO_COVERAGE

672

1.1
Location : constructFig
Killed by : none
negated conditional → NO_COVERAGE

673

1.1
Location : constructFig
Killed by : none
negated conditional → NO_COVERAGE

674

1.1
Location : constructFig
Killed by : none
negated conditional → NO_COVERAGE

678

1.1
Location : constructFig
Killed by : none
negated conditional → NO_COVERAGE

679

1.1
Location : constructFig
Killed by : none
mutated return of Object value for org/argouml/persistence/PGMLStackParser::constructFig to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

685

1.1
Location : constructFig
Killed by : none
removed call to java/lang/reflect/Constructor::setAccessible → NO_COVERAGE

687

1.1
Location : constructFig
Killed by : none
negated conditional → NO_COVERAGE

688

1.1
Location : constructFig
Killed by : none
negated conditional → NO_COVERAGE

689

1.1
Location : constructFig
Killed by : none
negated conditional → NO_COVERAGE

694

1.1
Location : constructFig
Killed by : none
negated conditional → NO_COVERAGE

695

1.1
Location : constructFig
Killed by : none
mutated return of Object value for org/argouml/persistence/PGMLStackParser::constructFig to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

704

1.1
Location : constructFig
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : constructFig
Killed by : none
negated conditional → NO_COVERAGE

717

1.1
Location : constructFig
Killed by : none
removed call to java/lang/reflect/Constructor::setAccessible → NO_COVERAGE

719

1.1
Location : constructFig
Killed by : none
negated conditional → NO_COVERAGE

720

1.1
Location : constructFig
Killed by : none
negated conditional → NO_COVERAGE

721

1.1
Location : constructFig
Killed by : none
negated conditional → NO_COVERAGE

730

1.1
Location : constructFig
Killed by : none
removed call to java/lang/reflect/Constructor::setAccessible → NO_COVERAGE

734

1.1
Location : constructFig
Killed by : none
negated conditional → NO_COVERAGE

742

1.1
Location : constructFig
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : constructFig
Killed by : none
Changed increment from 1 to -1 → NO_COVERAGE

3.3
Location : constructFig
Killed by : none
negated conditional → NO_COVERAGE

744

1.1
Location : constructFig
Killed by : none
negated conditional → NO_COVERAGE

745

1.1
Location : constructFig
Killed by : none
negated conditional → NO_COVERAGE

746

1.1
Location : constructFig
Killed by : none
negated conditional → NO_COVERAGE

757

1.1
Location : constructFig
Killed by : none
removed call to java/lang/reflect/Constructor::setAccessible → NO_COVERAGE

778

1.1
Location : constructFig
Killed by : none
negated conditional → NO_COVERAGE

785

1.1
Location : constructFig
Killed by : none
mutated return of Object value for org/argouml/persistence/PGMLStackParser::constructFig to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

797

1.1
Location : getOwner
Killed by : none
negated conditional → NO_COVERAGE

801

1.1
Location : getOwner
Killed by : none
mutated return of Object value for org/argouml/persistence/PGMLStackParser::getOwner to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

804

1.1
Location : getOwner
Killed by : none
negated conditional → NO_COVERAGE

808

1.1
Location : getOwner
Killed by : none
mutated return of Object value for org/argouml/persistence/PGMLStackParser::getOwner to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

810

1.1
Location : getOwner
Killed by : none
mutated return of Object value for org/argouml/persistence/PGMLStackParser::getOwner to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

837

1.1
Location : setDiagram
Killed by : none
removed call to org/argouml/uml/diagram/ArgoDiagram::setDiagramSettings → NO_COVERAGE

838

1.1
Location : setDiagram
Killed by : none
removed call to org/tigris/gef/persistence/pgml/PGMLStackParser::setDiagram → NO_COVERAGE

842

1.1
Location : getDiagramSettings
Killed by : none
mutated return of Object value for org/argouml/persistence/PGMLStackParser::getDiagramSettings to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 0.32