CPD Results

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

Duplications

File Line
org/opentrafficsim/editor/XiIncludeNode.java 178
org/opentrafficsim/editor/XiIncludeNode.java 740
}

    /** {@inheritDoc} */
    @Override
    public Node cloneNode(final boolean deep)
    {
        return null;
    }

    /** {@inheritDoc} */
    @Override
    public void normalize()
    {
    }

    /** {@inheritDoc} */
    @Override
    public boolean isSupported(final String feature, final String version)
    {
        return false;
    }

    /** {@inheritDoc} */
    @Override
    public String getNamespaceURI()
    {
        return null;
    }

    /** {@inheritDoc} */
    @Override
    public String getPrefix()
    {
        return null;
    }

    /** {@inheritDoc} */
    @Override
    public void setPrefix(final String prefix) throws DOMException
    {
    }

    /** {@inheritDoc} */
    @Override
    public String getLocalName()
    {
        return null;
    }

    /** {@inheritDoc} */
    @Override
    public boolean hasAttributes()
    {
        return false;
    }

    /** {@inheritDoc} */
    @Override
    public String getBaseURI()
    {
        return null;
    }

    /** {@inheritDoc} */
    @Override
    public short compareDocumentPosition(final Node other) throws DOMException
    {
        return 0;
    }

    /** {@inheritDoc} */
    @Override
    public String getTextContent() throws DOMException
    {
        return null;
    }

    /** {@inheritDoc} */
    @Override
    public void setTextContent(final String textContent) throws DOMException
    {
    }

    /** {@inheritDoc} */
    @Override
    public boolean isSameNode(final Node other)
    {
        return false;
    }

    /** {@inheritDoc} */
    @Override
    public String lookupPrefix(final String namespaceURI)
    {
        return null;
    }

    /** {@inheritDoc} */
    @Override
    public boolean isDefaultNamespace(final String namespaceURI)
    {
        return false;
    }

    /** {@inheritDoc} */
    @Override
    public String lookupNamespaceURI(final String prefix)
    {
        return null;
    }

    /** {@inheritDoc} */
    @Override
    public boolean isEqualNode(final Node arg)
    {
        return false;
    }

    /** {@inheritDoc} */
    @Override
    public Object getFeature(final String feature, final String version)
    {
        return null;
    }

    /** {@inheritDoc} */
    @Override
    public Object setUserData(final String key, final Object data, final UserDataHandler handler)
    {
        return null;
    }

    /** {@inheritDoc} */
    @Override
    public Object getUserData(final String key)
    {
        return null;
    }
File Line
org/opentrafficsim/editor/decoration/validation/NoDuplicateChildrenValidator.java 92
org/opentrafficsim/editor/decoration/validation/XsdAllValidator.java 60
public void notifyRemoved(final XsdTreeNode node)
    {
        if (this.nodes.remove(node))
        {
            node.removeListener(this, XsdTreeNode.VALUE_CHANGED);
            node.removeListener(this, XsdTreeNode.OPTION_CHANGED);
            node.removeListener(this, XsdTreeNode.ATTRIBUTE_CHANGED);
            node.removeListener(this, XsdTreeNode.ACTIVATION_CHANGED);
            this.nodes.forEach((n) -> n.invalidate());
        }
    }

    /** {@inheritDoc} */
    @Override
    public String apply(final XsdTreeNode node)
    {
        if (!node.isActive())
        {
            return null;
        }
        List<XsdTreeNode> childs = node.getParent().getChildren();
        if (childs.stream().filter((n) -> nodesEqual(node, n)).count() > 1)
        {
            return "Duplicate elements " + node.getNodeName() + " is not allowed.";
        }
        return null;
    }

    /**
     * Returns whether the nodes are equal by path string and value.
     * @param node1 XsdTreeNode; node 1.
     * @param node2 XsdTreeNode; node 2.
     * @return whether the nodes are equal by path string and value.
     */
    private final static boolean nodesEqual(final XsdTreeNode node1, final XsdTreeNode node2)
    {
        if (!node1.getPathString().equals(node2.getPathString()))
        {
            return false;
        }
        if (!XsdTreeNodeUtil.valuesAreEqual(node1.getValue(), node2.getValue()))
        {
            return false;
        }
        return true;
    }

    /** {@inheritDoc} */
    @Override
    public void notify(final Event event) throws RemoteException
    {
        if (XsdTreeNode.VALUE_CHANGED.equals(event.getType()) || XsdTreeNode.OPTION_CHANGED.equals(event.getType())
File Line
org/opentrafficsim/editor/XiIncludeNode.java 414
org/opentrafficsim/editor/XiIncludeNode.java 698
}

        /** {@inheritDoc} */
        @Override
        public Document getOwnerDocument()
        {
            return null;
        }

        /** {@inheritDoc} */
        @Override
        public Node insertBefore(final Node newChild, final Node refChild) throws DOMException
        {
            return null;
        }

        /** {@inheritDoc} */
        @Override
        public Node replaceChild(final Node newChild, final Node oldChild) throws DOMException
        {
            return null;
        }

        /** {@inheritDoc} */
        @Override
        public Node removeChild(final Node oldChild) throws DOMException
        {
            return null;
        }

        /** {@inheritDoc} */
        @Override
        public Node appendChild(final Node newChild) throws DOMException
        {
            return null;
        }

        /** {@inheritDoc} */
        @Override
        public boolean hasChildNodes()
        {
            return false;
        }

        /** {@inheritDoc} */
        @Override
        public Node cloneNode(final boolean deep)
        {
            return null;
        }

        /** {@inheritDoc} */
        @Override
        public void normalize()
        {
        }

        /** {@inheritDoc} */
        @Override
        public boolean isSupported(final String feature, final String version)
        {
            return false;
        }

        /** {@inheritDoc} */
        @Override
        public String getNamespaceURI()
        {
            return null;
        }

        /** {@inheritDoc} */
        @Override
        public String getPrefix()
        {
            return null;
        }

        /** {@inheritDoc} */
        @Override
        public void setPrefix(final String prefix) throws DOMException
        {
        }

        /** {@inheritDoc} */
        @Override
        public String getLocalName()
        {
            return null;
        }

        /** {@inheritDoc} */
        @Override
        public boolean hasAttributes()
        {
            return true;
File Line
org/opentrafficsim/editor/XiIncludeNode.java 510
org/opentrafficsim/editor/XiIncludeNode.java 794
}

        /** {@inheritDoc} */
        @Override
        public String getBaseURI()
        {
            return null;
        }

        /** {@inheritDoc} */
        @Override
        public short compareDocumentPosition(final Node other) throws DOMException
        {
            return 0;
        }

        /** {@inheritDoc} */
        @Override
        public String getTextContent() throws DOMException
        {
            return null;
        }

        /** {@inheritDoc} */
        @Override
        public void setTextContent(final String textContent) throws DOMException
        {
        }

        /** {@inheritDoc} */
        @Override
        public boolean isSameNode(final Node other)
        {
            return false;
        }

        /** {@inheritDoc} */
        @Override
        public String lookupPrefix(final String namespaceURI)
        {
            return null;
        }

        /** {@inheritDoc} */
        @Override
        public boolean isDefaultNamespace(final String namespaceURI)
        {
            return false;
        }

        /** {@inheritDoc} */
        @Override
        public String lookupNamespaceURI(final String prefix)
        {
            return null;
        }

        /** {@inheritDoc} */
        @Override
        public boolean isEqualNode(final Node arg)
        {
            return false;
        }

        /** {@inheritDoc} */
        @Override
        public Object getFeature(final String feature, final String version)
        {
            return null;
        }

        /** {@inheritDoc} */
        @Override
        public Object setUserData(final String key, final Object data, final UserDataHandler handler)
        {
            return null;
        }

        /** {@inheritDoc} */
        @Override
        public Object getUserData(final String key)
        {
            return null;
        }
        
    }
File Line
org/opentrafficsim/editor/XiIncludeNode.java 232
org/opentrafficsim/editor/XiIncludeNode.java 510
}

    /** {@inheritDoc} */
    @Override
    public String getBaseURI()
    {
        return null;
    }

    /** {@inheritDoc} */
    @Override
    public short compareDocumentPosition(final Node other) throws DOMException
    {
        return 0;
    }

    /** {@inheritDoc} */
    @Override
    public String getTextContent() throws DOMException
    {
        return null;
    }

    /** {@inheritDoc} */
    @Override
    public void setTextContent(final String textContent) throws DOMException
    {
    }

    /** {@inheritDoc} */
    @Override
    public boolean isSameNode(final Node other)
    {
        return false;
    }

    /** {@inheritDoc} */
    @Override
    public String lookupPrefix(final String namespaceURI)
    {
        return null;
    }

    /** {@inheritDoc} */
    @Override
    public boolean isDefaultNamespace(final String namespaceURI)
    {
        return false;
    }

    /** {@inheritDoc} */
    @Override
    public String lookupNamespaceURI(final String prefix)
    {
        return null;
    }

    /** {@inheritDoc} */
    @Override
    public boolean isEqualNode(final Node arg)
    {
        return false;
    }

    /** {@inheritDoc} */
    @Override
    public Object getFeature(final String feature, final String version)
    {
        return null;
    }

    /** {@inheritDoc} */
    @Override
    public Object setUserData(final String key, final Object data, final UserDataHandler handler)
    {
        return null;
    }

    /** {@inheritDoc} */
    @Override
    public Object getUserData(final String key)
    {
        return null;
    }
File Line
org/opentrafficsim/editor/decoration/LayoutCustomizer.java 38
org/opentrafficsim/editor/extensions/DefinitionsSaver.java 35
public LayoutCustomizer(final OtsEditor editor) throws RemoteException
    {
        editor.addListener(this, OtsEditor.NEW_FILE);
        this.editor = editor;
    }

    /** {@inheritDoc} */
    @Override
    public void notify(final Event event) throws RemoteException
    {
        if (event.getType().equals(OtsEditor.NEW_FILE))
        {
            XsdTreeNodeRoot root = (XsdTreeNodeRoot) event.getContent();
            root.addListener(this, XsdTreeNodeRoot.NODE_CREATED, ReferenceType.WEAK);
            root.addListener(this, XsdTreeNodeRoot.NODE_REMOVED, ReferenceType.WEAK);
        }
        else if (event.getType().equals(XsdTreeNodeRoot.NODE_CREATED))
        {
            XsdTreeNode node = (XsdTreeNode) ((Object[]) event.getContent())[0];
            if (node.getPathString().equals(XsdPaths.LINK + ".xsd:sequence")
File Line
org/opentrafficsim/editor/XiIncludeNode.java 115
org/opentrafficsim/editor/XiIncludeNode.java 677
}

    /** {@inheritDoc} */
    @Override
    public Node getPreviousSibling()
    {
        return null;
    }

    /** {@inheritDoc} */
    @Override
    public Node getNextSibling()
    {
        return null;
    }

    /** {@inheritDoc} */
    @Override
    public NamedNodeMap getAttributes()
    {
        return null;
    }

    /** {@inheritDoc} */
    @Override
    public Document getOwnerDocument()
    {
        return null;
    }

    /** {@inheritDoc} */
    @Override
    public Node insertBefore(final Node newChild, final Node refChild) throws DOMException
    {
        return null;
    }

    /** {@inheritDoc} */
    @Override
    public Node replaceChild(final Node newChild, final Node oldChild) throws DOMException
    {
        return null;
    }

    /** {@inheritDoc} */
    @Override
    public Node removeChild(final Node oldChild) throws DOMException
    {
        return null;
    }

    /** {@inheritDoc} */
    @Override
    public Node appendChild(final Node newChild) throws DOMException
    {
        return null;
    }

    /** {@inheritDoc} */
    @Override
    public boolean hasChildNodes()
    {
        return true;
File Line
org/opentrafficsim/editor/Undo.java 225
org/opentrafficsim/editor/extensions/RoadLayoutEditor.java 59
}

    /** {@inheritDoc} */
    @Override
    public void notify(final Event event) throws RemoteException
    {
        // listen and unlisten
        if (event.getType().equals(OtsEditor.NEW_FILE))
        {
            XsdTreeNodeRoot root = (XsdTreeNodeRoot) event.getContent();
            root.addListener(this, XsdTreeNodeRoot.NODE_CREATED);
            root.addListener(this, XsdTreeNodeRoot.NODE_REMOVED);
        }
        else if (event.getType().equals(XsdTreeNodeRoot.NODE_CREATED))
        {
            XsdTreeNode node = (XsdTreeNode) ((Object[]) event.getContent())[0];