Modifier and Type | Field and Description |
---|---|
Graph<T> |
graph
The
Graph on which all searches are performed. |
Modifier and Type | Method and Description |
---|---|
boolean |
findMatching(java.util.function.Predicate<T> match,
T source)
Finds all contiguous
graph nodes that match the specified conditions,
starting from the specified source node. |
java.util.List<T> |
nodes()
Gets all
graph nodes that were reached by the last successful search. |
public boolean findMatching(java.util.function.Predicate<T> match, T source)
graph
nodes that match the specified conditions,
starting from the specified source node.
Returns false
if graph
does not contain source
, or
if there are no contiguous nodes for which match
succeeds. Otherwise,
returns true
and sets nodes()
to the result of the flood fill.match
- the Predicate
to test against each graph
nodesource
- the source node within graph
where the search startstrue
if one or more graph
nodes that pass match
could be reached from the specified source
, else false
java.lang.NullPointerException
- if match
or source
is null
public java.util.List<T> nodes()
graph
nodes that were reached by the last successful search.
Returns an empty collection if the last findMatching(java.util.function.Predicate<T>, T)
call returned
false
, or if the method has not yet been called.List
containing all graph
nodes that were reached
by the last successful findMatching(java.util.function.Predicate<T>, T)
call, not including the source node