feat(dijkstra): write label class

This commit is contained in:
Paul Alnet 2024-04-05 11:33:58 +02:00
parent 04626fb1a7
commit 19ec6b6220

View file

@ -0,0 +1,31 @@
package org.insa.graphs.algorithm.shortestpath;
import org.insa.graphs.model.Node;
public class Label {
Node node;
boolean marked;
float pathCost;
Node parentNode;
public Label(Node node) {
this.node = node;
this.marked = false;
this.pathCost = Float.MAX_VALUE;
this.parentNode = null;
}
public Node getNode() { return this.node; }
public boolean isMarked() { return this.marked; }
public void mark() { this.marked = true; }
public float getPathCost() { return this.pathCost; }
public void setPathCost(float newCost) { this.pathCost = newCost; }
public Node getParentNode() { return this.parentNode; }
public void setParentNode(Node parentNode) { this.parentNode = parentNode; }
public float getCost() {
// function will be modified later
return pathCost;
}
}