commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jvan...@apache.org
Subject cvs commit: jakarta-commons-sandbox/graph/src/java/org/apache/commons/graph/visitor DFSVisitor.java
Date Sat, 01 Dec 2001 19:12:14 GMT
jvanzyl     01/12/01 11:12:14

  Modified:    graph/src/java/org/apache/commons/graph/visitor
                        DFSVisitor.java
  Log:
  - making comments javadocs, adding some braces.
  
  Revision  Changes    Path
  1.2       +23 -4     jakarta-commons-sandbox/graph/src/java/org/apache/commons/graph/visitor/DFSVisitor.java
  
  Index: DFSVisitor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/graph/src/java/org/apache/commons/graph/visitor/DFSVisitor.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DFSVisitor.java	2001/11/29 14:17:34	1.1
  +++ DFSVisitor.java	2001/12/01 19:12:14	1.2
  @@ -65,22 +65,37 @@
    * this class (and of course its descendants) may be passed to a DFS
    * object.
    *
  - * @version $Id: DFSVisitor.java,v 1.1 2001/11/29 14:17:34 jvanzyl Exp $
  + * @version $Id: DFSVisitor.java,v 1.2 2001/12/01 19:12:14 jvanzyl Exp $
    * @author <A HREF="http://www.inf.fu-berlin.de/~dahm">M. Dahm</A> 
    * @see DFS
    */
   public class DFSVisitor extends DefaultVisitor {
  -  private int    time;  // Global time
  -  private VStack stack; // Stack to remember predecessors
  +  
  +  /**
  +   * Global time.
  +   */
  +  private int time;
  +  
  +  /**
  +   * Stack to remember predecessors.
  +   */
  +  private VStack stack;
   
  -  public DFSVisitor() {}
  +  /**
  +   * Default constructor.
  +   */
  +  public DFSVisitor()
  +  {
  +  }
   
     public void discoverGraph(Graph g) {
       int      size     = g.getNoVertices();
       Vertex[] vertices = g.getVertexArray();
   
       for(int i=0; i < size; i++)
  +    {
         vertices[i].setPredecessor(null);
  +    }              
   
       time  = 0; // Reset timer
       stack = new VStack(size);
  @@ -88,9 +103,13 @@
   
     public void discoverVertex(Vertex v) {
       if(stack.empty()) // First node
  +    {
         v.setPredecessor(null);
  +    }      
       else
  +    {
         v.setPredecessor(stack.top());
  +    }      
   
       stack.push(v);
       v.setDiscoveryTime(time++);
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message