private E loadEdge(KeyedGraph<V, E> graph, ResultSet edges) throws SQLException {
        final int startNode = edges.getInt(startNodeIndex);
        final int endNode = edges.getInt(endNodeIndex);
        final int edgeID = edges.getInt(edgeIDIndex);
        double weight = WeightedGraph.DEFAULT_EDGE_WEIGHT;
        if (weightColumnIndex != -1) {
            weight = edges.getDouble(weightColumnIndex);
        }
        E edge;
        // Undirected graphs are either pseudographs or weighted pseudographs,
        // so there is no need to add edges in both directions.
        if (globalOrientation.equals(GraphFunctionParser.Orientation.UNDIRECTED)) {
            edge = graph.addEdge(endNode, startNode, edgeID);
        } else {
            // Directed graphs are either directed pseudographs or directed
            // weighted pseudographs and must specify an orientation for each
            // individual edge. If no orientations are specified, every edge
            // is considered to be directed with orientation given by the
            // geometry.
            int edgeOrientation = (edgeOrientationIndex == -1)
                    ? DIRECTED_EDGE
                    : edges.getInt(edgeOrientationIndex);
            if (edges.wasNull()) {
                throw new IllegalArgumentException("Invalid edge orientation: NULL.");
            }
            if (edgeOrientation == UNDIRECTED_EDGE) {
                if (globalOrientation.equals(GraphFunctionParser.Orientation.DIRECTED)) {
                    edge = loadDoubleEdge(graph, startNode, endNode, edgeID, weight);
                } // globalOrientation == Orientation.REVERSED
                else {
                    edge = loadDoubleEdge(graph, endNode, startNode, edgeID, weight);
                }
            } else if (edgeOrientation == DIRECTED_EDGE) {
                // Reverse a directed edge (global).
                if (globalOrientation.equals(GraphFunctionParser.Orientation.REVERSED)) {
                    edge = graph.addEdge(endNode, startNode, edgeID);
                } // No reversal.
                else {
                    edge = graph.addEdge(startNode, endNode, edgeID);
                }
            } else if (edgeOrientation == REVERSED_EDGE) {
                // Reversing twice is the same as no reversal.
                if (globalOrientation.equals(GraphFunctionParser.Orientation.REVERSED)) {
                    edge = graph.addEdge(startNode, endNode, edgeID);
                } // Otherwise reverse just once (local).
                else {
                    edge = graph.addEdge(endNode, startNode, edgeID);
                }
            } else {
                throw new IllegalArgumentException("Invalid edge orientation: " + edgeOrientation);
            }
        }
        setEdgeWeight(edge, weight);
        return edge;
    }
private E loadEdge ( KeyedGraph < V , E > graph , ResultSet edges ) throws SQLException { final int startNode = edges . getInt ( startNodeIndex ) ; final int endNode = edges . getInt ( endNodeIndex ) ; final int edgeID = edges . getInt ( edgeIDIndex ) ; double weight = WeightedGraph . DEFAULT_EDGE_WEIGHT ; if ( weightColumnIndex != - 1 ) { weight = edges . getDouble ( weightColumnIndex ) ; } E edge ; if ( globalOrientation . equals ( GraphFunctionParser . Orientation . UNDIRECTED ) ) { edge = graph . addEdge ( endNode , startNode , edgeID ) ; } else { int edgeOrientation = ( edgeOrientationIndex == - 1 ) ? DIRECTED_EDGE : edges . getInt ( edgeOrientationIndex ) ; if ( edges . wasNull ( ) ) { throw new IllegalArgumentException ( "Invalid edge orientation: NULL." ) ; } if ( edgeOrientation == UNDIRECTED_EDGE ) { if ( globalOrientation . equals ( GraphFunctionParser . Orientation . DIRECTED ) ) { edge = loadDoubleEdge ( graph , startNode , endNode , edgeID , weight ) ; } else { edge = loadDoubleEdge ( graph , endNode , startNode , edgeID , weight ) ; } } else if ( edgeOrientation == DIRECTED_EDGE ) { if ( globalOrientation . equals ( GraphFunctionParser . Orientation . REVERSED ) ) { edge = graph . addEdge ( endNode , startNode , edgeID ) ; } else { edge = graph . addEdge ( startNode , endNode , edgeID ) ; } } else if ( edgeOrientation == REVERSED_EDGE ) { if ( globalOrientation . equals ( GraphFunctionParser . Orientation . REVERSED ) ) { edge = graph . addEdge ( startNode , endNode , edgeID ) ; } else { edge = graph . addEdge ( endNode , startNode , edgeID ) ; } } else { throw new IllegalArgumentException ( "Invalid edge orientation: " + edgeOrientation ) ; } } setEdgeWeight ( edge , weight ) ; return edge ; }
Loads an edge into the graph from the current row.

@param graph The graph to which the edges will be added.

@return The newly loaded edge.