mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
add copyOf and copyConstructor to Capacity
This commit is contained in:
parent
c2377252ea
commit
b0e2637bea
2 changed files with 47 additions and 3 deletions
|
|
@ -3,6 +3,11 @@ package jsprit.core.problem;
|
|||
|
||||
public class Capacity {
|
||||
|
||||
public static Capacity copyOf(Capacity capacity){
|
||||
if(capacity == null) return null;
|
||||
return new Capacity(capacity);
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
|
||||
/**
|
||||
|
|
@ -56,6 +61,18 @@ public class Capacity {
|
|||
|
||||
private int[] dimensions;
|
||||
|
||||
/**
|
||||
* copy constructor
|
||||
*
|
||||
* @param capacity
|
||||
*/
|
||||
Capacity(Capacity capacity){
|
||||
this.dimensions = new int[capacity.getNuOfDimensions()];
|
||||
for(int i=0;i<capacity.getNuOfDimensions();i++){
|
||||
this.dimensions[i]=capacity.get(i);
|
||||
}
|
||||
}
|
||||
|
||||
Capacity(Builder builder) {
|
||||
dimensions = builder.dimensions;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue