/** * Node.java * * * Created: Fri Mar 31 09:16:17 2000 * * @author Hans Kyndesgaard * @version 1 */ public class Node { Sequence out; Sequence in; String name; public Node() { out = new Sequence(); in = new Sequence(); } /** @param name You can give each node a name. This name can be very handy when debugging. O(1). */ public Node(String name) { out = new Sequence(); in = new Sequence(); this.name = name; } /** @return an enumeration of all the edges going out of this node. O(1). */ public java.util.Enumeration outEdges(){ return out.elements(); } /** @return an enumeration of all the edges going in to this node. O(1). */ public java.util.Enumeration inEdges(){ return in.elements(); } /** @return the number of edges going into this node. O(1). */ public int inDegree(){ return in.size(); } /** @return the number of edges going out of this node. O(1) */ public int outDegree(){ return out.size(); } /** The string representation is just the given name. O(1) */ public String toString(){ return name; } } // Node