001: /*
002: * GeoTools - OpenSource mapping toolkit
003: * http://geotools.org
004: * (C) 2002-2006, GeoTools Project Managment Committee (PMC)
005: * (C) 2002, Refractions Reserach Inc.
006: *
007: * This library is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU Lesser General Public
009: * License as published by the Free Software Foundation;
010: * version 2.1 of the License.
011: *
012: * This library is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: */
017: package org.geotools.graph.structure;
018:
019: import java.util.List;
020:
021: /**
022: * Represents a node in a directed graph. A directed node differentiates
023: * between adjacent edges that start at the node and those adjacent edges that
024: * terminate at the node. The former are referred to as "<B>in</B>" edges, and
025: * the latter "<B>out</B>" edges.
026: *
027: * @see DirectedGraph
028: * @author Justin Deoliveira, Refractions Research Inc, jdeolive@refractions.net
029: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/extension/graph/src/main/java/org/geotools/graph/structure/DirectedNode.java $
030: */
031: public interface DirectedNode extends Node, DirectedGraphable {
032:
033: /**
034: * Adds an edge to the <B>in</B> adjacency list of the node.
035: *
036: * @param e A directed edge that terminates at the node.
037: *
038: * @see Node#add(Edge)
039: */
040: public void addIn(DirectedEdge e);
041:
042: /**
043: * Adds an edge to the <B>out</B> adjacency list of the node.
044: *
045: * @param e A directed edge that originates from the node.
046: *
047: * @see Node#add(Edge)
048: */
049: public void addOut(DirectedEdge e);
050:
051: /**
052: * Removes an edge from the <B>in</B> adjacency list of the node.
053: *
054: * @param e A directed edge that terminates at the node.
055: *
056: * @see Node#remove(Edge)
057: */
058: public void removeIn(DirectedEdge e);
059:
060: /**
061: * Removes an edge from the <B>out</B> adjacency list of node.
062: *
063: * @param e A directed edge that originates from the node.
064: *
065: * @see Node#remove(Edge)
066: */
067: public void removeOut(DirectedEdge e);
068:
069: /**
070: * Returns an edge that terminates at the node and originates from a
071: * specified node. <BR>
072: * <BR>
073: * Note: It is possible for two nodes to share multiple edges between them. In
074: * this case, getInEdges(Node other) can be used to obtain a complete list.
075: *
076: * @param other The originating node.
077: *
078: * @return The first edge found to terminate at the node and originate from
079: * the specefied node.
080: *
081: * @see Node#getEdge(Node)
082: */
083: public Edge getInEdge(DirectedNode other);
084:
085: /**
086: * Returns all edges that terminate at the node and originate from a
087: * specified node.
088: *
089: * @param other The originating node.
090: *
091: * @return All edges found to terminate at the node and originate from the
092: * specified node.
093: *
094: * @see Node#getEdges(Node)
095: */
096: public List getInEdges(DirectedNode other);
097:
098: /**
099: * Returns the <B>in</B> adjacency list of the node.
100: *
101: * @return A list of edges that terminate at the node.
102: *
103: * @see Node#getEdges()
104: */
105: public List getInEdges();
106:
107: /**
108: * Returns an edge that originates at the node and terminates at a
109: * specified node. <BR>
110: * <BR>
111: * Note: It is possible for two nodes to share multiple edges between them. In
112: * this case, getOutEdges(Node other) can be used to obtain a complete list.
113: *
114: * @param other The terminating node.
115: *
116: * @return The first edge found to originate at the node and terminate at
117: * the specefied node.
118: *
119: * @see Node#getEdge(Node)
120: */
121: public Edge getOutEdge(DirectedNode other);
122:
123: /**
124: * Returns all edges that originate at the node and terminate from at
125: * specified node.
126: *
127: * @param other The temimnating node.
128: *
129: * @return All edges found to originate at the node and terminate at the
130: * specified node.
131: *
132: * @see Node#getEdges(Node)
133: */
134: public List getOutEdges(DirectedNode other);
135:
136: /**
137: * Returns the <B>out</B> adjacency list of the node.
138: *
139: * @return A list of edges originating at the node.
140: *
141: * @see Node#getEdges()
142: */
143: public List getOutEdges();
144:
145: /**
146: * Returns the <B>in</B> degree of the node.
147: *
148: * @return The number of edges that terminate at the node.
149: */
150: public int getInDegree();
151:
152: /**
153: * Returns the <B>out</B> degree of the node.
154: *
155: * @return The number of edges that originate at the node.
156: */
157: public int getOutDegree();
158:
159: }
|