如何将数组列表说明为序列图?

时间:2018-05-24 13:49:26

标签: java arrays arraylist uml sequence-diagram

public boolean uploadResult(Lecturer lecturer, Student student, String result) throws NullPointerException {
    Schedule currentSchedule = scheduleService.findCurrentSchedule();
    if (currentSchedule.getWeek() != 12) {
        throw new IllegalArgumentException("Cannot upload result until the end of the semester.");
    }
    Student stu = studentService.findOne(student);
    List<Enrolment> enrolments = stu.getPerformance();
    Enrolment enrolment = null;
    for (Enrolment e : enrolments) {
        CourseOffering offering = e.getOffering();
        if (offering.getLecturer().equals(lecturer) && offering.getSchedule().equals(currentSchedule)) {
            enrolment = e;
            break;
        }
    }
    if (enrolment == null) {
        throw new NullPointerException("There is no such student in the lecturer's course");
    }
    enrolment.setResult(result);
    studentService.save(student);
    return true;
}

我试图理解上面的代码,以便在序列图中说明它,但我在理解其中一些方面遇到了一些麻烦,特别是这部分:

List<Enrolment> enrolments = stu.getPerformance();
    Enrolment enrolment = null;
    for (Enrolment e : enrolments) {
        CourseOffering offering = e.getOffering();
        if (offering.getLecturer().equals(lecturer) && 
offering.getSchedule().equals(currentSchedule)) {
            enrolment = e;
            break;

My current sequence diagram in progress(LINK)

My current sequence diagram in progress

0 个答案:

没有答案