01: /* UnaryConnector.java */
02:
03: package org.quilt.graph;
04:
05: /**
06: * A Connector holding a single edge.
07: *
08: * @author <a href="jddixon@users.sourceforge.net">Jim Dixon</a>
09: */
10: public class UnaryConnector extends Connector {
11: private Edge edge;
12:
13: public UnaryConnector(Edge e) {
14: if (e == null) {
15: throw new IllegalArgumentException("null edge");
16: }
17: edge = e;
18: }
19:
20: /** Get the edge. */
21: public Edge getEdge() {
22: return edge;
23: }
24:
25: // XXX Although the next two methods are labeled 'convenience
26: // method', it might be better to be less flexible. It
27: // never makes sense to have the source of an edge be anything
28: // other than the vertex it is attached to.
29:
30: /** Get the target of the connection. Convenience method. */
31: public Vertex getTarget() {
32: return edge.getTarget();
33: }
34:
35: /** Set the target of the connection. Convenience method. */
36: public void setTarget(Vertex v) {
37: edge.setTarget(v);
38: }
39:
40: public int size() {
41: return 1;
42: }
43: }
|