如何将UML转换为java。虚线关系

时间:2016-11-16 19:54:36

标签: java uml

我正在尝试将UML转换为java,但是,我不知道如何进行这种转换:

enter image description here

我有参与者课程:

public class Participant extends User {

    List<Competition> competitions;

    public Participant(String username, String password, String fullname) {
        super(username, password, fullname);
    }

    public Submission submitPrediction(Competition competition, float prediction) {
        return null;
    }

    public ArrayList<Submission> getSumissions() {
        return null;
    }
}

然后我有比赛:

public class Competition {

    private int id;
    private String title;
    private float target;
    private boolean isActive;

    private Organizer owner;
    private List<Participant> participants;
    private Platform platform;

    public Competition(int id, String title, float target, boolean isActive, Organizer owner, List<Participant> participants, Platform platform) {
        this.id = id;
        this.title = title;
        this.target = target;
        this.isActive = isActive;
        this.owner = owner;
        this.participants = participants;
        this.platform = platform;
    }
    .......... all methods, getters/setters, ectc............
}

提交:

public class Submission {
    private int id;
    private SubmissionStatus status;
    private Date submitedAt;
    private float prediction;
    private float error;

    public Submission(int id, SubmissionStatus status, Date submitedAt, float prediction, float error) {
        this.id = id;
        this.status = status;
        this.submitedAt = submitedAt;
        this.prediction = prediction;
        this.error = error;
    }
        .......... all methods, getters/setters, ectc............
}

但我不知道如何转换3个类之间的虚线关系。

我该怎么做?

1 个答案:

答案 0 :(得分:2)

这是一个关联类。这是

的捷径

enter image description here

另见this answer