Logo Search packages:      
Sourcecode: libjgrapht-java version File versions  Download package

Edge org::_3pq::jgrapht::graph::AbstractBaseGraph::UndirectedSpecifics::getEdge ( Object  sourceVertex,
Object  targetVertex 
) [inline, virtual]

See also:
Graph::getEdge(Object, Object)

Implements org::_3pq::jgrapht::graph::AbstractBaseGraph::Specifics.

Definition at line 982 of file AbstractBaseGraph.java.

References org::_3pq::jgrapht::graph::AbstractBaseGraph::containsVertex(), getEdgeContainer(), org::_3pq::jgrapht::Edge::getSource(), org::_3pq::jgrapht::Edge::getTarget(), and org::_3pq::jgrapht::graph::AbstractBaseGraph::UndirectedEdgeContainer::m_vertexEdges.

                                                                        {
            if( containsVertex( sourceVertex )
                    && containsVertex( targetVertex ) ) {
                Iterator iter =
                    getEdgeContainer( sourceVertex ).m_vertexEdges.iterator(  );

                while( iter.hasNext(  ) ) {
                    Edge    e = (Edge) iter.next(  );

                    boolean equalStraight =
                        sourceVertex.equals( e.getSource(  ) )
                        && targetVertex.equals( e.getTarget(  ) );

                    boolean equalInverted =
                        sourceVertex.equals( e.getTarget(  ) )
                        && targetVertex.equals( e.getSource(  ) );

                    if( equalStraight || equalInverted ) {
                        return e;
                    }
                }
            }

            return null;
        }


Generated by  Doxygen 1.6.0   Back to index