01: /* Entry.java */
02:
03: package org.quilt.graph;
04:
05: import org.quilt.exception.QuiltException;
06:
07: /**
08: * The entry vertex in a directed graph.
09: *
10: * @author < a href="jddixon@users.sourceforge.net">Jim Dixon</a>
11: */
12:
13: public class Entry extends Vertex {
14:
15: public Entry(Directed g) {
16: if (g == null) {
17: throw new IllegalArgumentException("null graph");
18: }
19: graph = g;
20: index = g.anotherVertex(this );
21: Edge edge = new Edge(this , this );
22: connector = new UnaryConnector(edge);
23: edge.insert(new Exit(g));
24: }
25:
26: // ACCESSOR METHODS /////////////////////////////////////////////
27: public Connector getConnector() {
28: return connector;
29: }
30:
31: public Edge getEdge() {
32: return connector.getEdge();
33: }
34:
35: // OTHER METHODS ////////////////////////////////////////////////
36: public Vertex getTarget() {
37: return connector.getTarget();
38: }
39:
40: public void setTarget(Vertex v) {
41: checkForNull(v, "target");
42: if (v.getGraph() != graph) {
43: throw new IllegalArgumentException(
44: "target must be in same graph");
45: }
46: ((UnaryConnector) connector).setTarget(v);
47: }
48:
49: public String toString() {
50: return "Entry " + super.toString();
51: }
52: }
|