| 1 | package edu.ucsb.cs156.courses.documents; | |
| 2 | ||
| 3 | import java.util.ArrayList; | |
| 4 | import java.util.List; | |
| 5 | import java.util.Collections; | |
| 6 | ||
| 7 | import lombok.Data; | |
| 8 | import lombok.NoArgsConstructor; | |
| 9 | ||
| 10 | @Data | |
| 11 | @NoArgsConstructor | |
| 12 | public class Section implements Cloneable { | |
| 13 | ||
| 14 | /** a unique number assigned to a section */ | |
| 15 | private String enrollCode; | |
| 16 | /** section number of the course */ | |
| 17 | private String section; | |
| 18 | /** session only for summer quarter */ | |
| 19 | private String session; | |
| 20 | /** if the class is closed */ | |
| 21 | private String classClosed; | |
| 22 | /** is course cancelled */ | |
| 23 | private String courseCancelled; | |
| 24 | /** | |
| 25 | * Grading Options Code like Pass/No Pass (P/NP) Or Letter Grades (L). | |
| 26 | * | |
| 27 | * @see <a href= | |
| 28 | * "https://developer.ucsb.edu/content/student-record-code-lookups"> | |
| 29 | * https://developer.ucsb.edu/content/student-record-code-lookups</a> | |
| 30 | * | |
| 31 | */ | |
| 32 | private String gradingOptionCode; | |
| 33 | ||
| 34 | /** total number of enrollments in the course */ | |
| 35 | private Integer enrolledTotal; | |
| 36 | /** max number of students can be enrolled in the section */ | |
| 37 | private Integer maxEnroll; | |
| 38 | ||
| 39 | /** Secondary Status of the course */ | |
| 40 | private String secondaryStatus; | |
| 41 | ||
| 42 | /** Is department approval required for enrollment in the section */ | |
| 43 | private boolean departmentApprovalRequired; | |
| 44 | ||
| 45 | /** Is instructor approval required for enrollment in the section */ | |
| 46 | private boolean instructorApprovalRequired; | |
| 47 | ||
| 48 | /** Is there restriction on the level of the course */ | |
| 49 | private String restrictionLevel; | |
| 50 | ||
| 51 | /** Is there restriction on the major of the student */ | |
| 52 | private String restrictionMajor; | |
| 53 | ||
| 54 | /** Is there restriction on the major and pass time of the student */ | |
| 55 | private String restrictionMajorPass; | |
| 56 | ||
| 57 | /** Is there restriction on the minor of the student */ | |
| 58 | private String restrictionMinor; | |
| 59 | ||
| 60 | /** Is there restriction on the minor and pass time of the student */ | |
| 61 | private String restrictionMinorPass; | |
| 62 | ||
| 63 | /** Concurrent courses for the section */ | |
| 64 | private List<String> concurrentCourses; | |
| 65 | ||
| 66 | /** | |
| 67 | * List of {@link TimeLocation} objects for this course | |
| 68 | */ | |
| 69 | private List<TimeLocation> timeLocations; | |
| 70 | /** | |
| 71 | * List of {@link Instructor} objects for this course | |
| 72 | */ | |
| 73 | private List<Instructor> instructors; | |
| 74 | ||
| 75 | public Object clone() throws CloneNotSupportedException { | |
| 76 | ||
| 77 | Section newSection = (Section) super.clone(); | |
| 78 | // List<String> copyConcurrentCourses = new ArrayList<>(); | |
| 79 | // Collections.copy(copyConcurrentCourses, this.getConcurrentCourses()); | |
| 80 | // newSection.setConcurrentCourses(copyConcurrentCourses); | |
| 81 | ||
| 82 | // List<TimeLocation> copyTimeLocations = new ArrayList<>(); | |
| 83 | // for (TimeLocation tl : this.getTimeLocations()) { | |
| 84 | // copyTimeLocations.add((TimeLocation) tl.clone()); | |
| 85 | // } | |
| 86 | // newSection.setTimeLocations(copyTimeLocations); | |
| 87 | ||
| 88 | // List<Instructor> copyInstructors = new ArrayList<>(); | |
| 89 | // for (Instructor i : this.getInstructors()) { | |
| 90 | // copyInstructors.add((Instructor) i.clone()); | |
| 91 | // } | |
| 92 | // newSection.setInstructors(copyInstructors); | |
| 93 | ||
| 94 |
1
1. clone : replaced return value with null for edu/ucsb/cs156/courses/documents/Section::clone → KILLED |
return newSection; |
| 95 | } | |
| 96 | } | |
Mutations | ||
| 94 |
1.1 |