procope.data.networks
Interface NetworkSearchCallback


public interface NetworkSearchCallback

This interface must be implemented by classes which function as callback adapter for the network search functions ProteinNetwork.depthFirstSearch(int, NetworkSearchCallback) and ProteinNetwork.breadthFirstSearch(int, NetworkSearchCallback). A callback adapter has two functions: (1) It receives the nodes passed during the network search in the order they are visited and (2) it can stop the network search at any point.

Example

The interface can be implemented by any class or inner class. A quick way to write a callback adapter is to use an anonymous inner class:

net.depthFirstSearch(1, new NetworkSearchCallback() {
     public boolean reportNode(int protein) {
         System.out.println("Passed node: " + protein);
         if (/*we want to go on*/)
             return true;
         else // stop the search
             return false;
     }
 });

Author:
Jan Krumsiek

Method Summary
 boolean reportNode(int protein)
          Implemented by network search callback adapters.
 

Method Detail

reportNode

boolean reportNode(int protein)
Implemented by network search callback adapters. Receives each protein passed during the search and returns whether the search should go on.

Parameters:
protein - protein which was just passed in the network search
Returns:
true if the search should go on, false to stop the search