Module org.jhotdraw8.graph
Package org.jhotdraw8.graph.path
Interface VertexSequenceFinder<V,C extends Number & Comparable<C>>
- Type Parameters:
V- the vertex data typeC- the cost number type
- All Known Subinterfaces:
CombinedSequenceFinder<V,A, C>
- All Known Implementing Classes:
SimpleCombinedSequenceFinder,SimpleIndexedVertexSequenceFinder,SimpleVertexSequenceFinder
public interface VertexSequenceFinder<V,C extends Number & Comparable<C>>
Interface for finding vertex sequences up to (inclusive) a maximal cost
in a directed graph.
-
Method Summary
Modifier and TypeMethodDescriptiondefault @Nullable SimpleOrderedPair<ImmutableList<V>, C> Finds a vertex sequence from start to goal.default @Nullable SimpleOrderedPair<ImmutableList<V>, C> findVertexSequence(@NonNull V start, @NonNull V goal, int maxDepth, @NonNull C costLimit, @NonNull AddToSet<V> visited) Finds a vertex sequence from start to goal.default @Nullable SimpleOrderedPair<ImmutableList<V>, C> Finds a vertex sequence from start to goal.default @Nullable OrderedPair<ImmutableList<V>, C> findVertexSequence(@NonNull V start, @NonNull Predicate<V> goalPredicate, int maxDepth, @NonNull C costLimit) Finds a vertex sequence from a start vertex to a vertex that satisfies the goal predicate.default @Nullable OrderedPair<ImmutableList<V>, C> findVertexSequence(@NonNull V start, @NonNull Predicate<V> goalPredicate, int maxDepth, @NonNull C costLimit, @NonNull AddToSet<V> visited) Finds a vertex sequence from a start vertex to a vertex that satisfies the goal predicate.default @Nullable SimpleOrderedPair<ImmutableList<V>, C> Finds a vertex sequence from a start vertex to a vertex that satisfies the goal predicate.default @Nullable OrderedPair<ImmutableList<V>, C> findVertexSequence(@NonNull Iterable<V> startVertices, @NonNull Predicate<V> goalPredicate, int maxDepth, @NonNull C costLimit) Finds a vertex sequence from a set of start vertices to a vertex that satisfies the goal predicate.findVertexSequence(@NonNull Iterable<V> startVertices, @NonNull Predicate<V> goalPredicate, int maxDepth, @NonNull C costLimit, @NonNull AddToSet<V> visited) Finds a vertex sequence from a set of start vertices to a vertex that satisfies the goal predicate.default @Nullable SimpleOrderedPair<ImmutableList<V>, C> findVertexSequence(@NonNull Iterable<V> startVertices, @NonNull Predicate<V> goalPredicate, @NonNull C costLimit) Finds a vertex sequence from a set of start vertices to a vertex that satisfies the goal predicate.default @Nullable SimpleOrderedPair<ImmutableList<V>, C> Finds a vertex sequence through the given waypoints.findVertexSequenceOverWaypoints(@NonNull Iterable<V> waypoints, int maxDepth, @NonNull C costLimit, @NonNull Supplier<AddToSet<V>> visitedSetFactory) Finds a vertex sequence through the given waypoints.default @Nullable SimpleOrderedPair<ImmutableList<V>, C> Finds a vertex sequence through the given waypoints.static <VV,CC extends Number & Comparable<CC>>
@Nullable SimpleOrderedPair<ImmutableList<VV>, CC> findVertexSequenceOverWaypoints(@NonNull Iterable<VV> waypoints, @NonNull BiFunction<VV, VV, OrderedPair<ImmutableList<VV>, CC>> findVertexSequenceFunction, @NonNull CC zero, @NonNull BiFunction<CC, CC, CC> sumFunction) Helper function for implementingfindVertexSequenceOverWaypoints(Iterable, int, Number, Supplier).
-
Method Details
-
findVertexSequence
@Nullable SimpleOrderedPair<ImmutableList<V>,C> findVertexSequence(@NonNull Iterable<V> startVertices, @NonNull Predicate<V> goalPredicate, int maxDepth, @NonNull C costLimit, @NonNull AddToSet<V> visited) Finds a vertex sequence from a set of start vertices to a vertex that satisfies the goal predicate.- Parameters:
startVertices- the start verticesgoalPredicate- the goal vertexmaxDepth- the maximal depth (inclusive) of the search Must be >= 0.costLimit- the algorithm-specific cost limitvisited- the visited set- Returns:
- an ordered pair (vertex sequence, cost), or null if no sequence was found.
-
findVertexSequence
default @Nullable OrderedPair<ImmutableList<V>,C> findVertexSequence(@NonNull Iterable<V> startVertices, @NonNull Predicate<V> goalPredicate, int maxDepth, @NonNull C costLimit) Finds a vertex sequence from a set of start vertices to a vertex that satisfies the goal predicate.- Parameters:
startVertices- the start verticesgoalPredicate- the goal vertexmaxDepth- the maximal depth (inclusive) of the search Must be >= 0.costLimit- the algorithm-specific cost limit- Returns:
- an ordered pair (vertex sequence, cost), or null if no sequence was found.
-
findVertexSequence
default @Nullable SimpleOrderedPair<ImmutableList<V>,C> findVertexSequence(@NonNull Iterable<V> startVertices, @NonNull Predicate<V> goalPredicate, @NonNull C costLimit) Finds a vertex sequence from a set of start vertices to a vertex that satisfies the goal predicate.- Parameters:
startVertices- the start verticesgoalPredicate- the goal vertexcostLimit- the algorithm-specific cost limit- Returns:
- an ordered pair (vertex sequence, cost), or null if no sequence was found.
-
findVertexSequence
default @Nullable OrderedPair<ImmutableList<V>,C> findVertexSequence(@NonNull V start, @NonNull Predicate<V> goalPredicate, int maxDepth, @NonNull C costLimit, @NonNull AddToSet<V> visited) Finds a vertex sequence from a start vertex to a vertex that satisfies the goal predicate.- Parameters:
start- the start vertexgoalPredicate- the goal vertexmaxDepth- the maximal depth (inclusive) of the search Must be >= 0.costLimit- the algorithm-specific cost limitvisited- the visited function- Returns:
- an ordered pair (vertex sequence, cost), or null if no sequence was found.
-
findVertexSequence
default @Nullable OrderedPair<ImmutableList<V>,C> findVertexSequence(@NonNull V start, @NonNull Predicate<V> goalPredicate, int maxDepth, @NonNull C costLimit) Finds a vertex sequence from a start vertex to a vertex that satisfies the goal predicate.- Parameters:
start- the start vertexgoalPredicate- the goal vertexmaxDepth- the maximal depth (inclusive) of the search Must be >= 0.costLimit- the algorithm-specific cost limit- Returns:
- an ordered pair (vertex sequence, cost), or null if no sequence was found.
-
findVertexSequence
default @Nullable SimpleOrderedPair<ImmutableList<V>,C> findVertexSequence(@NonNull V start, @NonNull Predicate<V> goalPredicate, @NonNull C costLimit) Finds a vertex sequence from a start vertex to a vertex that satisfies the goal predicate.- Parameters:
start- the start vertexgoalPredicate- the goal vertexcostLimit- the algorithm-specific cost limit- Returns:
- an ordered pair (vertex sequence, cost), or null if no sequence was found.
-
findVertexSequence
default @Nullable SimpleOrderedPair<ImmutableList<V>,C> findVertexSequence(@NonNull V start, @NonNull V goal, int maxDepth, @NonNull C costLimit, @NonNull AddToSet<V> visited) Finds a vertex sequence from start to goal.- Parameters:
start- the start vertexgoal- the goal vertexmaxDepth- the maximal depth (inclusive) of the search Must be >= 0.costLimit- the algorithm-specific cost limitvisited- the visited function- Returns:
- an ordered pair (vertex sequence, cost), or null if no sequence was found.
-
findVertexSequence
default @Nullable SimpleOrderedPair<ImmutableList<V>,C> findVertexSequence(@NonNull V start, @NonNull V goal, int maxDepth, @NonNull C costLimit) Finds a vertex sequence from start to goal.- Parameters:
start- the start vertexgoal- the goal vertexmaxDepth- the maximal depth (inclusive) of the search Must be >= 0.costLimit- the algorithm-specific cost limit- Returns:
- an ordered pair (vertex sequence, cost), or null if no sequence was found.
-
findVertexSequence
default @Nullable SimpleOrderedPair<ImmutableList<V>,C> findVertexSequence(@NonNull V start, @NonNull V goal, @NonNull C costLimit) Finds a vertex sequence from start to goal.- Parameters:
start- the start vertexgoal- the goal vertexcostLimit- the algorithm-specific cost limit- Returns:
- an ordered pair (vertex sequence, cost), or null if no sequence was found.
-
findVertexSequenceOverWaypoints
@Nullable SimpleOrderedPair<ImmutableList<V>,C> findVertexSequenceOverWaypoints(@NonNull Iterable<V> waypoints, int maxDepth, @NonNull C costLimit, @NonNull Supplier<AddToSet<V>> visitedSetFactory) Finds a vertex sequence through the given waypoints.- Parameters:
waypoints- a list of waypointsmaxDepth- the maximal depth (inclusive) of the search Must be >= 0.costLimit- the algorithm-specific cost limit for paths between waypointsvisitedSetFactory- the visited set factory- Returns:
- an ordered pair (vertex sequence, cost), or null if no sequence was found.
-
findVertexSequenceOverWaypoints
default @Nullable SimpleOrderedPair<ImmutableList<V>,C> findVertexSequenceOverWaypoints(@NonNull Iterable<V> waypoints, int maxDepth, @NonNull C costLimit) Finds a vertex sequence through the given waypoints.- Parameters:
waypoints- a list of waypointsmaxDepth- the maximal depth (inclusive) of the search Must be >= 0.costLimit- the algorithm-specific cost limit for paths between waypoints- Returns:
- an ordered pair (vertex sequence, cost), or null if no sequence was found.
-
findVertexSequenceOverWaypoints
default @Nullable SimpleOrderedPair<ImmutableList<V>,C> findVertexSequenceOverWaypoints(@NonNull Iterable<V> waypoints, @NonNull C costLimit) Finds a vertex sequence through the given waypoints.- Parameters:
waypoints- a list of waypointscostLimit- the algorithm-specific cost limit for paths between waypoints- Returns:
- an ordered pair (vertex sequence, cost), or null if no sequence was found.
-
findVertexSequenceOverWaypoints
static <VV,CC extends Number & Comparable<CC>> @Nullable SimpleOrderedPair<ImmutableList<VV>,CC> findVertexSequenceOverWaypoints(@NonNull Iterable<VV> waypoints, @NonNull BiFunction<VV, VV, OrderedPair<ImmutableList<VV>, CC>> findVertexSequenceFunction, @NonNull CC zero, @NonNull BiFunction<CC, CC, CC> sumFunction) Helper function for implementingfindVertexSequenceOverWaypoints(Iterable, int, Number, Supplier).- Type Parameters:
VV- the vertex typeCC- the number type- Parameters:
waypoints- the waypointsfindVertexSequenceFunction- the search function, for examplethis::findVertexSequencezero- the zero valuesumFunction- the sum function- Returns:
- an ordered pair with the combined sequence
-