-
Notifications
You must be signed in to change notification settings - Fork 0
/
Division.java
51 lines (41 loc) · 952 Bytes
/
Division.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
package statCalculator;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.Scanner;
public class Division {
ArrayList<Team> teamList = new ArrayList<>();
private String divisionName = "";
public Division(String name) {
this.teamList = teamList;
this.divisionName = name;
}
public int size() {
return teamList.size();
}
public Team get(int index) {
return teamList.get(index);
}
public boolean containsTeam(String teamName) {
for(int i=0; i<teamList.size(); i++) {
if(teamList.get(i).getName().equals(teamName)) {
return true;
}
}
return false;
}
public Team findTeam(String name) {
for(int i=0; i<teamList.size(); i++) {
if(teamList.get(i).getName().equals(name)) {
return teamList.get(i);
}
}
return null;
}
public void addTeam(Team team) {
teamList.add(team);
}
public String getName() {
return divisionName;
}
}