1
0
Fork 0
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:
oblonski 2014-01-11 17:06:48 +01:00
parent c2377252ea
commit b0e2637bea
2 changed files with 47 additions and 3 deletions

View file

@ -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;
}