package adk.team.util.graph;

import com.google.common.collect.Table;
import rescuecore2.worldmodel.EntityID;

import java.util.List;
import java.util.Map;

public class RouteEdge {

    /*public List<EntityID> getRoads();

    public double getDistance();

    public double getDistance(EntityID roadID);
    */
    private Map<EntityID, Table<EntityID, EntityID, Double>> distanceMap;

    private double edgeDistance;

    public boolean addPath(List<EntityID> path) {
        return true;
    }


}

@@ -104,16 +104,58 @@
 ityID;%0A%0A
+import java.util.DoubleSummaryStatistics;%0A
 import j
@@ -348,16 +348,156 @@
 %0A    */%0A
+    private EntityID startNodeID;%0A    private EntityID endNodeID;%0A%0A    //start %3E road %3E ... %3E road %3E end%0A    private List%3CEntityID%3E roads;%0A%0A
     priv
@@ -594,16 +594,29 @@
 Distance
+ = Double.NaN
 ;%0A%0A    p
@@ -625,66 +625,932 @@
 lic 
-boolean addPath(List%3CEntityID%3E path) %7B%0A        return true
+double getDistance() %7B%0A        return this.edgeDistance;%0A    %7D%0A%0A    public double getDistance(EntityID nodeID, EntityID target) %7B%0A        if(nodeID.getValue() == this.startNodeID.getValue()) %7B%0A            if(target.getValue() == this.endNodeID.getValue()) %7B%0A                if(!Double.isNaN(this.edgeDistance)) %7B%0A                    return this.edgeDistance;%0A                %7D%0A            %7D%0A            double result = 0.0D;%0A            int size = roads.size() - 1;%0A            for(int i = 1; i %3C size; i++) %7B%0A                EntityID roadID = roads.get(i);%0A                if(roadID.getValue() == target.getValue()) %7B%0A                    return result;%0A                %7D%0A            %7D%0A        %7D%0A        else if(nodeID.getValue() == this.endNodeID.getValue()) %7B%0A            if(target.getValue() == this.startNodeID.getValue()) %7B%0A                return this.edgeDistance;%0A            %7D%0A        %7D%0A            return Double.NaN
 ;%0A  

update ADK