Added a Node class
This commit is contained in:
parent
c595175f98
commit
6c0aa02584
@ -29,8 +29,6 @@ public class Main {
|
|||||||
vrps.add(FileReader.readFile(p.toUri()));
|
vrps.add(FileReader.readFile(p.toUri()));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println(vrps.getFirst().toString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
62
src/main/java/fr/nabil/data/Node.java
Normal file
62
src/main/java/fr/nabil/data/Node.java
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user