Added a Node class

This commit is contained in:
Nabil Ould Hamou 2025-02-03 14:05:15 +01:00
parent c595175f98
commit 6c0aa02584
2 changed files with 62 additions and 2 deletions

View File

@ -29,8 +29,6 @@ public class Main {
vrps.add(FileReader.readFile(p.toUri()));
});
}
System.out.println(vrps.getFirst().toString());
}
}

View File

@ -0,0 +1,62 @@
package fr.nabil.data;
public class Node {
private int id; // Site number
private int routeNumber; // Route as a whole and not as an arc
private Node previousNode;
private Node nextNode;
private int demand;
public Node(int id, int routeNumber, int demand, Node previousNode, Node nextNode) {
this.id = id;
this.routeNumber = routeNumber;
this.demand = demand;
this.previousNode = previousNode;
this.nextNode = nextNode;
}
public Node(int id, int demand) {
this.id = id;
this.demand = demand;
}
public void setAll(Node previousNode, Node nextNode, int routeNumber, int demand) {
this.previousNode = previousNode;
this.nextNode = nextNode;
this.routeNumber = routeNumber;
}
public int getId() {
return id;
}
public int getDemand() {
return demand;
}
public int getRouteNumber() {
return routeNumber;
}
public void setRouteNumber(int routeNumber) {
this.routeNumber = routeNumber;
}
public Node getNextNode() {
return nextNode;
}
public Node getPreviousNode() {
return previousNode;
}
public void setNextNode(Node nextNode) {
this.nextNode = nextNode;
}
public void setPreviousNode(Node previousNode) {
this.previousNode = previousNode;
}
}