-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRound.java
More file actions
42 lines (35 loc) · 1.06 KB
/
Round.java
File metadata and controls
42 lines (35 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// represents a Round of a Session, essentially a subsection of the Session duration
public class Round {
private final int roundId;
private final int sessionId;
private final int score;
private final int startTime;
private final int endTime;
Round(int roundId, int sessionId, int score, int startTime, int endTime) {
this.roundId = roundId;
this.sessionId = sessionId;
this.score = score;
this.startTime = startTime;
this.endTime = endTime;
}
// returns the id of this Round
public int getId() {
return this.roundId;
}
// returns the score of this Round
public int getScore() {
return this.score;
}
// adds the score of this Round to given existing score and returns
public int addScore(int existing) {
return existing + this.score;
}
// adds the duration of this Round to given existing duration and returns
public int addDuration(int existing) {
return existing + this.duration();
}
// determines the duration of this Round
public int duration() {
return this.endTime - this.startTime;
}
}