|
@@ -5,13 +5,18 @@ import org.insa.graphs.model.Node;
|
5
|
5
|
|
6
|
6
|
public class Label {
|
7
|
7
|
|
|
8
|
+ //comment avoir le nombre de nodes dans le graph? (pour lier un unique label à chaque node)
|
|
9
|
+ private Label[] tablabel=new Label[50000000];//5000000 placeholder
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+ //quelles valeurs de protection?
|
8
|
13
|
protected Node sommet_courant;
|
9
|
14
|
|
10
|
15
|
//vrai quand cout_min définitivement connu par l'algo
|
11
|
16
|
public boolean marque;
|
12
|
17
|
|
13
|
18
|
//valeur courante du plus court chemin, de l'origine au sommet
|
14
|
|
- private int cout;
|
|
19
|
+ protected int cout;
|
15
|
20
|
|
16
|
21
|
//arc (permettant d'avoir le sommet) précédent sur le plus court chemin courant
|
17
|
22
|
protected Arc pere;
|
|
@@ -19,17 +24,27 @@ public class Label {
|
19
|
24
|
|
20
|
25
|
//constructeur
|
21
|
26
|
public Label(Node sommet,Arc padre, int prix) {
|
22
|
|
- this.sommet_courant=sommet;
|
|
27
|
+ if (tablabel[sommet.getId()]==null)
|
|
28
|
+ this.sommet_courant=sommet;
|
23
|
29
|
this.pere=padre;
|
24
|
30
|
this.cout=prix;
|
25
|
31
|
this.marque=false;//!\\ pas sûr que ce soit une bonne idée
|
|
32
|
+ tablabel[sommet.getId()]=this;
|
26
|
33
|
}
|
27
|
34
|
|
|
35
|
+ //la condition tablabel==null est un placeholder /!\
|
28
|
36
|
public Label(Node sommet,Arc padre, int prix, boolean mark) {
|
29
|
|
- this.sommet_courant=sommet;
|
|
37
|
+ if (tablabel[sommet.getId()]==null)
|
|
38
|
+ this.sommet_courant=sommet;
|
30
|
39
|
this.pere=padre;
|
31
|
40
|
this.cout=prix;
|
32
|
41
|
this.marque=mark;
|
|
42
|
+ tablabel[sommet.getId()]=this;
|
|
43
|
+
|
|
44
|
+ }
|
|
45
|
+
|
|
46
|
+ public Label getLabel(Node unnode) {
|
|
47
|
+ return tablabel[unnode.getId()];
|
33
|
48
|
}
|
34
|
49
|
|
35
|
50
|
public int getCost() {
|