1 pnkfelix 1.1.2.1 // DirectedGraph.java, created Thu Jul 20 15:34:24 2000 by pnkfelix 2 cananian 1.1.2.2 // Copyright (C) 2000 Felix S. Klock II <pnkfelix@mit.edu> 3 pnkfelix 1.1.2.1 // Licensed under the terms of the GNU GPL; see COPYING for details. 4 pnkfelix 1.1.2.1 package harpoon.Analysis.GraphColoring; 5 pnkfelix 1.1.2.1 6 pnkfelix 1.1.2.1 import java.util.Collection; 7 pnkfelix 1.1.2.1 8 pnkfelix 1.1.2.1 /** 9 pnkfelix 1.1.2.1 * <code>DirectedGraph</code> is an extension of the 10 pnkfelix 1.1.2.1 * <code>Graph</code> interface that tracks the direction of the edges 11 pnkfelix 1.1.2.1 * that have been added to the graph. This results in a stregthening 12 pnkfelix 1.1.2.1 * of the specification for several of <code>Graph</code>'s methods 13 pnkfelix 1.1.2.1 * and the addition of two new methods, <code>childrenOf(node)</code> 14 pnkfelix 1.1.2.1 * and <code>parentsOf(node)</code>. 15 pnkfelix 1.1.2.1 * 16 cananian 1.1.2.2 * @author Felix S. Klock II <pnkfelix@mit.edu> 17 cananian 1.2 * @version $Id: DirectedGraph.java,v 1.2 2002/02/25 20:57:17 cananian Exp $ 18 pnkfelix 1.1.2.1 */ 19 pnkfelix 1.1.2.1 public interface DirectedGraph extends Graph { 20 pnkfelix 1.1.2.1 21 pnkfelix 1.1.2.1 /** Ensures that this graph contains an edge from 22 pnkfelix 1.1.2.1 <code>f</code> to <code>t</code>. 23 pnkfelix 1.1.2.1 <BR> <B>modifies:</B> <code>this</code>. 24 pnkfelix 1.1.2.1 <BR> <B>effects:</B> If this method returns normally, an edge 25 pnkfelix 1.1.2.1 from <code>f</code> to <code>t</code> will be in 26 pnkfelix 1.1.2.1 <code>this</code>. Returns <tt>true</tt> if 27 pnkfelix 1.1.2.1 <code>this</code> changed as a result of the call. 28 pnkfelix 1.1.2.1 @throws IllegalArgumentException <code>f</code> or 29 pnkfelix 1.1.2.1 <code>t</code> is not present in the node set for 30 pnkfelix 1.1.2.1 <code>this</code>. 31 pnkfelix 1.1.2.1 @throws UnsupportedOperationException addEdge is not supported 32 pnkfelix 1.1.2.1 by this graph. 33 pnkfelix 1.1.2.1 */ 34 pnkfelix 1.1.2.1 boolean addEdge( Object f, Object t ); 35 pnkfelix 1.1.2.1 36 pnkfelix 1.1.2.1 /** Returns a collection view for the children of a specific node. 37 pnkfelix 1.1.2.1 <BR> <B>effects:</B> Returns an <code>Collection</code> view 38 pnkfelix 1.1.2.1 of nodes that have an edge from <code>node</code> to 39 pnkfelix 1.1.2.1 them. 40 pnkfelix 1.1.2.1 <BR> <B>mandates:</B> <code>node</code> is not removed from 41 pnkfelix 1.1.2.1 <code>this</code> while the returned 42 pnkfelix 1.1.2.1 <code>Collection</code> is in use. 43 pnkfelix 1.1.2.1 @throws IllegalArgumentException If <code>node</code> is not 44 pnkfelix 1.1.2.1 present in the node set for <code>this</code>. 45 pnkfelix 1.1.2.1 */ 46 pnkfelix 1.1.2.1 Collection childrenOf( Object node ); 47 pnkfelix 1.1.2.1 48 pnkfelix 1.1.2.1 49 pnkfelix 1.1.2.1 /** Returns a collection view for the parents of a specific node. 50 pnkfelix 1.1.2.1 <BR> <B>effects:</B> Returns a <code>Collection</code> view 51 pnkfelix 1.1.2.1 of nodes that have an edge from them to 52 pnkfelix 1.1.2.1 <code>node</code>. 53 pnkfelix 1.1.2.1 <BR> <B>mandates:</B> <code>node</code> is not removed from 54 pnkfelix 1.1.2.1 <code>this</code> while the returned 55 pnkfelix 1.1.2.1 <code>Collection</code> is in use. 56 pnkfelix 1.1.2.1 @throws IllegalArgumentException If <code>node</code> is not 57 pnkfelix 1.1.2.1 present in the node set for <code>this</code>. 58 pnkfelix 1.1.2.1 */ 59 pnkfelix 1.1.2.1 Collection parentsOf( Object node ); 60 pnkfelix 1.1.2.1 61 pnkfelix 1.1.2.1 /** Returns a collection view of the edges contained in this graph. 62 pnkfelix 1.1.2.1 <BR> <B>effects:</B> Returns a <code>Collection</code> of 63 pnkfelix 1.1.2.1 two-element <code>List</code>s (known as <i>pairs</i>) 64 pnkfelix 1.1.2.1 where each pair corresponds to an edge { n1, n2 } in 65 pnkfelix 1.1.2.1 this. If the graph is modified while an iteration over 66 pnkfelix 1.1.2.1 the collection is in progress, the results of the 67 pnkfelix 1.1.2.1 iteration are undefined. Order may or may not be 68 pnkfelix 1.1.2.1 significant in the pairs returned. 69 pnkfelix 1.1.2.1 */ 70 pnkfelix 1.1.2.1 Collection edges(); 71 pnkfelix 1.1.2.1 72 pnkfelix 1.1.2.1 /** Returns a collection view of the edges joining 73 pnkfelix 1.1.2.1 <code>node</code> to nodes in the graph. 74 pnkfelix 1.1.2.1 <BR> <B>effects:</B> Returns a <code>Collection</code> of 75 pnkfelix 1.1.2.1 two-element <code>List</code>s (known as 76 pnkfelix 1.1.2.1 <i>pairs</i>) where each pair corresponds to an edge 77 pnkfelix 1.1.2.1 [ node, n ] or [ n, node ] in this. If the graph is 78 pnkfelix 1.1.2.1 modified while an iteration over the collection is in 79 pnkfelix 1.1.2.1 progress, the results of the iteration are undefined. 80 pnkfelix 1.1.2.1 @throws IllegalArgumentException If <code>node</code> is not 81 pnkfelix 1.1.2.1 present in the node set for <code>this</code>. 82 pnkfelix 1.1.2.1 */ 83 pnkfelix 1.1.2.1 Collection edgesFor( Object node ); 84 pnkfelix 1.1.2.1 85 cananian 1.2 }