ajout de commentaires

This commit is contained in:
Tiphaine Pellerin 2026-06-01 21:36:59 +02:00
parent b798f06053
commit fc6268576e
5 changed files with 4 additions and 2 deletions

View file

@ -8,7 +8,7 @@ public class AStarAlgorithm extends DijkstraAlgorithm {
super(data); super(data);
} }
//@Override // creates an 'empty' labelstar for the node given in argument
public LabelStar newLabel(Node s, ShortestPathData dataPath) { public LabelStar newLabel(Node s, ShortestPathData dataPath) {
return new LabelStar(s, false, Integer.MAX_VALUE, null, return new LabelStar(s, false, Integer.MAX_VALUE, null,
s.getPoint().distanceTo(dataPath.getDestination().getPoint())); s.getPoint().distanceTo(dataPath.getDestination().getPoint()));

View file

@ -16,6 +16,7 @@ public class DijkstraAlgorithm extends ShortestPathAlgorithm {
super(data); super(data);
} }
// creates an 'empty' label for the node given in argument
public Label newLabel(Node s) { public Label newLabel(Node s) {
return new Label(s, false, Double.MAX_VALUE, null); return new Label(s, false, Double.MAX_VALUE, null);
} }
@ -43,7 +44,6 @@ public class DijkstraAlgorithm extends ShortestPathAlgorithm {
notifyOriginProcessed(nod); notifyOriginProcessed(nod);
} }
} }
Label xl = tas.findMin(); Label xl = tas.findMin();
// iterations // iterations

View file

@ -37,11 +37,13 @@ public class Label implements Comparable<Label> {
return this.cout; return this.cout;
} }
// updates the label with the given arc and cost
public void update(Arc p, double c){ public void update(Arc p, double c){
this.pere = p; this.pere = p;
this.cout = c; this.cout = c;
} }
// compares the labels in term of cost
@Override @Override
public int compareTo(Label l) { public int compareTo(Label l) {
if (this.getCost() < l.getCost()) { if (this.getCost() < l.getCost()) {