| 1 | package edu.ucsb.cs156.courses.documents; | |
| 2 | ||
| 3 | import com.fasterxml.jackson.annotation.JsonIgnore; | |
| 4 | import edu.ucsb.cs156.courses.entities.EnrollmentDataPoint; | |
| 5 | import java.util.stream.Collectors; | |
| 6 | import lombok.AllArgsConstructor; | |
| 7 | import lombok.Builder; | |
| 8 | import lombok.Data; | |
| 9 | import lombok.NoArgsConstructor; | |
| 10 | import org.bson.types.ObjectId; | |
| 11 | import org.springframework.data.mongodb.core.mapping.Document; | |
| 12 | ||
| 13 | @Data | |
| 14 | @Builder | |
| 15 | @NoArgsConstructor | |
| 16 | @AllArgsConstructor | |
| 17 | @Document(collection = "courses") | |
| 18 | public class ConvertedSection { | |
| 19 | private ObjectId _id; | |
| 20 | private CourseInfo courseInfo; | |
| 21 | private Section section; | |
| 22 | ||
| 23 | @Override | |
| 24 | public Object clone() throws CloneNotSupportedException { | |
| 25 | ||
| 26 | ConvertedSection newConvertedSection = new ConvertedSection(); | |
| 27 | ||
| 28 |
1
1. clone : removed call to edu/ucsb/cs156/courses/documents/ConvertedSection::set_id → KILLED |
newConvertedSection.set_id(this._id); |
| 29 | ||
| 30 | CourseInfo newCourseInfo = (CourseInfo) this.getCourseInfo().clone(); | |
| 31 |
1
1. clone : removed call to edu/ucsb/cs156/courses/documents/ConvertedSection::setCourseInfo → KILLED |
newConvertedSection.setCourseInfo(newCourseInfo); |
| 32 | ||
| 33 | Section newSection = (Section) this.getSection().clone(); | |
| 34 |
1
1. clone : removed call to edu/ucsb/cs156/courses/documents/ConvertedSection::setSection → KILLED |
newConvertedSection.setSection(newSection); |
| 35 | ||
| 36 |
1
1. clone : replaced return value with null for edu/ucsb/cs156/courses/documents/ConvertedSection::clone → KILLED |
return newConvertedSection; |
| 37 | } | |
| 38 | ||
| 39 | @JsonIgnore | |
| 40 | public EnrollmentDataPoint getEnrollmentDataPoint() { | |
| 41 | EnrollmentDataPoint edp = | |
| 42 | EnrollmentDataPoint.builder() | |
| 43 | .yyyyq(this.getCourseInfo().getQuarter()) | |
| 44 | .enrollCd(this.getSection().getEnrollCode()) | |
| 45 | .enrollment(this.getSection().getEnrolledTotal()) | |
| 46 | .courseId(this.getCourseInfo().getCourseId()) | |
| 47 | .section(this.getSection().getSection()) | |
| 48 | .build(); | |
| 49 |
1
1. getEnrollmentDataPoint : replaced return value with null for edu/ucsb/cs156/courses/documents/ConvertedSection::getEnrollmentDataPoint → KILLED |
return edp; |
| 50 | } | |
| 51 | ||
| 52 | public static class ConvertedSectionSortDescendingByQuarterComparator | |
| 53 | implements java.util.Comparator<ConvertedSection> { | |
| 54 | @Override | |
| 55 | public int compare(ConvertedSection o1, ConvertedSection o2) { | |
| 56 |
1
1. compare : replaced int return with 0 for edu/ucsb/cs156/courses/documents/ConvertedSection$ConvertedSectionSortDescendingByQuarterComparator::compare → KILLED |
return o2.getCourseInfo().getQuarter().compareTo(o1.getCourseInfo().getQuarter()); |
| 57 | } | |
| 58 | } | |
| 59 | ||
| 60 | @JsonIgnore | |
| 61 | public String getDays() { | |
| 62 |
1
1. getDays : negated conditional → KILLED |
if (this.getSection().getTimeLocations() == null) { |
| 63 | return ""; | |
| 64 | } | |
| 65 |
1
1. getDays : replaced return value with "" for edu/ucsb/cs156/courses/documents/ConvertedSection::getDays → KILLED |
return this.getSection().getTimeLocations().stream() |
| 66 |
1
1. lambda$getDays$0 : replaced return value with "" for edu/ucsb/cs156/courses/documents/ConvertedSection::lambda$getDays$0 → KILLED |
.map(timeLocation -> timeLocation.getDays()) |
| 67 | .collect(Collectors.joining(", ")); | |
| 68 | } | |
| 69 | ||
| 70 | @JsonIgnore | |
| 71 | public String getBeginTimes() { | |
| 72 |
1
1. getBeginTimes : negated conditional → KILLED |
if (this.getSection().getTimeLocations() == null) { |
| 73 | return ""; | |
| 74 | } | |
| 75 |
1
1. getBeginTimes : replaced return value with "" for edu/ucsb/cs156/courses/documents/ConvertedSection::getBeginTimes → KILLED |
return this.getSection().getTimeLocations().stream() |
| 76 |
1
1. lambda$getBeginTimes$1 : replaced return value with "" for edu/ucsb/cs156/courses/documents/ConvertedSection::lambda$getBeginTimes$1 → KILLED |
.map(timeLocation -> timeLocation.getBeginTime()) |
| 77 | .collect(Collectors.joining(", ")); | |
| 78 | } | |
| 79 | ||
| 80 | @JsonIgnore | |
| 81 | public String getLocations() { | |
| 82 |
1
1. getLocations : negated conditional → KILLED |
if (this.getSection().getTimeLocations() == null) { |
| 83 | return ""; | |
| 84 | } | |
| 85 |
1
1. getLocations : replaced return value with "" for edu/ucsb/cs156/courses/documents/ConvertedSection::getLocations → KILLED |
return this.getSection().getTimeLocations().stream() |
| 86 |
1
1. lambda$getLocations$2 : replaced return value with "" for edu/ucsb/cs156/courses/documents/ConvertedSection::lambda$getLocations$2 → KILLED |
.map(timeLocation -> timeLocation.getBuilding() + " " + timeLocation.getRoom()) |
| 87 | .collect(Collectors.joining(", ")); | |
| 88 | } | |
| 89 | } | |
Mutations | ||
| 28 |
1.1 |
|
| 31 |
1.1 |
|
| 34 |
1.1 |
|
| 36 |
1.1 |
|
| 49 |
1.1 |
|
| 56 |
1.1 |
|
| 62 |
1.1 |
|
| 65 |
1.1 |
|
| 66 |
1.1 |
|
| 72 |
1.1 |
|
| 75 |
1.1 |
|
| 76 |
1.1 |
|
| 82 |
1.1 |
|
| 85 |
1.1 |
|
| 86 |
1.1 |