Interface GraphVisitor<G extends Graph<G,N,E>,N extends Node<G,N,E>,E extends Edge<G,N,E>,V>
-
- Type Parameters:
G
- the type ofGraph
that this visitor visitsN
- the type ofNode
s in the visited graphE
- the type ofEdge
s in the visited graphV
- the type of auxiliary tool that the callbacks provided by this visitor can use while visiting the graph
- All Known Subinterfaces:
Check<T>
,SemanticCheck<A>
,SyntacticCheck
public interface GraphVisitor<G extends Graph<G,N,E>,N extends Node<G,N,E>,E extends Edge<G,N,E>,V>
A visitor of aGraph
. Instances of this interface provide callbacks to invoke when visiting the various components of a graph.
The visiting starts by visiting the graph itself throughvisit(Object, Graph)
, and then by visitingNode
s andEdge
s independently, in no particular order, throughvisit(Object, Graph, Node)
andvisit(Object, Graph, Edge)
respectively.
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default boolean
visit(V tool, G graph)
Visits a graph, inspecting its structure and signature, but without accessing its contents.default boolean
visit(V tool, G graph, E edge)
Visits an edge of the given graph.default boolean
visit(V tool, G graph, N node)
Visits a node of the given graph.default boolean
visitSubNodesFirst()
Yields whether or not, when visiting a compound node throughvisit(Object, Graph, Node)
, its sub-nodes should be visited before the node itself.
-
-
-
Method Detail
-
visit
default boolean visit(V tool, G graph)
Visits a graph, inspecting its structure and signature, but without accessing its contents. The default implementation does nothing and returnstrue
.- Parameters:
tool
- the auxiliary tool that this visitor can usegraph
- the graph being visited- Returns:
- whether or not the visiting should continue when this call
returns. If this method returns
false
, the visiting will be interrupted
-
visit
default boolean visit(V tool, G graph, N node)
Visits a node of the given graph. The default implementation does nothing and returnstrue
.- Parameters:
tool
- the auxiliary tool that this visitor can usegraph
- the graph where the visited node belongsnode
- the node being visited- Returns:
- whether or not the visiting should continue when this call
returns. If this method returns
false
, the visiting will be interrupted
-
visit
default boolean visit(V tool, G graph, E edge)
Visits an edge of the given graph. The default implementation does nothing and returnstrue
.- Parameters:
tool
- the auxiliary tool that this visitor can usegraph
- the graph where the visited edge belongsedge
- the edge being visited- Returns:
- whether or not the visiting should continue when this call
returns. If this method returns
false
, the visiting will be interrupted
-
visitSubNodesFirst
default boolean visitSubNodesFirst()
Yields whether or not, when visiting a compound node throughvisit(Object, Graph, Node)
, its sub-nodes should be visited before the node itself.- Returns:
true
if that condition holds
-
-