Hello,
All this corresponds to a program that should provide the shortest path between two vertices of a weighted graph.
My structure is this:
Code:
private HashMap <Summit, trst <arc>> graph;
So I have a class that contains the Summit:
Code:
private String nm;
private int plusCourt; / / Evaluation Associate at Summit
And a class Arc:
Code:
private Summit arr;
private int wg;
I created all vertices and all arcs. I entered the hashmap for each vertex the arcs involved. All this works wonderfully! Now I want to change the attribute plusCourt for all vertices contained in the hashmap.
Code:
for(S Summit: graph.keySet()){
if(s.getName()== Departure)
{
sommetDepart = s;
s.setPlusCourt(0);
}
else
{
s.setPlusCourt(3255);
}
}
And in fact, after running this code, as I travel all the keys to display the value, I have only null?!? Logically if I change a key it should keep its value in the associated hashmap? Thanks in advance.
Bookmarks