V - the vertex of the visitpublic class VisitInfo<V>
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
class |
VisitInfo.VertexInfo
Class used mainly for storing the data of the visit
|
| Constructor and Description |
|---|
VisitInfo(V source)
Need a source for initialize the basic values
|
| Modifier and Type | Method and Description |
|---|---|
void |
forEach(java.util.function.Consumer<VisitInfo.VertexInfo> consumer)
Iterate through all the vertices discovered and visited with the correct timeline.
The vertices will be visited in the order that they are discovered and visited, so a vertex can appear two times (one for the discovery, anc the other for the visit) |
void |
forEachDiscovered(java.util.function.Consumer<VisitInfo.VertexInfo> consumer)
Iterate through all the vertices that are discovered.
The vertices will be ordered by the time of their discover. |
void |
forEachVisited(java.util.function.Consumer<VisitInfo.VertexInfo> consumer)
Iterate through all the vertices that are visited.
The vertices will be ordered by the time of their visit. |
java.util.Set<V> |
getDiscovered()
Get all the discovered vertices so far.
|
V |
getParentOf(V vertex)
Get the parent of a particular vertex.
The parent of a vertex is the one that has discovered it If the vertex has no parent (it has not been set by the visit algorithm or it's the source) then null is returned. |
V |
getSource()
Get the source of the visit.
|
long |
getTimeDiscover(V vertex)
The time of the vertex when it is discovered in the visit.
For "discovered" i mean when the node is first found by the visit algorithm. |
long |
getTimeVisit(V vertex)
The time when the vertex is visited by the algorithm
For "visited" i mean when the node is finally visited by the visit algorithm. |
java.util.Set<V> |
getVisited()
Get all the visited vertices so far.
|
boolean |
isDiscovered(V vertex)
Tells if a vertex is discovered or not
|
boolean |
isVisited(V vertex)
Tells if the vertex is visited or not
|
public VisitInfo(V source)
source - the source of the visitjava.lang.NullPointerException - if the source is nullpublic long getTimeDiscover(V vertex) throws java.lang.IllegalArgumentException, java.lang.NullPointerException
VisitStrategyvertex - the vertex neededjava.lang.IllegalArgumentException - if the vertex is not discoveredjava.lang.NullPointerException - if the vertex is nullpublic long getTimeVisit(V vertex) throws java.lang.IllegalArgumentException, java.lang.NullPointerException
VisitStrategyvertex - the vertex neededjava.lang.IllegalArgumentException - if the vertex is not visitedjava.lang.NullPointerException - if the vertex is nullpublic boolean isDiscovered(V vertex) throws java.lang.NullPointerException
vertex - the vertex chosenjava.lang.NullPointerExceptionpublic boolean isVisited(V vertex) throws java.lang.NullPointerException
vertex - the vertex chosenjava.lang.NullPointerExceptionpublic V getSource()
public V getParentOf(V vertex) throws java.lang.IllegalArgumentException
vertex - the child vertexjava.lang.IllegalArgumentException - if the vertex has not been discovered yetpublic java.util.Set<V> getVisited()
public java.util.Set<V> getDiscovered()
public void forEachDiscovered(java.util.function.Consumer<VisitInfo.VertexInfo> consumer)
consumer - the function to apply to eachpublic void forEachVisited(java.util.function.Consumer<VisitInfo.VertexInfo> consumer)
consumer - the function to apply to eachpublic void forEach(java.util.function.Consumer<VisitInfo.VertexInfo> consumer)
consumer - the function to apply at each vertex