src/main/java/seedu/address/logic/commands/EditCommand.java
/**
         * Returns a new EditStudySpotDescriptor, which updates the existing amenities according to
         * the edit command provided.
         */
Returns a new EditStudySpotDescriptor, which updates the existing amenities according to
the edit command provided.
Returns a new EditStudySpotDescriptor which updates the existing amenities according to the edit command provided .
public EditStudySpotDescriptor updateAmenities(Set<Amenity> existingAmenities) throws CommandException {
            boolean repeatedAmenityPresent = checkRepeatedField(addedAmenities, removedAmenities, FIELD_AMENITY);
            if (repeatedAmenityPresent) {
                throw new CommandException(MESSAGE_REPEATED_COMMANDS);
            }
            if (addedAmenities != null && addedAmenities.isEmpty()) {
                setAmenities(addedAmenities);
                return this;
            }
            if (removedAmenities != null && removedAmenities.isEmpty()) {
                throw new CommandException(MESSAGE_MISSING_REMOVAL_INPUT);
            }
            Set<Amenity> updatedAmenities = existingAmenities;
            if (addedAmenities != null) {
                updatedAmenities = combineAmenitiesAdded(addedAmenities, updatedAmenities);
            }
            if (removedAmenities != null) {
                updatedAmenities = combineAmenitiesRemoved(removedAmenities, updatedAmenities);
            }
            setAmenities(updatedAmenities);
            return this;
        }
public EditStudySpotDescriptor updateAmenities ( Set < Amenity > existingAmenities ) throws CommandException { boolean repeatedAmenityPresent = checkRepeatedField ( addedAmenities , removedAmenities , FIELD_AMENITY ) ; if ( repeatedAmenityPresent ) { throw new CommandException ( MESSAGE_REPEATED_COMMANDS ) ; } if ( addedAmenities != null && addedAmenities . isEmpty ( ) ) { setAmenities ( addedAmenities ) ; return this ; } if ( removedAmenities != null && removedAmenities . isEmpty ( ) ) { throw new CommandException ( MESSAGE_MISSING_REMOVAL_INPUT ) ; } Set < Amenity > updatedAmenities = existingAmenities ; if ( addedAmenities != null ) { updatedAmenities = combineAmenitiesAdded ( addedAmenities , updatedAmenities ) ; } if ( removedAmenities != null ) { updatedAmenities = combineAmenitiesRemoved ( removedAmenities , updatedAmenities ) ; } setAmenities ( updatedAmenities ) ; return this ; }
Returns a new EditStudySpotDescriptor, which updates the existing amenities according to
 the edit command provided.
Returns a new EditStudySpotDescriptor which updates the existing amenities according to the edit command provided .
// case where all amenities are cleared // case where input to rm/ is empty