private Map<Scenario, GenericDayAssignmentsContainer> containersByScenario() { Map<Scenario, GenericDayAssignmentsContainer> result = new HashMap<Scenario, GenericDayAssignmentsContainer>(); for (GenericDayAssignmentsContainer each : genericDayAssignmentsContainers) { assert !result.containsKey(each); result.put(each.getScenario(), each); } return result; }
@Override protected GenericDayAssignmentsContainer retrieveOrCreateContainerFor(Scenario scenario) { GenericDayAssignmentsContainer retrieved = retrieveContainerFor(scenario); if (retrieved != null) { return retrieved; } GenericDayAssignmentsContainer result = GenericDayAssignmentsContainer.create(this, scenario); genericDayAssignmentsContainers.add(result); return result; }
@Override public void copyAssignments(Scenario from, Scenario to) { GenericDayAssignmentsContainer fromContainer = retrieveOrCreateContainerFor(from); GenericDayAssignmentsContainer toContainer = retrieveOrCreateContainerFor(to); toContainer.resetTo(fromContainer.getDayAssignments()); }
@Override public void makeAssignmentsContainersDontPoseAsTransientAnyMore() { for (GenericDayAssignmentsContainer each : genericDayAssignmentsContainers) { each.dontPoseAsTransientObjectAnymore(); } }