feat(dijkstra): write label class
This commit is contained in:
parent
04626fb1a7
commit
19ec6b6220
1 changed files with 31 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue