Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
NodePairEdge |
|
| 1.0;1 |
1 | /* | |
2 | This file is part of Combean. | |
3 | ||
4 | Combean is free software; you can redistribute it and/or modify | |
5 | it under the terms of the GNU General Public License as published by | |
6 | the Free Software Foundation; either version 2 of the License, or | |
7 | (at your option) any later version. | |
8 | ||
9 | Combean is distributed in the hope that it will be useful, | |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | GNU General Public License for more details. | |
13 | ||
14 | You should have received a copy of the GNU General Public License | |
15 | along with Combean; if not, write to the Free Software | |
16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
17 | */ | |
18 | /* | |
19 | * Created on 14.01.2005 | |
20 | * | |
21 | */ | |
22 | package net.sourceforge.combean.graph; | |
23 | ||
24 | import net.sourceforge.combean.interfaces.graph.Edge; | |
25 | import net.sourceforge.combean.interfaces.graph.Node; | |
26 | ||
27 | /** | |
28 | * An implementation of the Edge interface where each edge is simply represented | |
29 | * by two nodes. | |
30 | * | |
31 | * @author schickin | |
32 | * | |
33 | */ | |
34 | public class NodePairEdge implements Edge { | |
35 | ||
36 | private Node firstNode; | |
37 | private Node secondNode; | |
38 | ||
39 | /** | |
40 | * Construct an edge. | |
41 | * | |
42 | * @param firstNode | |
43 | * @param secondNode | |
44 | */ | |
45 | public NodePairEdge(Node firstNode, Node secondNode) { | |
46 | 603 | super(); |
47 | ||
48 | 603 | this.firstNode = firstNode; |
49 | 603 | this.secondNode = secondNode; |
50 | 603 | } |
51 | ||
52 | /** | |
53 | * Get the first node of the edge. For directed edges this is the source. | |
54 | * For undirected edges the ordering of the nodes is arbitrary. | |
55 | * | |
56 | * @return Returns the firstNode. | |
57 | */ | |
58 | public final Node getFirstNode() { | |
59 | 669 | return this.firstNode; |
60 | } | |
61 | ||
62 | /** | |
63 | * Get the second node of the edge. For directed edges this is the target. | |
64 | * For undirected edges the ordering of the nodes is arbitrary. | |
65 | * | |
66 | * @return Returns the secondNode. | |
67 | */ | |
68 | public final Node getSecondNode() { | |
69 | 633 | return this.secondNode; |
70 | } | |
71 | } |