CPD Results

The following document contains the results of PMD's CPD 5.3.5.

Duplications

File Line
org\opentrafficsim\road\network\factory\xml\Links.java 84
org\opentrafficsim\road\network\factory\xml\Links.java 258
        for (LinkTag linkTag : parser.linkTags.values())
        {
            if (linkTag.straightTag != null && linkTag.nodeStartTag.coordinate != null && linkTag.nodeEndTag.coordinate != null)
            {
                if (linkTag.nodeStartTag.angle == null)
                {
                    double dx = linkTag.nodeEndTag.coordinate.x - linkTag.nodeStartTag.coordinate.x;
                    double dy = linkTag.nodeEndTag.coordinate.y - linkTag.nodeStartTag.coordinate.y;
                    linkTag.nodeStartTag.angle = new Direction(Math.atan2(dy, dx), AngleUnit.RADIAN);
                }
                if (linkTag.nodeEndTag.angle == null)
                {
                    double dx = linkTag.nodeEndTag.coordinate.x - linkTag.nodeStartTag.coordinate.x;
                    double dy = linkTag.nodeEndTag.coordinate.y - linkTag.nodeStartTag.coordinate.y;
                    linkTag.nodeEndTag.angle = new Direction(Math.atan2(dy, dx), AngleUnit.RADIAN);
                }
            }
        }
File Line
org\opentrafficsim\road\network\factory\xml\units\LaneAttributes.java 112
org\opentrafficsim\road\network\factory\xml\units\LaneAttributes.java 138
        else if (ocStr.startsWith("LEFTSET"))
        {
            int lset1 = ocStr.indexOf('[') + 1;
            int rset1 = ocStr.indexOf(']', lset1);
            int lset2 = ocStr.indexOf('[', ocStr.indexOf("OVERTAKE")) + 1;
            int rset2 = ocStr.indexOf(']', lset2);
            if (lset1 == -1 || rset1 == -1 || rset1 - lset1 < 3 || lset2 == -1 || rset2 == -1 || rset2 - lset2 < 3)
            {
                throw new NetworkException("Sets in overtaking conditions string: '" + ocStr + "' not coded right");
            }
            Set<GTUType> overtakingGTUs = parseGTUTypeSet(ocStr.substring(lset1, rset1), parser);
            Set<GTUType> overtakenGTUs = parseGTUTypeSet(ocStr.substring(lset2, rset2), parser);
            if (ocStr.contains("RIGHTSPEED"))
File Line
org\opentrafficsim\road\network\factory\xml\CrossSectionElementTag.java 201
org\opentrafficsim\road\network\factory\xml\CrossSectionElementTag.java 301
org\opentrafficsim\road\network\factory\xml\CrossSectionElementTag.java 352
        if (attributes.getNamedItem("OFFSET") != null)
            cseTag.offset = LengthUnits.parseLength(attributes.getNamedItem("OFFSET").getNodeValue());
        else
            throw new SAXException("ROADLAYOUT.LANE: missing attribute OFFSET for lane " + roadLayoutTag.name + "." + name);

        if (attributes.getNamedItem("WIDTH") != null)
            cseTag.width = LengthUnits.parseLength(attributes.getNamedItem("WIDTH").getNodeValue());
        else if (roadLayoutTag.defaultLaneWidth != null)
            cseTag.width = roadLayoutTag.defaultLaneWidth;
        else if (roadLayoutTag.roadTypeTag.defaultLaneWidth != null)
            cseTag.width = roadLayoutTag.roadTypeTag.defaultLaneWidth;
        else
            throw new SAXException("ROADLAYOUT.LANE: cannot determine WIDTH for lane: " + roadLayoutTag.name + "." + name);