1
0
Fork 0
mirror of https://github.com/graphhopper/jsprit.git synced 2020-01-24 07:45:05 +01:00

rename putDefaultProblemState to addDefaultProblemState

This commit is contained in:
oblonski 2014-03-27 11:01:24 +01:00
parent 1c451c5090
commit e015e3acd1
2 changed files with 5 additions and 3 deletions

View file

@ -151,7 +151,7 @@ public class StateManager implements RouteAndActivityStateGetter, IterationStart
addDefaultStates(); addDefaultStates();
} }
public <T> void putDefaultProblemState(StateId stateId, Class<T> type, T defaultState){ public <T> void addDefaultProblemState(StateId stateId, Class<T> type, T defaultState){
defaultProblemStates_.putState(stateId, type, defaultState); defaultProblemStates_.putState(stateId, type, defaultState);
} }
@ -403,7 +403,7 @@ public class StateManager implements RouteAndActivityStateGetter, IterationStart
/** /**
* Adds state updater. * Adds state updater.
* *
* <p>Note that a state update occurs if route and/or activity states change, i.e. if jobs are removed * <p>Note that a state update occurs if route and/or activity states have changed, i.e. if jobs are removed
* or inserted into a route. Thus here, it is assumed that a state updater is either of type InsertionListener, * or inserted into a route. Thus here, it is assumed that a state updater is either of type InsertionListener,
* RuinListener, ActivityVisitor, ReverseActivityVisitor, RouteVisitor, ReverseRouteVisitor. * RuinListener, ActivityVisitor, ReverseActivityVisitor, RouteVisitor, ReverseRouteVisitor.
* *
@ -421,6 +421,8 @@ public class StateManager implements RouteAndActivityStateGetter, IterationStart
updaters.add(updater); updaters.add(updater);
} }
Collection<StateUpdater> getStateUpdaters(){ Collection<StateUpdater> getStateUpdaters(){
return Collections.unmodifiableCollection(updaters); return Collections.unmodifiableCollection(updaters);
} }

View file

@ -167,7 +167,7 @@ public class StateManagerTest {
public void whenProblemStateIsSetAndStateManagerClearedAfterwards_itReturnsDefault(){ public void whenProblemStateIsSetAndStateManagerClearedAfterwards_itReturnsDefault(){
StateManager stateManager = new StateManager(mock(VehicleRoutingTransportCosts.class)); StateManager stateManager = new StateManager(mock(VehicleRoutingTransportCosts.class));
StateId id = StateFactory.createId("problemState"); StateId id = StateFactory.createId("problemState");
stateManager.putDefaultProblemState(id, Boolean.class, false); stateManager.addDefaultProblemState(id, Boolean.class, false);
stateManager.putProblemState(id, Boolean.class, true); stateManager.putProblemState(id, Boolean.class, true);
stateManager.clear(); stateManager.clear();
boolean problemState = stateManager.getProblemState(id, Boolean.class); boolean problemState = stateManager.getProblemState(id, Boolean.class);