1
0
Fork 0
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:
oblonski 2014-07-22 16:09:44 +02:00
parent 44bf74ef87
commit 427b9a081e

View file

@ -271,7 +271,7 @@ public class StateManager implements RouteAndActivityStateGetter, IterationStart
catch (ClassCastException e){
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;
}
@ -293,7 +293,7 @@ public class StateManager implements RouteAndActivityStateGetter, IterationStart
Object state_class = vehicle_dependent_activity_states[act.getIndex()][vehicle.getVehicleTypeIdentifier().getIndex()][stateId.getIndex()];
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;
}
@ -337,7 +337,7 @@ public class StateManager implements RouteAndActivityStateGetter, IterationStart
catch (ClassCastException e){
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;
}
@ -354,7 +354,7 @@ public class StateManager implements RouteAndActivityStateGetter, IterationStart
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());
}
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;
}