Interface ReachabilityCallback<V,E>

Type Parameters:
V - the vertex type
E - the edge type
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface ReachabilityCallback<V,E>
A consumer callback for reachability algorithms. Used both to consume the result of the search and to halt the search early.
Author:
Lee A. Christie
  • Method Details

    • from

      static <V,E> ReachabilityCallback<V,E> from(BiConsumer<V,E> consumer)
      Converts a bi-consumer to a reachability callback which never halts early.
      Type Parameters:
      V - the vertex type
      E - the edge type
      Parameters:
      consumer - the bi-consumer, not null
      Returns:
      a reachability callback
    • from

      static <V,E> ReachabilityCallback<V,E> from(BiConsumer<V,E> consumer, BiPredicate<V,E> shouldHalt)
      Converts a bi-consumer to a reachability callback which halts early based on a separate call to a bi-predicate, where true indicates halt.
      Type Parameters:
      V - the vertex type
      E - the edge type
      Parameters:
      consumer - the bi-consumer, not null
      shouldHalt - the bi-predicate, not null
      Returns:
      a reachability callback
    • consume

      ReachabilityCallback.Action consume(V vertex, E cost)
      Consumes the current discovered vertex and instructs whether to stop.
      Parameters:
      vertex - the current vertex, not null
      cost - the current cost, not null
      Returns:
      ReachabilityCallback.Action.BREAK if the search should halt now, otherwise ReachabilityCallback.Action.CONTINUE