Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
IncidentEdgeAsOutgoingEdgeIterator |
|
| 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 19.03.2005 | |
20 | * | |
21 | */ | |
22 | package net.sourceforge.combean.graph.iterators; | |
23 | ||
24 | import net.sourceforge.combean.interfaces.graph.Edge; | |
25 | import net.sourceforge.combean.interfaces.graph.EdgeIterator; | |
26 | import net.sourceforge.combean.interfaces.graph.Node; | |
27 | import net.sourceforge.combean.interfaces.graph.prop.NeighborhoodGraphProp; | |
28 | ||
29 | /** | |
30 | * Traverse only outgoing edges of a incident edge iterator | |
31 | * | |
32 | * @author schickin | |
33 | * | |
34 | */ | |
35 | public final class IncidentEdgeAsOutgoingEdgeIterator | |
36 | extends AbstractFilteringEdgeIterator { | |
37 | ||
38 | 21 | private NeighborhoodGraphProp g = null; |
39 | 21 | private Node source = null; |
40 | ||
41 | /** | |
42 | * Constructor | |
43 | * | |
44 | * @param g the underlying graph | |
45 | * @param source the node where the outgoing edges shall be traversed | |
46 | * @param itEdge an iterator through all incident edges of source | |
47 | */ | |
48 | public IncidentEdgeAsOutgoingEdgeIterator(NeighborhoodGraphProp g, | |
49 | Node source, | |
50 | EdgeIterator itEdge) { | |
51 | 21 | super(itEdge); |
52 | ||
53 | 21 | this.g = g; |
54 | 21 | this.source = source; |
55 | 21 | } |
56 | ||
57 | /* (non-Javadoc) | |
58 | * @see net.sourceforge.combean.graph.util.FilteringEdgeIterator#filterMatches(net.sourceforge.combean.interfaces.graph.Edge) | |
59 | */ | |
60 | protected final boolean isVisible(Edge e) { | |
61 | 45 | return this.g.getFirstNode(e).equals(this.source); |
62 | } | |
63 | } |