This repository has been archived by the owner on May 25, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Match.java
80 lines (69 loc) · 1.83 KB
/
Match.java
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/**
* Defines an object representing a single match
*/
public class Match {
/**
* instance variables
*/
private final int weekNumber;
private final String matchLevel;
private String matchArea;
private final String refOne;
private final String refTwo;
/**
* Constructor for Match class
*
* @param week week number
* @param area area code
* @param isSenior boolean that represents referee level
*/
public Match(int week, int area, boolean isSenior, String firstRef, String secondRef) {
weekNumber = week;
// area is being passed as an int so have to check which it is and set matchArea String accordingly
if (area == Referee.NORTH)
matchArea = "North";
else if (area == Referee.CENTRAL)
matchArea = "Central";
else if (area == Referee.SOUTH)
matchArea = "South";
matchLevel = isSenior ? "Senior" : "Junior";
refOne = firstRef;
refTwo = secondRef;
}
/**
* Accessor method for week number
*/
public int getWeekNo() {
return weekNumber;
}
/**
* Accessor method for match level
*/
public String getLevel() {
return matchLevel;
}
/**
* Accessor method for area of match
*/
public String getArea() {
return matchArea;
}
/**
* Constructor and accessor method for refOne
*/
public String getRefOne() {
return refOne;
}
/**
* Constructor and accessor method for refTwo
*/
public String getRefTwo() {
return refTwo;
}
/**
* Method to get formatted line for match report document
*/
public String getMatchLine() {
return String.format("%-8d%-12s%-12s%-20s%-20s%n", weekNumber, matchLevel, matchArea, refOne, refTwo);
}
}