mirror of
https://github.com/graphhopper/jsprit.git
synced 2020-01-24 07:45:05 +01:00
modified core.algorithm.state.StateManager such that it throws NullPointerException if state does not exist but should
This commit is contained in:
parent
44bf74ef87
commit
427b9a081e
1 changed files with 4 additions and 4 deletions
|
|
@ -271,7 +271,7 @@ public class StateManager implements RouteAndActivityStateGetter, IterationStart
|
||||||
catch (ClassCastException e){
|
catch (ClassCastException e){
|
||||||
throw getClassCastException(e,stateId,type.toString(),activity_states[act.getIndex()][stateId.getIndex()].getClass().toString());
|
throw getClassCastException(e,stateId,type.toString(),activity_states[act.getIndex()][stateId.getIndex()].getClass().toString());
|
||||||
}
|
}
|
||||||
if(state == null) return getDefaultTypedActivityState(act, stateId, type);
|
if(state == null) throw new NullPointerException("state " + stateId.toString() + " of activity " + act + " is missing.");
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -293,7 +293,7 @@ public class StateManager implements RouteAndActivityStateGetter, IterationStart
|
||||||
Object state_class = vehicle_dependent_activity_states[act.getIndex()][vehicle.getVehicleTypeIdentifier().getIndex()][stateId.getIndex()];
|
Object state_class = vehicle_dependent_activity_states[act.getIndex()][vehicle.getVehicleTypeIdentifier().getIndex()][stateId.getIndex()];
|
||||||
throw getClassCastException(e,stateId,type.toString(),state_class.getClass().toString());
|
throw getClassCastException(e,stateId,type.toString(),state_class.getClass().toString());
|
||||||
}
|
}
|
||||||
if(state == null) return getDefaultTypedActivityState(act, stateId, type);
|
if(state == null) throw new NullPointerException("state " + stateId.toString() + " of activity " + act + " for vehicle " + vehicle.getId() + " is missing.");
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -337,7 +337,7 @@ public class StateManager implements RouteAndActivityStateGetter, IterationStart
|
||||||
catch (ClassCastException e){
|
catch (ClassCastException e){
|
||||||
throw getClassCastException(e,stateId,type.toString(),route_states[route.getActivities().get(0).getIndex()][stateId.getIndex()].getClass().toString());
|
throw getClassCastException(e,stateId,type.toString(),route_states[route.getActivities().get(0).getIndex()][stateId.getIndex()].getClass().toString());
|
||||||
}
|
}
|
||||||
if(state==null) return getDefaultTypedRouteState(stateId,type);
|
if(state==null) throw new NullPointerException("state " + stateId.toString() + " of route " + route + " is missing.");
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -354,7 +354,7 @@ public class StateManager implements RouteAndActivityStateGetter, IterationStart
|
||||||
catch( ClassCastException e){
|
catch( ClassCastException e){
|
||||||
throw getClassCastException(e, stateId, type.toString(), vehicle_dependent_route_states[route.getActivities().get(0).getIndex()][vehicle.getVehicleTypeIdentifier().getIndex()][stateId.getIndex()].getClass().toString());
|
throw getClassCastException(e, stateId, type.toString(), vehicle_dependent_route_states[route.getActivities().get(0).getIndex()][vehicle.getVehicleTypeIdentifier().getIndex()][stateId.getIndex()].getClass().toString());
|
||||||
}
|
}
|
||||||
if(state==null) return getDefaultTypedRouteState(stateId,type);
|
if(state==null) throw new NullPointerException("state " + stateId.toString() + " of route " + route + " for vehicle " + vehicle.getId() + " is missing.");
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue