Class StructuralVisualDiff


  • public class StructuralVisualDiff
    extends Object
    • Method Detail

      • computeDiff

        public void computeDiff()
      • detectNodeModifications

        private void detectNodeModifications()
      • getNodeStringRepresentation

        private String getNodeStringRepresentation​(Node node)
      • populatePostorder

        private void populatePostorder​(List<Node> postorderList,
                                       Node node)
      • getStructuralDistance

        public float getStructuralDistance()
        Returns:
        The distance between the two DOM states based on the APTED algorithm and string cost model
      • getMappedNodes

        public Map<String,​String> getMappedNodes()
        Returns:
        Nodes mapped across the two DOMs
      • getAddedNodes

        public Set<String> getAddedNodes()
        Returns:
        Nodes that have been added to the new DOM
      • getRemovedNodes

        public Set<String> getRemovedNodes()
        Returns:
        Nodes that have been removed from the old DOM
      • getMovedNodes

        public Set<String> getMovedNodes()
        Returns:
        Nodes (from the old state) that are mapped across the two states but are moved
      • getModifiedNodes

        public Set<String> getModifiedNodes()
        Returns:
        Nodes that are modified (visually or textually) from the old state
      • getComputationTime

        public long getComputationTime()
        Returns:
        Time took to compute the edit distance in the APTED algorithm
      • statesAreIdentical

        public boolean statesAreIdentical()
        Tells whether two states are identical after performing the analysis. Three things are checked: (1) there is no modified node (visually or textually), (2) there is no moved node, and (3) the distance between the two DOMs' structures is zero (i.e., there is no added/removed nodes and all nodes are mapped without any differences in tag names)
        Returns:
        True if the states are identical
      • getOldElementWithVisualInfo

        public DOMElementWithVisualInfo getOldElementWithVisualInfo​(String xpath)
        Given an XPath for a node, this method returns DOMElementWithVisualInfo of the node in the old document. The XPath should be from the old document.
        Parameters:
        xpath - of the node
        Returns:
        The node of type DOMElementWithVisualInfo. null if the node does not exist.
      • getNewElementWithVisualInfo

        public DOMElementWithVisualInfo getNewElementWithVisualInfo​(String xpath)
        Given an XPath for a node, this method returns DOMElementWithVisualInfo of the node in the new document. The XPath should be from the new document.
        Parameters:
        xpath - of the node
        Returns:
        The node of type DOMElementWithVisualInfo. null if the node does not exist.