Salt  3.4.2
A powerful, tagset-independent and theory-neutral meta model and API for storing, manipulating, and representing nearly all types of linguistic data .
org.corpus_tools.salt.core.GraphTraverseHandler Interface Reference

The interface of a callback handler for traversing a Graph object. More...

Inherited by org.corpus_tools.salt.util.internal.persistence.dot.SCorpusGraphDOTWriter, org.corpus_tools.salt.util.internal.persistence.dot.SDocumentGraphDOTWriter, and org.corpus_tools.salt.util.VisJsVisualizer.

Public Member Functions

void nodeReached (GRAPH_TRAVERSE_TYPE traversalType, String traversalId, SNode currNode, SRelation< SNode, SNode > relation, SNode fromNode, long order)
 This method will be invoked, when a node is reached, after the method checkConstraint(GRAPH_TRAVERSE_TYPE, String, SRelation, SNode, long) has returned true and before the method nodeLeft(GRAPH_TRAVERSE_TYPE, String, SNode, SRelation, SNode, long) is invoked. More...
 
void nodeLeft (GRAPH_TRAVERSE_TYPE traversalType, String traversalId, SNode currNode, SRelation< SNode, SNode > relation, SNode fromNode, long order)
 This method will be invoked, when a node is left, after the method checkConstraint(GRAPH_TRAVERSE_TYPE, String, SRelation, SNode, long) has returned true and the method nodeReached(GRAPH_TRAVERSE_TYPE, String, SNode, SRelation, SNode, long) has been invoked. More...
 
boolean checkConstraint (GRAPH_TRAVERSE_TYPE traversalType, String traversalId, SRelation< SNode, SNode > relation, SNode currNode, long order)
 This method is called during a traversal to check if the current node and eventually its sub-graph shall be traversed or not. More...
 

Detailed Description

The interface of a callback handler for traversing a Graph object.

When invoking the method Graph#traverse(org.eclipse.emf.common.util.EList, GRAPH_TRAVERSE_TYPE, String, GraphTraverseHandler) an object implementing this interface must be passed. This interface contains three methods checkConstraint(GRAPH_TRAVERSE_TYPE, String, Relation, Node, long), nodeReached(GRAPH_TRAVERSE_TYPE, String, Node, Relation, Node, long) and nodeLeft(GRAPH_TRAVERSE_TYPE, String, Node, Relation, Node, long). If the traversal reaches a new Node object being contained in the Graph object, the method checkConstraint(GRAPH_TRAVERSE_TYPE, String, Relation, Node, long) will be invoked. If this method returns true, it means that this node and eventually its sub-graph will also be traversed. When true is returned, the method nodeReached(GRAPH_TRAVERSE_TYPE, String, Node, Relation, Node, long) will be invoked, when reaching the node and nodeLeft(GRAPH_TRAVERSE_TYPE, String, Node, Relation, Node, long) when leaving the node.

Author
Florian Zipser

Member Function Documentation

◆ checkConstraint()

boolean org.corpus_tools.salt.core.GraphTraverseHandler.checkConstraint ( GRAPH_TRAVERSE_TYPE  traversalType,
String  traversalId,
SRelation< SNode, SNode relation,
SNode  currNode,
long  order 
)

This method is called during a traversal to check if the current node and eventually its sub-graph shall be traversed or not.

If the return value is false, the traversal for the current path, will stop at the current node and the methods nodeReached(GRAPH_TRAVERSE_TYPE, String, SNode, SRelation, SNode, long) and nodeLeft(GRAPH_TRAVERSE_TYPE, String, SNode, SRelation, SNode, long) as well will not be invoked. Otherwise the method nodeReached(GRAPH_TRAVERSE_TYPE, String, SNode, SRelation, SNode, long) will be invoked, when a new node is reached and nodeLeft(GRAPH_TRAVERSE_TYPE, String, SNode, SRelation, SNode, long) will be invoked, when this node is left.

Parameters
traversalTypethe type of current traversal
traversalIdthe id of current traversal, given by the invoking object
relationthe relation via which the current node was reached
currNodethe current node
orderthe number of the relation in the parent node

Implemented in org.corpus_tools.salt.util.internal.persistence.dot.SDocumentGraphDOTWriter.

◆ nodeLeft()

void org.corpus_tools.salt.core.GraphTraverseHandler.nodeLeft ( GRAPH_TRAVERSE_TYPE  traversalType,
String  traversalId,
SNode  currNode,
SRelation< SNode, SNode relation,
SNode  fromNode,
long  order 
)

This method will be invoked, when a node is left, after the method checkConstraint(GRAPH_TRAVERSE_TYPE, String, SRelation, SNode, long) has returned true and the method nodeReached(GRAPH_TRAVERSE_TYPE, String, SNode, SRelation, SNode, long) has been invoked.

Parameters
traversalTypethe type of current traversal
traversalIdthe id of current traversal, given by the invoking object
currNodethe current node
relationthe relation via which the current node was reached
fromNodethe parent node
orderthe number of the relation in the parent node

Implemented in org.corpus_tools.salt.util.internal.persistence.dot.SDocumentGraphDOTWriter.

◆ nodeReached()

void org.corpus_tools.salt.core.GraphTraverseHandler.nodeReached ( GRAPH_TRAVERSE_TYPE  traversalType,
String  traversalId,
SNode  currNode,
SRelation< SNode, SNode relation,
SNode  fromNode,
long  order 
)

This method will be invoked, when a node is reached, after the method checkConstraint(GRAPH_TRAVERSE_TYPE, String, SRelation, SNode, long) has returned true and before the method nodeLeft(GRAPH_TRAVERSE_TYPE, String, SNode, SRelation, SNode, long) is invoked.

Parameters
traversalTypethe type of current traversal
traversalIdthe id of current traversal, given by the invoking object
currNodethe current node
relationthe relation via which the current node was reached
fromNodethe parent node
orderthe number of the relation in the parent node