finalizing terminal version
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1 +1,3 @@
|
|||||||
*.class
|
*.class
|
||||||
|
save.txt
|
||||||
|
data.txt
|
||||||
|
|||||||
@@ -42,21 +42,28 @@ public class HockeyPlayer {
|
|||||||
return gamesWon + gamesLost;
|
return gamesWon + gamesLost;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getPointsPerGame(){
|
public double getPointsPerGame() {
|
||||||
return (double) getPoints() / (double) getGamesPlayed();
|
return (double) getPoints() / (double) getGamesPlayed();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
String s =
|
String s =
|
||||||
String.format(
|
String.format(
|
||||||
"Name: %s%nGoals: %d\tAssists: %d\tPoints: %d\tPoints Per Game: %d%nGames Won: %d\tGames Lost: %d\tGames"
|
"Name: %s%nGoals: %d\tAssists: %d\tPoints: %d\tPoints Per Game: %f%nGames Won: %d"
|
||||||
+ " Played: %d%n",
|
+ "\tGames Lost: %d\tGames Played: %d%n",
|
||||||
name, goals, assists, getPoints(), getPointsPerGame(), gamesWon, gamesLost, getGamesPlayed());
|
name,
|
||||||
|
goals,
|
||||||
|
assists,
|
||||||
|
getPoints(),
|
||||||
|
getPointsPerGame(),
|
||||||
|
gamesWon,
|
||||||
|
gamesLost,
|
||||||
|
getGamesPlayed());
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getData() {
|
public String getData() {
|
||||||
return String.format("%s %d %d %d %d", name, goals, assists, gamesWon, gamesLost);
|
return String.format("%s %d %d %d %d%n", name, goals, assists, gamesWon, gamesLost);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
@@ -69,7 +76,7 @@ public class HockeyPlayer {
|
|||||||
return this.name.compareTo(p.name);
|
return this.name.compareTo(p.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addGame(int goals, int assists, boolean gameWon){
|
public void addGame(int goals, int assists, boolean gameWon) {
|
||||||
this.goals += goals;
|
this.goals += goals;
|
||||||
this.assists += assists;
|
this.assists += assists;
|
||||||
if (gameWon) gamesWon++;
|
if (gameWon) gamesWon++;
|
||||||
|
|||||||
175
HockeyStats.java
175
HockeyStats.java
@@ -16,6 +16,7 @@ public class HockeyStats {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void loadData(String fileName) throws Exception {
|
public static void loadData(String fileName) throws Exception {
|
||||||
|
players.clear();
|
||||||
File f = new File(fileName);
|
File f = new File(fileName);
|
||||||
br = new BufferedReader(new FileReader(f));
|
br = new BufferedReader(new FileReader(f));
|
||||||
st = new StringTokenizer(br.readLine());
|
st = new StringTokenizer(br.readLine());
|
||||||
@@ -30,12 +31,13 @@ public class HockeyStats {
|
|||||||
Integer.parseInt(st.nextToken()), // gamesWon
|
Integer.parseInt(st.nextToken()), // gamesWon
|
||||||
Integer.parseInt(st.nextToken()))); // gamesLost
|
Integer.parseInt(st.nextToken()))); // gamesLost
|
||||||
}
|
}
|
||||||
|
br.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void saveData(String fileName) throws Exception {
|
public static void saveData(String fileName) throws Exception {
|
||||||
FileWriter fw = new FileWriter(fileName);
|
FileWriter fw = new FileWriter(fileName);
|
||||||
String s = players.createSaveData();
|
String save = players.createSaveData();
|
||||||
fw.write(s);
|
fw.write(save);
|
||||||
fw.close();
|
fw.close();
|
||||||
System.out.println("Data saved to " + fileName);
|
System.out.println("Data saved to " + fileName);
|
||||||
}
|
}
|
||||||
@@ -43,21 +45,23 @@ public class HockeyStats {
|
|||||||
public static boolean showMenu() throws Exception {
|
public static boolean showMenu() throws Exception {
|
||||||
System.out.print(
|
System.out.print(
|
||||||
"""
|
"""
|
||||||
<---------------------------->
|
<---------------------------->
|
||||||
Hockey Stats Manager Menu
|
Hockey Stats Manager Menu
|
||||||
|
|
||||||
Select an option:
|
Select an option:
|
||||||
|
|
||||||
(1) Load Data from Files
|
(1) Load Data from Files
|
||||||
(2) Open Data Editor
|
(2) Save Data
|
||||||
(3) Open Stats View Menu
|
(3) Open Data Editor
|
||||||
(4) Quit
|
(4) Open Stats View Menu
|
||||||
|
(5) Quit
|
||||||
|
|
||||||
<---------------------------->
|
<---------------------------->
|
||||||
""");
|
""");
|
||||||
int n;
|
int n;
|
||||||
try {
|
try {
|
||||||
n = s.nextInt();
|
n = s.nextInt();
|
||||||
|
s.nextLine();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.out.println("Please choose one of the available menu options!");
|
System.out.println("Please choose one of the available menu options!");
|
||||||
return false;
|
return false;
|
||||||
@@ -68,16 +72,19 @@ public class HockeyStats {
|
|||||||
loadData("data.txt");
|
loadData("data.txt");
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
|
saveData("save.txt");
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
while (true) {
|
while (true) {
|
||||||
if (showDataMenu()) break;
|
if (showDataMenu()) break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 4:
|
||||||
while (true) {
|
while (true) {
|
||||||
if (showStatsMenu()) break;
|
if (showStatsMenu()) break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 5:
|
||||||
System.out.println("Thank you!");
|
System.out.println("Thank you!");
|
||||||
close = true;
|
close = true;
|
||||||
break;
|
break;
|
||||||
@@ -96,9 +103,9 @@ public class HockeyStats {
|
|||||||
|
|
||||||
Select an option:
|
Select an option:
|
||||||
|
|
||||||
(1) Print Data
|
(1) Add Player
|
||||||
(2) Save Data
|
(2) Remove Player
|
||||||
(3) null
|
(3) Add Game to Player
|
||||||
(4) Return to main menu
|
(4) Return to main menu
|
||||||
|
|
||||||
<---------------------------->
|
<---------------------------->
|
||||||
@@ -107,25 +114,64 @@ public class HockeyStats {
|
|||||||
int k;
|
int k;
|
||||||
try {
|
try {
|
||||||
k = s.nextInt();
|
k = s.nextInt();
|
||||||
|
s.nextLine();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.out.println("Please choose one of the available menu options!");
|
System.out.println("Please choose one of the available menu options!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
switch (k) {
|
try {
|
||||||
case 1:
|
switch (k) {
|
||||||
System.out.println(players.toString());
|
case 1:
|
||||||
break;
|
System.out.println("Enter The Following Stats:");
|
||||||
case 2:
|
System.out.println("\nPlayer Name:");
|
||||||
saveData("save.txt");
|
String newName = s.nextLine();
|
||||||
break;
|
System.out.println("Player Goals Scored:");
|
||||||
case 3:
|
int newGoals = s.nextInt();
|
||||||
break;
|
System.out.println("Player Assists:");
|
||||||
case 4:
|
int newAssists = s.nextInt();
|
||||||
dataExit = true;
|
System.out.println("Games Won:");
|
||||||
break;
|
int newGamesWon = s.nextInt();
|
||||||
default:
|
System.out.println("Games Lost:");
|
||||||
System.out.println("Please choose one of the available menu options!");
|
int newGamesLost = s.nextInt();
|
||||||
break;
|
s.nextLine();
|
||||||
|
players.addPlayer(
|
||||||
|
new HockeyPlayer(newName, newGoals, newAssists, newGamesWon, newGamesLost));
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
System.out.println("Enter the name of the player you want to remove:");
|
||||||
|
String rmName = s.nextLine();
|
||||||
|
System.out.println(
|
||||||
|
players.removePlayer(rmName)
|
||||||
|
? rmName + " was successfully removed."
|
||||||
|
: "Player not found.");
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
System.out.println("Enter The Following Stats:");
|
||||||
|
System.out.println("\nPlayer Name:");
|
||||||
|
String addName = s.nextLine();
|
||||||
|
System.out.println("Player Goals Scored:");
|
||||||
|
int addGoals = s.nextInt();
|
||||||
|
System.out.println("Player Assists:");
|
||||||
|
int addAssists = s.nextInt();
|
||||||
|
s.nextLine();
|
||||||
|
System.out.println("Games Won? (yes/no)");
|
||||||
|
boolean addGameWon = s.nextLine().equalsIgnoreCase("yes");
|
||||||
|
HockeyPlayer found = players.findPlayer(addName);
|
||||||
|
if (found == null) {
|
||||||
|
System.out.println("Player not found.");
|
||||||
|
} else {
|
||||||
|
found.addGame(addGoals, addAssists, addGameWon);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
dataExit = true;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
System.out.println("Please choose one of the available menu options!");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println("Please enter the right kind of data");
|
||||||
}
|
}
|
||||||
return dataExit;
|
return dataExit;
|
||||||
}
|
}
|
||||||
@@ -133,39 +179,66 @@ public class HockeyStats {
|
|||||||
public static boolean showStatsMenu() {
|
public static boolean showStatsMenu() {
|
||||||
System.out.print(
|
System.out.print(
|
||||||
"""
|
"""
|
||||||
<---------------------------->
|
<---------------------------->
|
||||||
Hockey Stats Viewer Menu
|
Hockey Stats Viewer
|
||||||
|
|
||||||
Select an option:
|
Select an option:
|
||||||
|
|
||||||
(1) Stats
|
(1) Print Data
|
||||||
(2) Stats
|
(2) Find Player
|
||||||
(3) Stats
|
(3) Sort By Name
|
||||||
(4) Stats
|
(4) Sort By Points
|
||||||
|
(5) Show by Goals > num
|
||||||
|
(6) Return to Main Menu
|
||||||
|
|
||||||
<---------------------------->
|
<---------------------------->
|
||||||
""");
|
""");
|
||||||
boolean statsExit = false;
|
boolean statsExit = false;
|
||||||
int k;
|
int k;
|
||||||
try {
|
try {
|
||||||
k = s.nextInt();
|
k = s.nextInt();
|
||||||
|
s.nextLine();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.out.println("Please choose one of the available menu options!");
|
System.out.println("Please choose one of the available menu options!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
switch (k) {
|
try {
|
||||||
case 1:
|
switch (k) {
|
||||||
break;
|
case 1:
|
||||||
case 2:
|
System.out.println(players.toString());
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 2:
|
||||||
break;
|
System.out.println("Enter the name of the player you want to find:");
|
||||||
case 4:
|
String findName = s.nextLine();
|
||||||
statsExit = true;
|
HockeyPlayer p = players.findPlayer(findName);
|
||||||
break;
|
System.out.println(p == null ? "Player not found." : p.toString());
|
||||||
default:
|
break;
|
||||||
System.out.println("Please choose one of the available menu options!");
|
case 3:
|
||||||
break;
|
players.sortByNames();
|
||||||
|
System.out.println("Sorted by names");
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
players.sortByPoints();
|
||||||
|
System.out.println("Sorted by points");
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
System.out.println("Enter the min goals to show:");
|
||||||
|
int minGoals = s.nextInt();
|
||||||
|
s.nextLine();
|
||||||
|
PlayerList pl = players.getPlayersGoalsAbove(minGoals);
|
||||||
|
System.out.println(pl.toString());
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
statsExit = true;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
System.out.println("Please choose one of the available menu options!");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println("k = " + k);
|
||||||
|
System.out.println(e);
|
||||||
|
System.out.println("Please enter the right kind of data");
|
||||||
}
|
}
|
||||||
return statsExit;
|
return statsExit;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<mxfile host="app.diagrams.net">
|
<mxfile host="app.diagrams.net">
|
||||||
<diagram name="Page-1" id="zzZa4exWAZNGvPS8gC2z">
|
<diagram name="Page-1" id="zzZa4exWAZNGvPS8gC2z">
|
||||||
<mxGraphModel dx="1021" dy="531" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
|
<mxGraphModel dx="1030" dy="535" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
|
||||||
<root>
|
<root>
|
||||||
<mxCell id="0" />
|
<mxCell id="0" />
|
||||||
<mxCell id="1" parent="0" />
|
<mxCell id="1" parent="0" />
|
||||||
@@ -41,12 +41,12 @@
|
|||||||
<mxGeometry height="30" width="180" y="270" as="geometry" />
|
<mxGeometry height="30" width="180" y="270" as="geometry" />
|
||||||
</mxCell>
|
</mxCell>
|
||||||
<mxCell id="RQByykYFdltTPysqK5Cl-5" parent="1" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" value="PlayerList" vertex="1">
|
<mxCell id="RQByykYFdltTPysqK5Cl-5" parent="1" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" value="PlayerList" vertex="1">
|
||||||
<mxGeometry height="370" width="250" x="340" y="620" as="geometry" />
|
<mxGeometry height="400" width="250" x="340" y="620" as="geometry" />
|
||||||
</mxCell>
|
</mxCell>
|
||||||
<mxCell id="RQByykYFdltTPysqK5Cl-6" parent="RQByykYFdltTPysqK5Cl-5" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" value="- pList: ArrayList&lt;HockeyPlayer&gt;" vertex="1">
|
<mxCell id="RQByykYFdltTPysqK5Cl-6" parent="RQByykYFdltTPysqK5Cl-5" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" value="- pList: ArrayList&lt;HockeyPlayer&gt;" vertex="1">
|
||||||
<mxGeometry height="30" width="250" y="30" as="geometry" />
|
<mxGeometry height="30" width="250" y="30" as="geometry" />
|
||||||
</mxCell>
|
</mxCell>
|
||||||
<mxCell id="RQByykYFdltTPysqK5Cl-8" parent="RQByykYFdltTPysqK5Cl-5" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" value="+ 2 4 13 addPlayer(Player): void" vertex="1">
|
<mxCell id="RQByykYFdltTPysqK5Cl-8" parent="RQByykYFdltTPysqK5Cl-5" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" value="+ 2 clear(): void" vertex="1">
|
||||||
<mxGeometry height="30" width="250" y="60" as="geometry" />
|
<mxGeometry height="30" width="250" y="60" as="geometry" />
|
||||||
</mxCell>
|
</mxCell>
|
||||||
<mxCell id="RQByykYFdltTPysqK5Cl-15" edge="1" parent="RQByykYFdltTPysqK5Cl-5" source="RQByykYFdltTPysqK5Cl-8" style="endArrow=none;html=1;rounded=0;entryX=1.01;entryY=0.987;entryDx=0;entryDy=0;entryPerimeter=0;exitX=0.006;exitY=0.013;exitDx=0;exitDy=0;exitPerimeter=0;" target="RQByykYFdltTPysqK5Cl-6" value="">
|
<mxCell id="RQByykYFdltTPysqK5Cl-15" edge="1" parent="RQByykYFdltTPysqK5Cl-5" source="RQByykYFdltTPysqK5Cl-8" style="endArrow=none;html=1;rounded=0;entryX=1.01;entryY=0.987;entryDx=0;entryDy=0;entryPerimeter=0;exitX=0.006;exitY=0.013;exitDx=0;exitDy=0;exitPerimeter=0;" target="RQByykYFdltTPysqK5Cl-6" value="">
|
||||||
@@ -55,29 +55,32 @@
|
|||||||
<mxPoint x="116" y="100" as="targetPoint" />
|
<mxPoint x="116" y="100" as="targetPoint" />
|
||||||
</mxGeometry>
|
</mxGeometry>
|
||||||
</mxCell>
|
</mxCell>
|
||||||
<mxCell id="RQByykYFdltTPysqK5Cl-16" parent="RQByykYFdltTPysqK5Cl-5" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" value="+ 5 removePlayer(Player): boolean" vertex="1">
|
<mxCell id="dWSavgd9TV3ToYHsANoj-1" parent="RQByykYFdltTPysqK5Cl-5" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" value="+ 2 4 13 addPlayer(Player): void" vertex="1">
|
||||||
<mxGeometry height="30" width="250" y="90" as="geometry" />
|
<mxGeometry height="30" width="250" y="90" as="geometry" />
|
||||||
</mxCell>
|
</mxCell>
|
||||||
<mxCell id="RQByykYFdltTPysqK5Cl-17" parent="RQByykYFdltTPysqK5Cl-5" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" value="+ 6 toString(): String" vertex="1">
|
<mxCell id="RQByykYFdltTPysqK5Cl-16" parent="RQByykYFdltTPysqK5Cl-5" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" value="+ 5 removePlayer(Player): boolean" vertex="1">
|
||||||
<mxGeometry height="30" width="250" y="120" as="geometry" />
|
<mxGeometry height="30" width="250" y="120" as="geometry" />
|
||||||
</mxCell>
|
</mxCell>
|
||||||
<mxCell id="RQByykYFdltTPysqK5Cl-18" parent="RQByykYFdltTPysqK5Cl-5" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" value="+ 3 createSaveData(): String" vertex="1">
|
<mxCell id="RQByykYFdltTPysqK5Cl-17" parent="RQByykYFdltTPysqK5Cl-5" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" value="+ 6 toString(): String" vertex="1">
|
||||||
<mxGeometry height="30" width="250" y="150" as="geometry" />
|
<mxGeometry height="30" width="250" y="150" as="geometry" />
|
||||||
</mxCell>
|
</mxCell>
|
||||||
<mxCell id="RQByykYFdltTPysqK5Cl-28" parent="RQByykYFdltTPysqK5Cl-5" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" value="+ 7 13 findPlayer(String): HockeyPlayer" vertex="1">
|
<mxCell id="RQByykYFdltTPysqK5Cl-18" parent="RQByykYFdltTPysqK5Cl-5" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" value="+ 3 createSaveData(): String" vertex="1">
|
||||||
<mxGeometry height="30" width="250" y="180" as="geometry" />
|
<mxGeometry height="30" width="250" y="180" as="geometry" />
|
||||||
</mxCell>
|
</mxCell>
|
||||||
<mxCell id="RQByykYFdltTPysqK5Cl-29" parent="RQByykYFdltTPysqK5Cl-5" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" value="+ 8 sortByNames(): void" vertex="1">
|
<mxCell id="RQByykYFdltTPysqK5Cl-28" parent="RQByykYFdltTPysqK5Cl-5" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" value="+ 7 13 findPlayer(String): HockeyPlayer" vertex="1">
|
||||||
<mxGeometry height="30" width="250" y="210" as="geometry" />
|
<mxGeometry height="30" width="250" y="210" as="geometry" />
|
||||||
</mxCell>
|
</mxCell>
|
||||||
|
<mxCell id="RQByykYFdltTPysqK5Cl-29" parent="RQByykYFdltTPysqK5Cl-5" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" value="+ 8 sortByNames(): void" vertex="1">
|
||||||
|
<mxGeometry height="30" width="250" y="240" as="geometry" />
|
||||||
|
</mxCell>
|
||||||
<mxCell id="6J5Yf2fnFOG2eRTJ78eV-1" parent="RQByykYFdltTPysqK5Cl-5" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" value="+ 9 getPlayersGoalsAbove(int): PlayerList" vertex="1">
|
<mxCell id="6J5Yf2fnFOG2eRTJ78eV-1" parent="RQByykYFdltTPysqK5Cl-5" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" value="+ 9 getPlayersGoalsAbove(int): PlayerList" vertex="1">
|
||||||
<mxGeometry height="50" width="250" y="240" as="geometry" />
|
<mxGeometry height="50" width="250" y="270" as="geometry" />
|
||||||
</mxCell>
|
</mxCell>
|
||||||
<mxCell id="RQByykYFdltTPysqK5Cl-30" parent="RQByykYFdltTPysqK5Cl-5" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" value="+ 12 sortByPoints(): void" vertex="1">
|
<mxCell id="RQByykYFdltTPysqK5Cl-30" parent="RQByykYFdltTPysqK5Cl-5" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" value="+ 12 sortByPoints(): void" vertex="1">
|
||||||
<mxGeometry height="30" width="250" y="290" as="geometry" />
|
<mxGeometry height="30" width="250" y="320" as="geometry" />
|
||||||
</mxCell>
|
</mxCell>
|
||||||
<mxCell id="EvRgQAmgYf5TB6QFYvy6-3" parent="RQByykYFdltTPysqK5Cl-5" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" value="+ 13 addGameToPlayer(String,int,int,boolean): HockeyPlayer" vertex="1">
|
<mxCell id="EvRgQAmgYf5TB6QFYvy6-3" parent="RQByykYFdltTPysqK5Cl-5" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" value="+ 13 addGameToPlayer(String,int,int,boolean): HockeyPlayer" vertex="1">
|
||||||
<mxGeometry height="50" width="250" y="320" as="geometry" />
|
<mxGeometry height="50" width="250" y="350" as="geometry" />
|
||||||
</mxCell>
|
</mxCell>
|
||||||
<mxCell id="RQByykYFdltTPysqK5Cl-9" parent="1" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" value="HockeyPlayer" vertex="1">
|
<mxCell id="RQByykYFdltTPysqK5Cl-9" parent="1" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" value="HockeyPlayer" vertex="1">
|
||||||
<mxGeometry height="650" width="190" x="344" y="1090" as="geometry" />
|
<mxGeometry height="650" width="190" x="344" y="1090" as="geometry" />
|
||||||
|
|||||||
@@ -7,11 +7,16 @@ public class PlayerList {
|
|||||||
pList = new ArrayList<>();
|
pList = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void clear() {
|
||||||
|
pList.clear();
|
||||||
|
}
|
||||||
|
|
||||||
public void addPlayer(HockeyPlayer p) {
|
public void addPlayer(HockeyPlayer p) {
|
||||||
pList.add(p);
|
pList.add(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean removePlayer(HockeyPlayer p) {
|
public boolean removePlayer(String name) {
|
||||||
|
HockeyPlayer p = findPlayer(name);
|
||||||
return pList.remove(p);
|
return pList.remove(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user