Source code: com/port80/graph/IEdge.java
1 //
2 // Copyright(c) 2002, Chris Leung
3 //
4
5 package com.port80.graph;
6
7 import java.util.List;
8
9 /** Graph edge interface.
10 *
11 * . Each edge has a name, a head node, a tail node and an attribute
12 * table. For directed graph, head is the destination node (one
13 * with arrow head) and tail is the source node.
14 *
15 * . Edges are created and destroyed by EdgeFactory or its
16 * derivatives. Creating an edge automatically perform all the book
17 * keeping works to check for validity and connect the two vertex
18 * (adding the edge to both vertex). If an edge is not valid,
19 * EdgeFactory return null. Destroy an edge remove the connections
20 * at both vertex.
21 *
22 * . Attribute registry
23 * The EdgeFactory maintain a registry of valid attributes for
24 * edges produced by the factory. Clients that invent their own
25 * attributes should register the attribute name with the class and
26 * check for conflicts during initialization.
27 *
28 * . No checking for valid attribute name is done when accessing the
29 * attribute table.
30 */
31 public interface IEdge extends IGraphElement {
32
33 ////////////////////////////////////////////////////////////////////////
34
35 /** The set of all edges, the Set should be considered read only.
36 * Add or remove of edges should use method provided by the Edge
37 * class.
38 */
39 IVertex getHead();
40 IVertex getTail();
41 IVertex getOpposite(IVertex node);
42
43 double getArrowSize();
44 IArrow getHeadArrow();
45 IArrow getTailArrow();
46
47 /**
48 * @return All edges in the reverse direction if one exists, otherwise null.
49 */
50 List findReverseEdges(List ret);
51
52 void clearLayout();
53
54 ////////////////////////////////////////////////////////////////////////
55
56 }