protected void processNode ( Node current ) { // Do not process the node if it is ubique if ( current . isUbique ( ) ) { setColor ( current , BLACK ) ; return ; } // System.out.println("processing = " + current); // Process edges towards the direction for ( Edge edge : direction == Direction . DOWNSTREAM ? current . getDownstream ( ) : current . getUpstream ( ) ) { assert edge != null ; // Label the edge considering direction of traversal and type of current node if ( direction == Direction . DOWNSTREAM || ! current . isBreadthNode ( ) ) { setLabel ( edge , getLabel ( current ) ) ; } else { setLabel ( edge , getLabel ( current ) + 1 ) ; } // Get the other end of the edge Node neigh = direction == Direction . DOWNSTREAM ? edge . getTargetNode ( ) : edge . getSourceNode ( ) ; assert neigh != null ; // Decide neighbor label according to the search direction and node type int dist = getLabel ( edge ) ; if ( neigh . isBreadthNode ( ) && direction == Direction . DOWNSTREAM ) dist ++ ; // Check if we need to stop traversing the neighbor, enqueue otherwise boolean further = ( stopSet == null || ! isEquivalentInTheSet ( neigh , stopSet ) ) && ( ! neigh . isBreadthNode ( ) || dist < limit ) && ! neigh . isUbique ( ) ; // Process the neighbor if not processed or not in queue if ( getColor ( neigh ) == WHITE ) { // Label the neighbor setLabel ( neigh , dist ) ; if ( further ) { setColor ( neigh , GRAY ) ; // Enqueue the node according to its type if ( neigh . isBreadthNode ( ) ) { queue . addLast ( neigh ) ; } else { // Non-breadth nodes are added in front of the queue queue . addFirst ( neigh ) ; } } else { // If we do not want to traverse this neighbor, we paint it black setColor ( neigh , BLACK ) ; } } labelEquivRecursive ( neigh , UPWARD , getLabel ( neigh ) , further , ! neigh . isBreadthNode ( ) ) ; labelEquivRecursive ( neigh , DOWNWARD , getLabel ( neigh ) , further , ! neigh . isBreadthNode ( ) ) ; } }
Processes a node .