src/main/java/seedu/address/storage/storageAssignments/JsonAdaptedAssignment.java
public Assignment toModelType() throws IllegalValueException {
        final List<Tag> AssignmentTags = new ArrayList<>();
        for (JsonAssignmentAdaptedTag tag : tagged) {
            AssignmentTags.add(tag.toModelType());
        }

        if (name == null) {
            throw new IllegalValueException(
                    String.format(MISSING_FIELD_MESSAGE_FORMAT, Name.class.getSimpleName()));
        }
        if (!Name.isValidName(name)) {
            throw new IllegalValueException(Name.MESSAGE_CONSTRAINTS);
        }
        final Name modelName = new Name(name);

        if (assignmentID == null) {
            throw new IllegalValueException(
                    String.format(MISSING_FIELD_MESSAGE_FORMAT, ID.class.getSimpleName()));
        }
        if (!ID.isValidId(assignmentID)) {
            throw new IllegalValueException(Phone.MESSAGE_CONSTRAINTS);
        }
        final ID modelId = new ID(assignmentID);

        if (deadline == null) {
            throw new IllegalValueException(
                    String.format(MISSING_FIELD_MESSAGE_FORMAT, Deadline.class.getSimpleName())
            );
        }
        if (!Deadline.isValidDeadline(deadline)) {
            throw new IllegalValueException(Deadline.MESSAGE_CONSTRAINTS);
        }
        ;

        final Date modelDeadline = new Date(deadline);

        final Set<Tag> modelTags = new HashSet<>(AssignmentTags);

        // if assignment is assigned to course already
        if (courseID == null) {
            return new Assignment(modelName, modelId, modelDeadline, modelTags);
        } else {
            final ID modelCourseID = new ID(courseID);
            return new Assignment(modelName, modelId, modelCourseID, modelDeadline, modelTags);
        }
    }
/**
     * Converts this Jackson-friendly adapted Assignment object into the model's {@code Assignment} object.
     *
     * @throws IllegalValueException if there were any data constraints violated in the adapted
     *                               Assignment.
     */
Converts this Jackson-friendly adapted Assignment object into the model's  Assignment object.
@throws IllegalValueException if there were any data constraints violated in the adapted
Assignment.
Converts this Jackson - friendly adapted Assignment object into the model ' s Assignment object . @throws IllegalValueException if there were any data constraints violated in the adapted Assignment .
public Assignment toModelType() throws IllegalValueException {
        final List<Tag> AssignmentTags = new ArrayList<>();
        for (JsonAssignmentAdaptedTag tag : tagged) {
            AssignmentTags.add(tag.toModelType());
        }
        if (name == null) {
            throw new IllegalValueException(
                    String.format(MISSING_FIELD_MESSAGE_FORMAT, Name.class.getSimpleName()));
        }
        if (!Name.isValidName(name)) {
            throw new IllegalValueException(Name.MESSAGE_CONSTRAINTS);
        }
        final Name modelName = new Name(name);
        if (assignmentID == null) {
            throw new IllegalValueException(
                    String.format(MISSING_FIELD_MESSAGE_FORMAT, ID.class.getSimpleName()));
        }
        if (!ID.isValidId(assignmentID)) {
            throw new IllegalValueException(Phone.MESSAGE_CONSTRAINTS);
        }
        final ID modelId = new ID(assignmentID);
        if (deadline == null) {
            throw new IllegalValueException(
                    String.format(MISSING_FIELD_MESSAGE_FORMAT, Deadline.class.getSimpleName())
            );
        }
        if (!Deadline.isValidDeadline(deadline)) {
            throw new IllegalValueException(Deadline.MESSAGE_CONSTRAINTS);
        }
        ;
        final Date modelDeadline = new Date(deadline);
        final Set<Tag> modelTags = new HashSet<>(AssignmentTags);
        if (courseID == null) {
            return new Assignment(modelName, modelId, modelDeadline, modelTags);
        } else {
            final ID modelCourseID = new ID(courseID);
            return new Assignment(modelName, modelId, modelCourseID, modelDeadline, modelTags);
        }
    }
public Assignment toModelType ( ) throws IllegalValueException { final List < Tag > AssignmentTags = new ArrayList < > ( ) ; for ( JsonAssignmentAdaptedTag tag : tagged ) { AssignmentTags . add ( tag . toModelType ( ) ) ; } if ( name == null ) { throw new IllegalValueException ( String . format ( MISSING_FIELD_MESSAGE_FORMAT , Name . class . getSimpleName ( ) ) ) ; } if ( ! Name . isValidName ( name ) ) { throw new IllegalValueException ( Name . MESSAGE_CONSTRAINTS ) ; } final Name modelName = new Name ( name ) ; if ( assignmentID == null ) { throw new IllegalValueException ( String . format ( MISSING_FIELD_MESSAGE_FORMAT , ID . class . getSimpleName ( ) ) ) ; } if ( ! ID . isValidId ( assignmentID ) ) { throw new IllegalValueException ( Phone . MESSAGE_CONSTRAINTS ) ; } final ID modelId = new ID ( assignmentID ) ; if ( deadline == null ) { throw new IllegalValueException ( String . format ( MISSING_FIELD_MESSAGE_FORMAT , Deadline . class . getSimpleName ( ) ) ) ; } if ( ! Deadline . isValidDeadline ( deadline ) ) { throw new IllegalValueException ( Deadline . MESSAGE_CONSTRAINTS ) ; } ; final Date modelDeadline = new Date ( deadline ) ; final Set < Tag > modelTags = new HashSet < > ( AssignmentTags ) ; if ( courseID == null ) { return new Assignment ( modelName , modelId , modelDeadline , modelTags ) ; } else { final ID modelCourseID = new ID ( courseID ) ; return new Assignment ( modelName , modelId , modelCourseID , modelDeadline , modelTags ) ; } }
Converts this Jackson-friendly adapted Assignment object into the model's {@code Assignment} object.
Converts this Jackson - friendly adapted Assignment object into the model ' s { @code Assignment } object .
// if assignment is assigned to course already