Class PedestrianReachabilityChecker

  • All Implemented Interfaces:
    ReachabilityChecker

    class PedestrianReachabilityChecker
    extends java.lang.Object
    implements ReachabilityChecker
    Checks the reachability walking the graph from the starters towards the target.
    • Field Detail

      • topoSort

        private final boolean topoSort
    • Constructor Detail

      • PedestrianReachabilityChecker

        public PedestrianReachabilityChecker​(boolean topoSort,
                                             RevWalk walk)
        New instance of the reachability checker using a existing walk.
        Parameters:
        topoSort - walk commits in topological order
        walk - RevWalk instance to reuse. Caller retains ownership.
    • Method Detail

      • areAllReachable

        public java.util.Optional<RevCommit> areAllReachable​(java.util.Collection<RevCommit> targets,
                                                             java.util.stream.Stream<RevCommit> starters)
                                                      throws MissingObjectException,
                                                             IncorrectObjectTypeException,
                                                             java.io.IOException
        Description copied from interface: ReachabilityChecker
        Check if all targets are reachable from the starter commits.

        Caller should parse the objectIds (preferably with walk.parseCommit() and handle missing/incorrect type objects before calling this method.

        Specified by:
        areAllReachable in interface ReachabilityChecker
        Parameters:
        targets - commits to reach.
        starters - known starting points.
        Returns:
        An unreachable target if at least one of the targets is unreachable. An empty optional if all targets are reachable from the starters.
        Throws:
        MissingObjectException - if any of the incoming objects doesn't exist in the repository.
        IncorrectObjectTypeException - if any of the incoming objects is not a commit or a tag.
        java.io.IOException - if any of the underlying indexes or readers can not be opened.