View Javadoc
1 /* Exit.java */ 2 3 package org.quilt.graph; 4 5 import org.quilt.exception.QuiltException; 6 7 /*** 8 * An exit vertex in a directed graph. This vertex always has an 9 * index of 1. 10 * 11 * @author <a href="jddixon@users.sourceforge.net">Jim Dixon</a> 12 */ 13 public class Exit extends Vertex { 14 15 /*** 16 * Constructor for the exit vertex for a Quilt directed graph. 17 * This may be a subgraph. Only the entry vertex should use 18 * this constructor. 19 * 20 * @param g Reference to the parent Directed graph. 21 */ 22 protected Exit (Directed g) { 23 checkForNull(g, "graph"); 24 graph = g; 25 index = g.anotherVertex(this); 26 connector = new UnaryConnector (new Edge(this,this) ); 27 } 28 29 // ACCESSOR METHODS ///////////////////////////////////////////// 30 /*** 31 * Get the connection, back to the entry vertex in a top-level 32 * graph. XXX Perhaps we don't want to implement this. 33 */ 34 public Connector getConnector () { 35 return connector; 36 } 37 // CONVENIENCE METHODS ////////////////////////////////////////// 38 /*** Get the outgoing edge. */ 39 public Edge getEdge() { 40 return ((UnaryConnector)connector).getEdge(); 41 } 42 /*** Get its target. */ 43 public Vertex getTarget() { 44 return ((UnaryConnector)connector).getTarget(); 45 } 46 /*** Set its target. */ 47 public void setTarget(Vertex v) { 48 checkForNull (v, "target"); 49 if ( graph == v.getGraph() ) { 50 throw new IllegalArgumentException( 51 "target of exit must be in different graph"); 52 } 53 ((UnaryConnector)connector).setTarget(v); 54 } 55 // OTHER METHODS //////////////////////////////////////////////// 56 public String toString () { 57 return "Exit " + super.toString(); 58 } 59 }

This page was automatically generated by Maven