KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > soot > toolkits > graph > MutableDirectedGraph


1 /* Soot - a J*va Optimization Framework
2  * Copyright (C) 1999 Patrice Pominville, Raja Vallee-Rai, Patrick Lam
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library 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 GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */

19
20 /*
21  * Modified by the Sable Research Group and others 1997-1999.
22  * See the 'credits' file distributed with Soot for the complete list of
23  * contributors. (Soot is distributed at http://www.sable.mcgill.ca/soot)
24  */

25
26
27 package soot.toolkits.graph;
28
29 import java.util.*;
30 import soot.*;
31
32
33
34 /**
35  * Defines a DirectedGraph which is modifiable. Provides
36  * an interface to add/delete nodes and edges.
37  */

38
39 public interface MutableDirectedGraph extends DirectedGraph
40 {
41     /**
42      * Adds an edge to the graph between 2 nodes.
43      * If the edge is already present no change is made.
44      * @param from out node for the edge.
45      * @param to in node for the edge.
46      */

47     public void addEdge(Object JavaDoc from, Object JavaDoc to);
48
49
50
51     /**
52      * Removes an edge between 2 nodes in the graph.
53      * If the edge is not present no change is made.
54      * @param from out node for the edge to remove.
55      * @param to in node for the edge to remove.
56      */

57     public void removeEdge(Object JavaDoc from, Object JavaDoc to);
58
59
60     /** @return true if the graph contains an edge the 2 nodes
61      * false otherwise.
62      */

63     public boolean containsEdge(Object JavaDoc from, Object JavaDoc to);
64
65     /** @return a list of the nodes that compose the graph. No ordering is implied.*/
66     public List getNodes();
67
68     /**
69      * Adds a node to the graph. Initially the added node has no successors or predecessors.
70      * ; as a consequence it is considered both a head and tail for the graph.
71      * @param node a node to add to the graph.
72      * @see #getHeads
73      * @see #getTails
74      */

75     public void addNode(Object JavaDoc node);
76
77     /**
78      * Removes a node from the graph. If the node is not
79      * found in the graph, no change is made.
80      * @param node the node to be removed.
81      */

82     public void removeNode(Object JavaDoc node);
83
84     /**
85      * @param node node that we want to know if the graph constains.
86      * @return true if the graph contains the node.
87      * false otherwise.
88      */

89     public boolean containsNode(Object JavaDoc node);
90 }
91
92  
93
94
95
96
97
98
Popular Tags