mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
improve vehicle fleet manager
This commit is contained in:
parent
6be32f6305
commit
6901504854
2 changed files with 61 additions and 28 deletions
|
|
@ -77,7 +77,6 @@ class VehicleFleetManagerImpl implements VehicleFleetManager {
|
|||
int arrSize = vehicles.size() + 2;
|
||||
locked = new boolean[arrSize];
|
||||
vehicleArr = new Vehicle[arrSize];
|
||||
vehicleTypes = new TypeContainer[arrSize];
|
||||
initializeVehicleTypes();
|
||||
logger.debug("initialise {}",this);
|
||||
}
|
||||
|
|
@ -88,6 +87,13 @@ class VehicleFleetManagerImpl implements VehicleFleetManager {
|
|||
}
|
||||
|
||||
private void initializeVehicleTypes() {
|
||||
int maxTypeIndex = 0;
|
||||
for(Vehicle v : vehicles){
|
||||
if(v.getVehicleTypeIdentifier().getIndex() > maxTypeIndex){
|
||||
maxTypeIndex = v.getVehicleTypeIdentifier().getIndex();
|
||||
}
|
||||
}
|
||||
vehicleTypes = new TypeContainer[maxTypeIndex+1];
|
||||
for(int i=0;i< vehicleTypes.length;i++){
|
||||
vehicleTypes[i] = new TypeContainer();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue