Label v0.7
This commit is contained in:
parent
bcdae535bf
commit
83faf7dd11
1 changed files with 18 additions and 3 deletions
|
@ -5,13 +5,18 @@ import org.insa.graphs.model.Node;
|
|||
|
||||
public class Label {
|
||||
|
||||
//comment avoir le nombre de nodes dans le graph? (pour lier un unique label à chaque node)
|
||||
private Label[] tablabel=new Label[50000000];//5000000 placeholder
|
||||
|
||||
|
||||
//quelles valeurs de protection?
|
||||
protected Node sommet_courant;
|
||||
|
||||
//vrai quand cout_min définitivement connu par l'algo
|
||||
public boolean marque;
|
||||
|
||||
//valeur courante du plus court chemin, de l'origine au sommet
|
||||
private int cout;
|
||||
protected int cout;
|
||||
|
||||
//arc (permettant d'avoir le sommet) précédent sur le plus court chemin courant
|
||||
protected Arc pere;
|
||||
|
@ -19,17 +24,27 @@ public class Label {
|
|||
|
||||
//constructeur
|
||||
public Label(Node sommet,Arc padre, int prix) {
|
||||
this.sommet_courant=sommet;
|
||||
if (tablabel[sommet.getId()]==null)
|
||||
this.sommet_courant=sommet;
|
||||
this.pere=padre;
|
||||
this.cout=prix;
|
||||
this.marque=false;//!\\ pas sûr que ce soit une bonne idée
|
||||
tablabel[sommet.getId()]=this;
|
||||
}
|
||||
|
||||
//la condition tablabel==null est un placeholder /!\
|
||||
public Label(Node sommet,Arc padre, int prix, boolean mark) {
|
||||
this.sommet_courant=sommet;
|
||||
if (tablabel[sommet.getId()]==null)
|
||||
this.sommet_courant=sommet;
|
||||
this.pere=padre;
|
||||
this.cout=prix;
|
||||
this.marque=mark;
|
||||
tablabel[sommet.getId()]=this;
|
||||
|
||||
}
|
||||
|
||||
public Label getLabel(Node unnode) {
|
||||
return tablabel[unnode.getId()];
|
||||
}
|
||||
|
||||
public int getCost() {
|
||||
|
|
Loading…
Reference in a new issue