public Edge addEdge()

in graph/src/main/java/org/apache/archiva/components/graph/base/DirectedGraph.java [143:168]


    public Edge<V> addEdge( final RelationType type, final String id, final String label,
                            final V sourceNode, final V destinationNode ) throws IllegalArgumentException
    {
        if ( sourceNode == null )
        {
            throw new IllegalArgumentException( "Source node may not be null" );
        }
        if ( destinationNode == null )
        {
            throw new IllegalArgumentException( "Destination node may not be null" );
        }
        Edge<V> edge;
        if ( this.edges.containsKey( id ) )
        {
            log.debug( "Edge found " + id );
            edge = this.edges.get( id );
        }
        else
        {
            edge = createNewEdge( type, id, sourceNode, destinationNode );
            this.edges.put( id, edge );
        }
        edge.setLabel( label );
        log.debug( "Adding edge " + edge.toString( ) );
        return edge;
    }