Class PathFinder

java.lang.Object
com.epam.healenium.treecomparing.PathFinder

public class PathFinder
extends Object
  • Constructor Details

    • PathFinder

      public PathFinder​(PathDistance pathDistance, NodeDistance nodeDistance)
      Creates a path finder which operates certain algorithms of distance by path and by node comparing
      Parameters:
      pathDistance - an algorithm to evaluate node likeness by their path
      nodeDistance - an algorithm to evaluate node likeness by content
  • Method Details

    • findNearest

      public Node findNearest​(Path path, Node newSource)
      Finds the nearest node that most likely is our searched one
      Parameters:
      path - a collection of nodes that represents the total searched node path; the first node is html tag, the last node is the searched node. We assume that all nodes in the path have their full info.
      newSource - the parsed DOM of the changed page in which we will look for the searched node
      Returns:
      most likely node or null if there isn't any
    • find

      public List<Scored<Node>> find​(Path path, Node newSource, int bestGuessesCount)
      Finds the list of nodes that most likely are our searched one, ordered by likeness descending
      Parameters:
      path - a collection of nodes that represents the total searched node path; the first node is html tag, the last node is the searched node. We assume that all nodes in the path have their full info.
      newSource - the parsed DOM of the changed page in which we will look for the searched node
      bestGuessesCount - the size of the result collection, i.e. the number of similar nodes to return
      Returns:
      a list of probably similar nodes, ordered by likeness descending, with the size of bestGuessesCount
    • find

      public List<Scored<Node>> find​(Path path, Node newSource, int bestGuessesCount, double guessCap)
      Finds the list of nodes that most likely are our searched one, ordered by likeness descending
      Parameters:
      path - a collection of nodes that represents the total searched node path; the first node is html tag, the last node is the searched node. We assume that all nodes in the path have their full info.
      newSource - the parsed DOM of the changed page in which we will look for the searched node
      bestGuessesCount - the size of the result collection, i.e. the number of similar nodes to return
      guessCap - a min score, that path must exceed to be selected
      Returns:
      a list of probably similar nodes, ordered by likeness descending, with the size of bestGuessesCount.