/** A representation of an edge. Created: Fri Mar 31 09:31:36 2000 @author Hans Kyndesgaard @version 1 */ public class Edge { Node from; Node to; Locator fromLocator; Locator toLocator; /** Creates an edge from the <code>from</code>-node to the <code>to</code>-node. Even though the two nodes are adjacent an edge will be made between them. <i>O</i>(<i>1</i>). @param from The origin of the newly created edge. @param to The destination of the newly created edge. */ public Edge(Node from, Node to) { this.from = from; this.to = to; fromLocator = from.out.insertLast(this); toLocator = to.in.insertLast(this); } /** Removes <code>this</code> edge. The data structures in the nodes are updated accordingly. <i>O</i>(<i>1</i>). */ public void remove(){ from.out.remove(fromLocator); to.in.remove(toLocator); } /** Produce a stringrepresentation of a edge. This is just a pair of node representations. <i>O</i>(<i>1</i>). */ public String toString(){ return "(" + from + ", " + to + ")"; } } // Edge