KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > edu > umd > cs > findbugs > graph > DepthFirstSearch


1 /*
2  * Generic graph library
3  * Copyright (C) 2000,2003,2004 University of Maryland
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  */

19
20 package edu.umd.cs.findbugs.graph;
21
22 import java.util.Iterator JavaDoc;
23
24 /**
25  * Perform a forward depth first search of a graph.
26  *
27  * @author David Hovemeyer
28  * @see Graph
29  * @see AbstractDepthFirstSearch
30  */

31 public class DepthFirstSearch
32         <
33         GraphType extends Graph<EdgeType, VertexType>,
34         EdgeType extends GraphEdge<EdgeType, VertexType>,
35         VertexType extends GraphVertex<VertexType>
36         >
37     extends AbstractDepthFirstSearch<GraphType, EdgeType, VertexType> {
38
39     /**
40      * Constructor.
41      *
42      * @param graph the graph to perform a depth first search of
43      */

44     public DepthFirstSearch(GraphType graph) {
45         super(graph);
46     }
47
48     @Override JavaDoc
49          protected Iterator JavaDoc<EdgeType> outgoingEdgeIterator(GraphType graph, VertexType vertex) {
50         return graph.outgoingEdgeIterator(vertex);
51     }
52
53     @Override JavaDoc
54          protected VertexType getTarget(EdgeType edge) {
55         return edge.getTarget();
56     }
57
58     @Override JavaDoc
59          protected VertexType getSource(EdgeType edge) {
60         return edge.getSource();
61     }
62
63 }
64
65 // vim:ts=4
66
Popular Tags