gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-30 02:44:24 27 4
gpt4 key购买 nike

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

enter image description here

我有参与者类(class):

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个类之间的点关系。

我该怎么做?

最佳答案

这是一个关联类。这是一个快捷方式

enter image description here

另请参阅this answer

关于java - 如何从 UML 转换为 java。虚线关系,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40641123/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com