01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2002-2006, GeoTools Project Managment Committee (PMC)
05: * (C) 2002, Refractions Reserach Inc.
06: *
07: * This library is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU Lesser General Public
09: * License as published by the Free Software Foundation;
10: * version 2.1 of the License.
11: *
12: * This library is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * Lesser General Public License for more details.
16: */
17: package org.geotools.graph.structure;
18:
19: /**
20: * Represents an edge in Graph. An edge is an arc in a graph which
21: * connects exactly two nodes. These two nodes are referred to as
22: * the A node and the B node of the edge. The order of the A node and the B node
23: * is refered to as the <B>node orientation</B> of the edge.
24: *
25: * @see Node
26: * @see Graph
27: *
28: * @author Justin Deoliveira, Refractions Research Inc, jdeolive@refractions.net
29: *
30: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/extension/graph/src/main/java/org/geotools/graph/structure/Edge.java $
31: */
32: public interface Edge extends Graphable {
33:
34: /** flag to indicate equal node orientation of two edges **/
35: public static final int EQUAL_NODE_ORIENTATION = 0;
36:
37: /** flag to indicate unequal node orientation of two edges **/
38: public static final int UNEQUAL_NODE_ORIENTATION = 1;
39:
40: /** flag to indicate opposite node orientation of two edges **/
41: public static final int OPPOSITE_NODE_ORIENTATION = -1;
42:
43: /**
44: * Returns the A node of the edge.
45: *
46: * @return The A node.
47: */
48: public Node getNodeA();
49:
50: /**
51: * Returns the B node of the edge.
52: *
53: * @return The B node.
54: */
55: public Node getNodeB();
56:
57: /**
58: * Returns one of the two nodes of an edge. If the specified node is node A,
59: * then node B is returned, and vice versa.
60: *
61: * @param node The node opposite of the node to return.
62: *
63: * @return Node A if node B is specified, node B if node A is specified.
64: */
65: public Node getOtherNode(Node node);
66:
67: /**
68: * Reverses the node orientation of the edge.
69: */
70: public void reverse();
71:
72: /**
73: * Compares the node orientation of the edge with another edge.
74: *
75: * @return EQUAL_NODE_ORIENTATION : both nodes are equal in the correct order.
76: * UNEQUAL_NODE_ORIENTATION: both nodes are not equal
77: * OPPOSITE_NODE_ORIENTATION : both nodes are equal in opposite order.
78: */
79: public int compareNodes(Edge other);
80: }
|