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