src/main/java/seedu/planner/model/ModelManager.java
private void updateDay(Activity oldAct, Activity newAct) throws EndOfTimeException {
        List<Day> listOfDays = activityDayMap.get(oldAct);
        List<Day> newListOfDays = new ArrayList<>();

        if (!listOfDays.isEmpty()) {
            itinerary.getItinerary().forEach(day -> {
                if (listOfDays.contains(day)) {
                    Day newDay = itinerary.updateDayActivity(oldAct, newAct, day);
                    setDay(day, newDay);
                    newListOfDays.add(newDay);
                }
            });
        }
        activityDayMap.remove(oldAct);
        activityDayMap.put(newAct, newListOfDays);
    }
/**
     * Updates the mapping when there is a change to an {@code Activity}.  When the {@code Activity} is changed,
     * the {@code Day} containing it is updated.
     */
Updates the mapping when there is a change to an  Activity.  When the  Activity is changed,
the  Day containing it is updated.
Updates the mapping when there is a change to an Activity . When the Activity is changed the Day containing it is updated .
private void updateDay(Activity oldAct, Activity newAct) throws EndOfTimeException {
        List<Day> listOfDays = activityDayMap.get(oldAct);
        List<Day> newListOfDays = new ArrayList<>();
        if (!listOfDays.isEmpty()) {
            itinerary.getItinerary().forEach(day -> {
                if (listOfDays.contains(day)) {
                    Day newDay = itinerary.updateDayActivity(oldAct, newAct, day);
                    setDay(day, newDay);
                    newListOfDays.add(newDay);
                }
            });
        }
        activityDayMap.remove(oldAct);
        activityDayMap.put(newAct, newListOfDays);
    }
private void updateDay ( Activity oldAct , Activity newAct ) throws EndOfTimeException { List < Day > listOfDays = activityDayMap . get ( oldAct ) ; List < Day > newListOfDays = new ArrayList < > ( ) ; if ( ! listOfDays . isEmpty ( ) ) { itinerary . getItinerary ( ) . forEach ( day -> { if ( listOfDays . contains ( day ) ) { Day newDay = itinerary . updateDayActivity ( oldAct , newAct , day ) ; setDay ( day , newDay ) ; newListOfDays . add ( newDay ) ; } } ) ; } activityDayMap . remove ( oldAct ) ; activityDayMap . put ( newAct , newListOfDays ) ; }
Updates the mapping when there is a change to an {@code Activity}.
Updates the mapping when there is a change to an { @code Activity } .