1 /* UnaryConnector.java */
2
3 package org.quilt.graph;
4
5 /***
6 * A Connector holding a single edge.
7 *
8 * @author <a href="jddixon@users.sourceforge.net">Jim Dixon</a>
9 */
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 /*** Get the edge. */
20 public Edge getEdge() {
21 return edge;
22 }
23 // XXX Although the next two methods are labeled 'convenience
24 // method', it might be better to be less flexible. It
25 // never makes sense to have the source of an edge be anything
26 // other than the vertex it is attached to.
27
28 /*** Get the target of the connection. Convenience method. */
29 public Vertex getTarget () {
30 return edge.getTarget();
31 }
32 /*** Set the target of the connection. Convenience method. */
33 public void setTarget (Vertex v) {
34 edge.setTarget(v);
35 }
36 public int size () {
37 return 1;
38 }
39 }
This page was automatically generated by Maven