Coverage Report - net.sourceforge.combean.interfaces.graph.alg.spath.CycleInPredMapDetectionAlg
 
Classes in this File Line Coverage Branch Coverage Complexity
CycleInPredMapDetectionAlg
N/A
N/A
1
 
 1  
 /*
 2  
     This file is part of Combean.
 3  
 
 4  
     Combean is free software; you can redistribute it and/or modify
 5  
     it under the terms of the GNU General Public License as published by
 6  
     the Free Software Foundation; either version 2 of the License, or
 7  
     (at your option) any later version.
 8  
 
 9  
     Combean is distributed in the hope that it will be useful,
 10  
     but WITHOUT ANY WARRANTY; without even the implied warranty of
 11  
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 12  
     GNU General Public License for more details.
 13  
 
 14  
     You should have received a copy of the GNU General Public License
 15  
     along with Combean; if not, write to the Free Software
 16  
     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 17  
 */
 18  
 /*
 19  
  * Created on 17.04.2005
 20  
  *
 21  
  */
 22  
 package net.sourceforge.combean.interfaces.graph.alg.spath;
 23  
 
 24  
 import net.sourceforge.combean.interfaces.graph.Node;
 25  
 import net.sourceforge.combean.interfaces.graph.alg.GraphAlgorithm;
 26  
 import net.sourceforge.combean.interfaces.graph.containers.FixedNodeMap;
 27  
 import net.sourceforge.combean.interfaces.graph.containers.FixedPath;
 28  
 import net.sourceforge.combean.interfaces.graph.containers.Path;
 29  
 
 30  
 /**
 31  
  * An algorithm to detect a cycle in a graph given by a predecessor map
 32  
  * (occurs as subproblem when negative cycles in shortest path trees shall
 33  
  * be identified).
 34  
  * 
 35  
  * @author schickin
 36  
  *
 37  
  */
 38  
 public interface CycleInPredMapDetectionAlg extends GraphAlgorithm {
 39  
     
 40  
     /**
 41  
      * The predecessor map defining the graph where the cycle shall be found.
 42  
      * 
 43  
      * @param predMap a node map which contains the predecessor of every node
 44  
      * (or null of a node has no predecessor)
 45  
      */
 46  
     public void setPredMap(FixedNodeMap predMap);
 47  
 
 48  
     /**
 49  
      * Search for cycles starting from a single start node.
 50  
      * 
 51  
      * If this method is called, only the predecessors of the given node
 52  
      * are checked for containing a cycle. Otherwise, the complete node
 53  
      * map is checked. For this variant of the algorithm the global nodes
 54  
      * property is not required.
 55  
      * 
 56  
      * @param startNode the node where the search for cycles shall be started
 57  
      */
 58  
     public void setSingleStartNode(Node startNode);
 59  
 
 60  
     /**
 61  
      * Optional. Set a Path object which shall be filled with the cycle found
 62  
      * (if any).
 63  
      * 
 64  
      * @param p the path where the cycle shall be stored
 65  
      */
 66  
     public void setPathForCycle(Path p);
 67  
 
 68  
     /**
 69  
      * Check whether a cycle has been found (must be called after run()).
 70  
      * 
 71  
      * @return true if the algorithm has detected a cycle.
 72  
      */
 73  
     public boolean cycleFound();
 74  
     
 75  
     /**
 76  
      * Retrieve the cycle that has been found.
 77  
      * May only be called if cycleFound() returns true.
 78  
      * 
 79  
      * @return the cycle which has been found.
 80  
      */
 81  
     public FixedPath getCycle();
 82  
 }