package org.yoooo.se1;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * A GraphPath represents a path in a graph.
 *
 * @param <V> the graph vertex type
 * @param <E> the graph edge type
 */
public class GraphPath<V, E> {
    private Graph<V, E> mGraph;
    private List<E> mEdgeList = new ArrayList<>();
    private boolean mWeightAssigned = false;
    private double mWeight;

    /**
     * Creates a new graph path over the specified graph.
     *
     * @param graph graph over which the path is created
     */
    public GraphPath(Graph<V, E> graph) {
        mGraph = graph;
    }

    /**
     * Returns the graph over which this path is defined.
     *
     * @return containing graph
     */
    public Graph<V, E> getGraph() {
        return mGraph;
    }

    /**
     * Returns the start vertex in this path.
     *
     * @return start vertex
     */
    V getStartVertex() {
        if (mEdgeList.isEmpty()) {
            return null;
        }
        return mGraph.getEdgeSource(mEdgeList.get(0));
    }

    /**
     * Returns the end vertex in this path.
     *
     * @return end vertex
     */
    V getEndVertex() {
        if (mEdgeList.isEmpty()) {
            return null;
        }
        return mGraph.getEdgeTarget(mEdgeList.get(mEdgeList.size() - 1));
    }

    /**
     * Returns the edges making up this path.
     *
     * @return list of edges
     */
    List<E> getEdgeList() {
        return Collections.unmodifiableList(mEdgeList);
    }

    /**
     * Returns this path as a sequence of vertices.
     *
     * @return list of vertices
     */
    List<V> getVertexList() {
        List<V> list = new ArrayList<>();
        if (mEdgeList.isEmpty()) {
            return list;
        }
        list.add(mGraph.getEdgeSource(mEdgeList.get(0)));
        for (E edge : mEdgeList) {
            list.add(mGraph.getEdgeTarget(edge));
        }
        return list;
    }

    /**
     * Returns the weight assigned to this path.
     *
     * @return weight of this path
     */
    double getWeight() {
        if (mWeightAssigned) {
            return mWeight;
        }
        mWeight = 0;
        for (E edge : mEdgeList) {
            mWeight += mGraph.getEdgeWeight(edge);
        }
        mWeightAssigned = true;
        return mWeight;
    }

    /**
     * Sets the weight of this path.
     *
     * @param weight weight of this path
     */
    void setWeight(double weight) {
        mWeight = weight;
        mWeightAssigned = true;
    }

    /**
     * Returns the length of this path, measured in the number of edges.
     *
     * @return length of this path
     */
    int getLength() {
        return mEdgeList.size();
    }

    /**
     * Adds an edge to this path.
     *
     * @param edge edge to be added
     */
    void addEdge(E edge) {
        mEdgeList.add(edge);
    }
}

@@ -900,24 +900,31 @@
      */%0A    
+public 
 V getStartVe
@@ -924,32 +924,32 @@
 StartVertex() %7B%0A
-
         if (mEdg
@@ -1161,16 +1161,23 @@
  */%0A    
+public 
 V getEnd
@@ -1436,24 +1436,31 @@
      */%0A    
+public 
 List%3CE%3E getE
@@ -1641,24 +1641,31 @@
      */%0A    
+public 
 List%3CV%3E getV
@@ -2082,16 +2082,23 @@
  */%0A    
+public 
 double g
@@ -2460,24 +2460,31 @@
      */%0A    
+public 
 void setWeig
@@ -2703,16 +2703,23 @@
  */%0A    
+public 
 int getL
@@ -2861,20 +2861,27 @@
      */%0A
-
     
+public 
 void add

Add missing access modifiers