Interface ReachabilityCallback<V,E>
- Type Parameters:
V- the vertex typeE- 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.
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
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumThe result of a callback, instructs the algorithm to either continue or halt. -
Method Summary
Modifier and TypeMethodDescriptionConsumes the current discovered vertex and instructs whether to stop.static <V,E> ReachabilityCallback <V, E> from(BiConsumer<V, E> consumer) Converts a bi-consumer to a reachability callback which never halts early.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, wheretrueindicates halt.
-
Method Details
-
from
Converts a bi-consumer to a reachability callback which never halts early.- Type Parameters:
V- the vertex typeE- the edge type- Parameters:
consumer- the bi-consumer, not null- Returns:
- a reachability callback
-
from
Converts a bi-consumer to a reachability callback which halts early based on a separate call to a bi-predicate, wheretrueindicates halt.- Type Parameters:
V- the vertex typeE- the edge type- Parameters:
consumer- the bi-consumer, not nullshouldHalt- the bi-predicate, not null- Returns:
- a reachability callback
-
consume
Consumes the current discovered vertex and instructs whether to stop.- Parameters:
vertex- the current vertex, not nullcost- the current cost, not null- Returns:
ReachabilityCallback.Action.BREAKif the search should halt now, otherwiseReachabilityCallback.Action.CONTINUE
-