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