Compare commits
10 Commits
2a7a7c81e3
...
5375db795f
| Author | SHA1 | Date |
|---|---|---|
|
|
5375db795f | |
|
|
6ecdb309a1 | |
|
|
de3bec19cc | |
|
|
65bae824a5 | |
|
|
8767b8b498 | |
|
|
193512eb63 | |
|
|
9f0b7225e4 | |
|
|
4a2a412002 | |
|
|
1f47821aea | |
|
|
11b61afade |
|
|
@ -19,20 +19,40 @@ import com.r0r5chach.competitor.r6.R6Defender;
|
||||||
import com.r0r5chach.competitor.r6.R6Player;
|
import com.r0r5chach.competitor.r6.R6Player;
|
||||||
import com.r0r5chach.competitor.valorant.ValorantAgent;
|
import com.r0r5chach.competitor.valorant.ValorantAgent;
|
||||||
import com.r0r5chach.competitor.valorant.ValorantPlayer;
|
import com.r0r5chach.competitor.valorant.ValorantPlayer;
|
||||||
|
/**
|
||||||
|
* Class that defines the various attributes and methods associated with a list of Competitors
|
||||||
|
* @author r0r5chach
|
||||||
|
*/
|
||||||
public class CompetitorList {
|
public class CompetitorList {
|
||||||
|
/**
|
||||||
|
* Attribute that stores an Array of Competitors
|
||||||
|
*/
|
||||||
private final ArrayList<Competitor> competitors;
|
private final ArrayList<Competitor> competitors;
|
||||||
|
/**
|
||||||
|
* Attribute that stores the report on the held Competitors
|
||||||
|
*/
|
||||||
private String reportContents;
|
private String reportContents;
|
||||||
|
/**
|
||||||
|
* Constructs a CompetitorList Object by creating a new Array and defining the report as the stored template
|
||||||
|
* @throws IOException if the template cannot be loaded
|
||||||
|
*/
|
||||||
public CompetitorList() throws IOException {
|
public CompetitorList() throws IOException {
|
||||||
competitors = new ArrayList<>();
|
competitors = new ArrayList<>();
|
||||||
reportContents = reportTemplate();
|
reportContents = reportTemplate();
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Gets the Array of competitors
|
||||||
|
* @return the Array of competitors
|
||||||
|
*/
|
||||||
public ArrayList<Competitor> getCompetitors() {
|
public ArrayList<Competitor> getCompetitors() {
|
||||||
return competitors;
|
return competitors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read the target file and add any competitors found into the Array
|
||||||
|
* @param list the file to be read
|
||||||
|
* @throws FileNotFoundException if the file cannot be found
|
||||||
|
*/
|
||||||
public void readCompetitors(File list) throws FileNotFoundException {
|
public void readCompetitors(File list) throws FileNotFoundException {
|
||||||
Scanner reader = new Scanner(list);
|
Scanner reader = new Scanner(list);
|
||||||
|
|
||||||
|
|
@ -45,116 +65,12 @@ public class CompetitorList {
|
||||||
}
|
}
|
||||||
reader.close();
|
reader.close();
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
private ValorantPlayer parseValorantPlayer(String[] row) {
|
* Create a text file containing a report on the currently held competitors at the specified path
|
||||||
int playerNumber = Integer.parseInt(row[0]);
|
* @param pathString the absolute path of the folder the report should be made in
|
||||||
Name playerName = new Name(row[1]);
|
* @return the text file
|
||||||
Rank playerLevel = Rank.valueOf(row[2]);
|
* @throws IOException if the file cannot be made at that path
|
||||||
ValorantAgent favoriteAgent = ValorantAgent.valueOf(row[3]);
|
*/
|
||||||
int[] scores = parseScores(row[4]);
|
|
||||||
return new ValorantPlayer(playerNumber, playerName, playerLevel, favoriteAgent, scores);
|
|
||||||
}
|
|
||||||
|
|
||||||
private R6Player parseR6Player(String[] row) {
|
|
||||||
int playerNumber = Integer.parseInt(row[0]);
|
|
||||||
Name playerName = new Name(row[1]);
|
|
||||||
Rank playerLevel = Rank.valueOf(row[2]);
|
|
||||||
R6Attacker favoriteAttacker = R6Attacker.valueOf(row[3]);
|
|
||||||
R6Defender favoriteDefender = R6Defender.valueOf(row[4]);
|
|
||||||
int[] scores = parseScores(row[5]);
|
|
||||||
return new R6Player(playerNumber, playerName, playerLevel, favoriteAttacker, favoriteDefender, scores);
|
|
||||||
}
|
|
||||||
|
|
||||||
private int[] parseScores(String row) {
|
|
||||||
String[] scores = row.split(",");
|
|
||||||
int[] parsedScores = new int[scores.length];
|
|
||||||
for (int i = 0; i < scores.length; i++) {
|
|
||||||
parsedScores[i] = Integer.parseInt(scores[i]);
|
|
||||||
}
|
|
||||||
return parsedScores;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String generateTable() {
|
|
||||||
StringBuilder table = new StringBuilder("Competitor Level Scores Overall Favorite Character(s)");
|
|
||||||
Competitor best = null;
|
|
||||||
double bestScore = 0;
|
|
||||||
Rank bestRank = Rank.BRONZE;
|
|
||||||
List<Rank> ranks = Arrays.asList(Rank.values());
|
|
||||||
for (Competitor player: getCompetitors()) {
|
|
||||||
if (player.getOverallScore() > bestScore) {
|
|
||||||
best = player;
|
|
||||||
bestScore = player.getOverallScore();
|
|
||||||
bestRank = player.getPlayerLevel();
|
|
||||||
}
|
|
||||||
else if (player.getOverallScore() == bestScore) {
|
|
||||||
if (ranks.indexOf(player.getPlayerLevel()) > ranks.indexOf(bestRank)) {
|
|
||||||
best = player;
|
|
||||||
bestScore = player.getOverallScore();
|
|
||||||
bestRank = player.getPlayerLevel();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
table.append("\n");
|
|
||||||
table.append(player.getShortDetails()).append(" ");
|
|
||||||
}
|
|
||||||
table.append("\n\n").append(best.getFullDetails());
|
|
||||||
return table.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private int[] generateLevelFreqs() {
|
|
||||||
int[] freqs = {0, 0, 0, 0};
|
|
||||||
for (Competitor player: getCompetitors()) {
|
|
||||||
switch (player.getPlayerLevel()) {
|
|
||||||
case BRONZE -> freqs[0] += 1;
|
|
||||||
case SILVER -> freqs[1] += 1;
|
|
||||||
case GOLD -> freqs[2] += 1;
|
|
||||||
case PLATINUM -> freqs[3] += 1;
|
|
||||||
default -> throw new IllegalArgumentException("Unexpected value: " + player.getPlayerLevel());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return freqs;
|
|
||||||
}
|
|
||||||
|
|
||||||
private int[] generateScoreFreqs() {
|
|
||||||
int[] freqs = {0, 0, 0, 0, 0, 0};
|
|
||||||
for (Competitor player: getCompetitors()) {
|
|
||||||
for (int score: player.getScores()) {
|
|
||||||
switch (score) {
|
|
||||||
case 0 -> freqs[0] += 1;
|
|
||||||
case 1 -> freqs[1] += 1;
|
|
||||||
case 2 -> freqs[2] += 1;
|
|
||||||
case 3 -> freqs[3] += 1;
|
|
||||||
case 4 -> freqs[4] += 1;
|
|
||||||
case 5 -> freqs[5] += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return freqs;
|
|
||||||
}
|
|
||||||
|
|
||||||
private double generateAverageScore() {
|
|
||||||
double avg = 0;
|
|
||||||
int totalScores = 0;
|
|
||||||
for (Competitor player: getCompetitors()) {
|
|
||||||
for (int score: player.getScores()) {
|
|
||||||
totalScores += 1;
|
|
||||||
avg += score;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
avg /= totalScores;
|
|
||||||
return avg;
|
|
||||||
}
|
|
||||||
|
|
||||||
private double getHighScore() {
|
|
||||||
double hS = 0;
|
|
||||||
for (Competitor player: getCompetitors()) {
|
|
||||||
if (player.getOverallScore() > hS) {
|
|
||||||
hS = player.getOverallScore();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return hS;
|
|
||||||
}
|
|
||||||
|
|
||||||
public File createReportFile(String pathString) throws IOException {
|
public File createReportFile(String pathString) throws IOException {
|
||||||
boolean exists;
|
boolean exists;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
@ -180,7 +96,12 @@ public class CompetitorList {
|
||||||
reportContents = reportTemplate();
|
reportContents = reportTemplate();
|
||||||
return new File(path.toUri());
|
return new File(path.toUri());
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Creates a text file containing a log of the last error
|
||||||
|
* @param e the exception that has triggered
|
||||||
|
* @param path the absolute path of the file that the log should be made in
|
||||||
|
* @return The contents of the log file as a string
|
||||||
|
*/
|
||||||
public static String createErrorLog(Exception e, String path) {
|
public static String createErrorLog(Exception e, String path) {
|
||||||
try {
|
try {
|
||||||
FileWriter log = new FileWriter(path);
|
FileWriter log = new FileWriter(path);
|
||||||
|
|
@ -193,16 +114,162 @@ public class CompetitorList {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Parses a line of text from a file to create a ValorantPlayer
|
||||||
|
* @param row the line of text to be parsed
|
||||||
|
* @return the ValorantPlayer created
|
||||||
|
*/
|
||||||
|
private ValorantPlayer parseValorantPlayer(String[] row) {
|
||||||
|
int playerNumber = Integer.parseInt(row[0]);
|
||||||
|
Name playerName = new Name(row[1]);
|
||||||
|
Rank playerLevel = Rank.valueOf(row[2]);
|
||||||
|
ValorantAgent favoriteAgent = ValorantAgent.valueOf(row[3]);
|
||||||
|
int[] scores = parseScores(row[4]);
|
||||||
|
return new ValorantPlayer(playerNumber, playerName, playerLevel, favoriteAgent, scores);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Parses a line of text from a file to create a R6Player
|
||||||
|
* @param row the line of text to be parsed
|
||||||
|
* @return the R6Player created
|
||||||
|
*/
|
||||||
|
private R6Player parseR6Player(String[] row) {
|
||||||
|
int playerNumber = Integer.parseInt(row[0]);
|
||||||
|
Name playerName = new Name(row[1]);
|
||||||
|
Rank playerLevel = Rank.valueOf(row[2]);
|
||||||
|
R6Attacker favoriteAttacker = R6Attacker.valueOf(row[3]);
|
||||||
|
R6Defender favoriteDefender = R6Defender.valueOf(row[4]);
|
||||||
|
int[] scores = parseScores(row[5]);
|
||||||
|
return new R6Player(playerNumber, playerName, playerLevel, favoriteAttacker, favoriteDefender, scores);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Parse the scores stored in a row
|
||||||
|
* @param list the list of scores to be parsed
|
||||||
|
* @return an Array of the scores
|
||||||
|
*/
|
||||||
|
private int[] parseScores(String list) {
|
||||||
|
String[] scores = list.split(",");
|
||||||
|
int[] parsedScores = new int[scores.length];
|
||||||
|
for (int i = 0; i < scores.length; i++) {
|
||||||
|
parsedScores[i] = Integer.parseInt(scores[i]);
|
||||||
|
}
|
||||||
|
return parsedScores;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Generate a string that represents a table of the competitors and their attributes
|
||||||
|
* @return the string
|
||||||
|
*/
|
||||||
|
private String generateTable() {
|
||||||
|
StringBuilder table = new StringBuilder("Competitor Level Scores Overall Favorite Character(s)");
|
||||||
|
Competitor best = null;
|
||||||
|
double bestScore = 0;
|
||||||
|
Rank bestRank = Rank.BRONZE;
|
||||||
|
List<Rank> ranks = Arrays.asList(Rank.values());
|
||||||
|
for (Competitor player: getCompetitors()) {
|
||||||
|
if (player.getOverallScore() > bestScore) {
|
||||||
|
best = player;
|
||||||
|
bestScore = player.getOverallScore();
|
||||||
|
bestRank = player.getPlayerLevel();
|
||||||
|
}
|
||||||
|
else if (player.getOverallScore() == bestScore) {
|
||||||
|
if (ranks.indexOf(player.getPlayerLevel()) > ranks.indexOf(bestRank)) {
|
||||||
|
best = player;
|
||||||
|
bestScore = player.getOverallScore();
|
||||||
|
bestRank = player.getPlayerLevel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
table.append("\n");
|
||||||
|
table.append(player.getShortDetails()).append(" ");
|
||||||
|
}
|
||||||
|
table.append("\n\n").append(best.getFullDetails());
|
||||||
|
return table.toString();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Generate the frequency of each player level across all competitors
|
||||||
|
* @return an Array of the frequencies
|
||||||
|
*/
|
||||||
|
private int[] generateLevelFreqs() {
|
||||||
|
int[] freqs = {0, 0, 0, 0};
|
||||||
|
for (Competitor player: getCompetitors()) {
|
||||||
|
switch (player.getPlayerLevel()) {
|
||||||
|
case BRONZE -> freqs[0] += 1;
|
||||||
|
case SILVER -> freqs[1] += 1;
|
||||||
|
case GOLD -> freqs[2] += 1;
|
||||||
|
case PLATINUM -> freqs[3] += 1;
|
||||||
|
default -> throw new IllegalArgumentException("Unexpected value: " + player.getPlayerLevel());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return freqs;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Generate the frequency of achieved scores across all competitors
|
||||||
|
* @return an Array of the frequencies
|
||||||
|
*/
|
||||||
|
private int[] generateScoreFreqs() {
|
||||||
|
int[] freqs = {0, 0, 0, 0, 0, 0};
|
||||||
|
for (Competitor player: getCompetitors()) {
|
||||||
|
for (int score: player.getScores()) {
|
||||||
|
switch (score) {
|
||||||
|
case 0 -> freqs[0] += 1;
|
||||||
|
case 1 -> freqs[1] += 1;
|
||||||
|
case 2 -> freqs[2] += 1;
|
||||||
|
case 3 -> freqs[3] += 1;
|
||||||
|
case 4 -> freqs[4] += 1;
|
||||||
|
case 5 -> freqs[5] += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return freqs;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Generate the average score across all competitors
|
||||||
|
* @return the average scores
|
||||||
|
*/
|
||||||
|
private double generateAverageScore() {
|
||||||
|
double avg = 0;
|
||||||
|
int totalScores = 0;
|
||||||
|
for (Competitor player: getCompetitors()) {
|
||||||
|
for (int score: player.getScores()) {
|
||||||
|
totalScores += 1;
|
||||||
|
avg += score;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
avg /= totalScores;
|
||||||
|
return avg;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Generate the highest score achieved across all competitors
|
||||||
|
* @return the highest score
|
||||||
|
*/
|
||||||
|
private double getHighScore() {
|
||||||
|
double hS = 0;
|
||||||
|
for (Competitor player: getCompetitors()) {
|
||||||
|
if (player.getOverallScore() > hS) {
|
||||||
|
hS = player.getOverallScore();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return hS;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Replace the specified target substring in the report and replace it with the replacement string
|
||||||
|
* @param target the target substring
|
||||||
|
* @param replacement the replacement string
|
||||||
|
*/
|
||||||
private void replaceVar(String target, String replacement) {
|
private void replaceVar(String target, String replacement) {
|
||||||
reportContents = reportContents.replace(target, replacement);
|
reportContents = reportContents.replace(target, replacement);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Get the report template
|
||||||
|
* @return the report template
|
||||||
|
* @throws IOException if the file is not found
|
||||||
|
*/
|
||||||
private String reportTemplate() throws IOException {
|
private String reportTemplate() throws IOException {
|
||||||
return Files.readString(Path.of("src/main/resources/com/r0r5chach/report.template"));
|
return Files.readString(Path.of("src/main/resources/com/r0r5chach/report.template"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Generate the report contents
|
||||||
|
*/
|
||||||
private void generateReportContents() {
|
private void generateReportContents() {
|
||||||
replaceVar("%TABLE%", generateTable());
|
replaceVar("%TABLE%", generateTable());
|
||||||
replaceVar( "%HIGH-SCORE%", String.valueOf(getHighScore()));
|
replaceVar( "%HIGH-SCORE%", String.valueOf(getHighScore()));
|
||||||
|
|
@ -219,4 +286,4 @@ public class CompetitorList {
|
||||||
replaceVar( "%SCORE"+i+"%", String.valueOf(freqs[i]));
|
replaceVar( "%SCORE"+i+"%", String.valueOf(freqs[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -11,16 +11,47 @@ import com.r0r5chach.competitor.valorant.ValorantAgent;
|
||||||
import javafx.beans.property.SimpleIntegerProperty;
|
import javafx.beans.property.SimpleIntegerProperty;
|
||||||
import javafx.beans.property.SimpleObjectProperty;
|
import javafx.beans.property.SimpleObjectProperty;
|
||||||
import javafx.beans.property.SimpleStringProperty;
|
import javafx.beans.property.SimpleStringProperty;
|
||||||
|
/**
|
||||||
|
* Class that defines the various attributes and methods associated with a Competitor Row for Table Views
|
||||||
|
* @author r0r5chach
|
||||||
|
*/
|
||||||
public class CompetitorRow {
|
public class CompetitorRow {
|
||||||
|
/**
|
||||||
|
* Attribute that stores the player's number as a property
|
||||||
|
*/
|
||||||
private SimpleIntegerProperty playerNumber;
|
private SimpleIntegerProperty playerNumber;
|
||||||
|
/**
|
||||||
|
* Attribute that stores the player's name as a property
|
||||||
|
*/
|
||||||
private SimpleStringProperty playerName;
|
private SimpleStringProperty playerName;
|
||||||
|
/**
|
||||||
|
* Attribute that stores the player's level as a property
|
||||||
|
*/
|
||||||
private SimpleObjectProperty<Rank> playerLevel;
|
private SimpleObjectProperty<Rank> playerLevel;
|
||||||
|
/**
|
||||||
|
* Attribute that stores the player's scores as a property
|
||||||
|
*/
|
||||||
private SimpleStringProperty scores;
|
private SimpleStringProperty scores;
|
||||||
|
/**
|
||||||
|
* Attribute that stores the player's favorite agent as a property
|
||||||
|
*/
|
||||||
private SimpleStringProperty favoriteAgent;
|
private SimpleStringProperty favoriteAgent;
|
||||||
|
/**
|
||||||
|
* Attribute that stores the player's favorite attacker as a property
|
||||||
|
*/
|
||||||
private SimpleStringProperty favoriteAttacker;
|
private SimpleStringProperty favoriteAttacker;
|
||||||
|
/**
|
||||||
|
* Attribute that stores the player's favorite defender as a property
|
||||||
|
*/
|
||||||
private SimpleStringProperty favoriteDefender;
|
private SimpleStringProperty favoriteDefender;
|
||||||
|
/**
|
||||||
|
* Constructs a CompetitorRow Object with the specified attributes
|
||||||
|
* Sets favorite characters to "N/A" as none are specified
|
||||||
|
* @param playerNumber the player's number
|
||||||
|
* @param playerName the player's name
|
||||||
|
* @param playerLevel the player's level
|
||||||
|
* @param scores the player's scores
|
||||||
|
*/
|
||||||
public CompetitorRow(int playerNumber, Name playerName, Rank playerLevel, int[] scores) {
|
public CompetitorRow(int playerNumber, Name playerName, Rank playerLevel, int[] scores) {
|
||||||
this.playerNumber = new SimpleIntegerProperty(playerNumber);
|
this.playerNumber = new SimpleIntegerProperty(playerNumber);
|
||||||
this.playerName = new SimpleStringProperty(playerName.getFullName());
|
this.playerName = new SimpleStringProperty(playerName.getFullName());
|
||||||
|
|
@ -30,7 +61,15 @@ public class CompetitorRow {
|
||||||
favoriteAttacker = new SimpleStringProperty("N/A");
|
favoriteAttacker = new SimpleStringProperty("N/A");
|
||||||
favoriteDefender = new SimpleStringProperty("N/A");
|
favoriteDefender = new SimpleStringProperty("N/A");
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Constructs a CompetitorRow Object with the specified attributes
|
||||||
|
* Sets favorite attacker and defender to "N/A" as none are specified
|
||||||
|
* @param playerNumber the player's number
|
||||||
|
* @param playerName the player's name
|
||||||
|
* @param playerLevel the player's level
|
||||||
|
* @param scores the player's scores
|
||||||
|
* @param favoriteAgent the player's favorite agent
|
||||||
|
*/
|
||||||
public CompetitorRow(int playerNumber, Name playerName, Rank playerLevel, int[] scores, ValorantAgent favoriteAgent) {
|
public CompetitorRow(int playerNumber, Name playerName, Rank playerLevel, int[] scores, ValorantAgent favoriteAgent) {
|
||||||
this.playerNumber = new SimpleIntegerProperty(playerNumber);
|
this.playerNumber = new SimpleIntegerProperty(playerNumber);
|
||||||
this.playerName = new SimpleStringProperty(playerName.getFullName());
|
this.playerName = new SimpleStringProperty(playerName.getFullName());
|
||||||
|
|
@ -40,7 +79,16 @@ public class CompetitorRow {
|
||||||
favoriteAttacker = new SimpleStringProperty("N/A");
|
favoriteAttacker = new SimpleStringProperty("N/A");
|
||||||
favoriteDefender = new SimpleStringProperty("N/A");
|
favoriteDefender = new SimpleStringProperty("N/A");
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Constructs a CompetitorRow Object with the specified attributes
|
||||||
|
* Sets favorite agent to "N/A" as none are specified
|
||||||
|
* @param playerNumber the player's number
|
||||||
|
* @param playerName the player's name
|
||||||
|
* @param playerLevel the player's level
|
||||||
|
* @param scores the player's scores
|
||||||
|
* @param favoriteAttacker the player's favorite attacker
|
||||||
|
* @param favoriteDefender the player's favorite defender
|
||||||
|
*/
|
||||||
public CompetitorRow(int playerNumber, Name playerName, Rank playerLevel, int[] scores, R6Attacker favoriteAttacker, R6Defender favoriteDefender) {
|
public CompetitorRow(int playerNumber, Name playerName, Rank playerLevel, int[] scores, R6Attacker favoriteAttacker, R6Defender favoriteDefender) {
|
||||||
this.playerName = new SimpleStringProperty(playerName.getFullName());
|
this.playerName = new SimpleStringProperty(playerName.getFullName());
|
||||||
this.playerNumber = new SimpleIntegerProperty(playerNumber);
|
this.playerNumber = new SimpleIntegerProperty(playerNumber);
|
||||||
|
|
@ -50,26 +98,53 @@ public class CompetitorRow {
|
||||||
this.favoriteAttacker = new SimpleStringProperty(favoriteAttacker.getAttacker());
|
this.favoriteAttacker = new SimpleStringProperty(favoriteAttacker.getAttacker());
|
||||||
this.favoriteDefender = new SimpleStringProperty(favoriteDefender.getDefender());
|
this.favoriteDefender = new SimpleStringProperty(favoriteDefender.getDefender());
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Get the player's number
|
||||||
|
* @return the player's number
|
||||||
|
*/
|
||||||
public int getPlayerNumber() {
|
public int getPlayerNumber() {
|
||||||
return playerNumber.get();
|
return playerNumber.get();
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Get the player's name
|
||||||
|
* @return the player's name
|
||||||
|
*/
|
||||||
public String getPlayerName() {
|
public String getPlayerName() {
|
||||||
return playerName.get();
|
return playerName.get();
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Get the player's level
|
||||||
|
* @return the player's level
|
||||||
|
*/
|
||||||
public Rank getPlayerLevel() {
|
public Rank getPlayerLevel() {
|
||||||
return playerLevel.get();
|
return playerLevel.get();
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Get the player's scores
|
||||||
|
* @return the player's scores
|
||||||
|
*/
|
||||||
public String getScores() {
|
public String getScores() {
|
||||||
return scores.get();
|
return scores.get();
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Get the player's favorite agent
|
||||||
|
* @return the player's favorite agent
|
||||||
|
*/
|
||||||
public String getFavoriteAgent() {
|
public String getFavoriteAgent() {
|
||||||
return favoriteAgent.get();
|
return favoriteAgent.get();
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Get the player's favorite attacker
|
||||||
|
* @return the player's favorite attacker
|
||||||
|
*/
|
||||||
public String getFavoriteAttacker() {
|
public String getFavoriteAttacker() {
|
||||||
return favoriteAttacker.get();
|
return favoriteAttacker.get();
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Get the player's favorite defender
|
||||||
|
* @return the player's favorite defender
|
||||||
|
*/
|
||||||
public String getFavoriteDefender() {
|
public String getFavoriteDefender() {
|
||||||
return favoriteDefender.get();
|
return favoriteDefender.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -15,15 +15,32 @@ import javafx.fxml.FXMLLoader;
|
||||||
import javafx.scene.Parent;
|
import javafx.scene.Parent;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
|
/**
|
||||||
|
* Class that contains the main method and starts the GUI
|
||||||
|
* @author r0r5chach
|
||||||
|
*/
|
||||||
public class Manager extends Application {
|
public class Manager extends Application {
|
||||||
|
/**
|
||||||
|
* Attribute that stores the GUI's scene
|
||||||
|
*/
|
||||||
private static Scene scene;
|
private static Scene scene;
|
||||||
|
/**
|
||||||
|
* Attribute that stores the GUI's stage
|
||||||
|
*/
|
||||||
public static Stage stage;
|
public static Stage stage;
|
||||||
|
/**
|
||||||
|
* Attribute that stores the program's competitors
|
||||||
|
*/
|
||||||
private static CompetitorList competitors;
|
private static CompetitorList competitors;
|
||||||
|
/**
|
||||||
|
* Attribute that stores the currently active controller
|
||||||
|
*/
|
||||||
private static Controller controller;
|
private static Controller controller;
|
||||||
|
/**
|
||||||
|
* Creates the GUI and competitor list, then sets the main View
|
||||||
|
* @param stage the stage to use for the GUI
|
||||||
|
* @throws IOException if the scene's FXML file cannot be found
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void start(Stage stage) throws IOException {
|
public void start(Stage stage) throws IOException {
|
||||||
competitors = createList();
|
competitors = createList();
|
||||||
|
|
@ -33,7 +50,9 @@ public class Manager extends Application {
|
||||||
Manager.stage.setScene(scene);
|
Manager.stage.setScene(scene);
|
||||||
Manager.stage.show();
|
Manager.stage.show();
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Stops the GUI and outputs a report file
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void stop() {
|
public void stop() {
|
||||||
try {
|
try {
|
||||||
|
|
@ -43,11 +62,20 @@ public class Manager extends Application {
|
||||||
createErrorLog(e, "src/main/resources/com/r0r5chach/log.txt");
|
createErrorLog(e, "src/main/resources/com/r0r5chach/log.txt");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Change the root for the scene
|
||||||
|
* @param fxml the view to be loaded
|
||||||
|
* @throws IOException if the view file cannot be found
|
||||||
|
*/
|
||||||
public static void setRoot(String fxml) throws IOException {
|
public static void setRoot(String fxml) throws IOException {
|
||||||
scene.setRoot(loadFXML(fxml));
|
scene.setRoot(loadFXML(fxml));
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Load an FXML file
|
||||||
|
* @param fxml the file to be loaded
|
||||||
|
* @return the root to change the scene to
|
||||||
|
* @throws IOException if the file cannot be found
|
||||||
|
*/
|
||||||
public static Parent loadFXML(String fxml) throws IOException {
|
public static Parent loadFXML(String fxml) throws IOException {
|
||||||
FXMLLoader fxmlLoader = new FXMLLoader(Manager.class.getResource(fxml + ".fxml"));
|
FXMLLoader fxmlLoader = new FXMLLoader(Manager.class.getResource(fxml + ".fxml"));
|
||||||
Parent root = fxmlLoader.load();
|
Parent root = fxmlLoader.load();
|
||||||
|
|
@ -74,15 +102,20 @@ public class Manager extends Application {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Launch the GUI
|
||||||
|
* @param args the arguments passed to the program
|
||||||
|
*/
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
launch();
|
launch();
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Create the competitor list
|
||||||
|
* @return the competitor list
|
||||||
|
*/
|
||||||
private CompetitorList createList() {
|
private CompetitorList createList() {
|
||||||
CompetitorList competitors = null;
|
CompetitorList competitors = null;
|
||||||
File valorantPlayers = new File("src/main/resources/com/r0r5chach/valorantPlayers.txt");
|
File valorantPlayers = new File("src/main/resources/com/r0r5chach/valorantPlayers.txt");
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,6 @@ public class Name {
|
||||||
/**
|
/**
|
||||||
* Get the initials of the stored name
|
* Get the initials of the stored name
|
||||||
* @return a string containing the initials
|
* @return a string containing the initials
|
||||||
* @author r0r5chach
|
|
||||||
*/
|
*/
|
||||||
public String getInitials() {
|
public String getInitials() {
|
||||||
String result = firstName.substring(0,1);
|
String result = firstName.substring(0,1);
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ import javafx.scene.control.TabPane;
|
||||||
/**
|
/**
|
||||||
* Class that defines a generic controller for the GUI
|
* Class that defines a generic controller for the GUI
|
||||||
* Inherits from javafx.fxml.Initializable
|
* Inherits from javafx.fxml.Initializable
|
||||||
|
* @author r0r5chach
|
||||||
*/
|
*/
|
||||||
public class Controller implements Initializable {
|
public class Controller implements Initializable {
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ import javafx.scene.text.Text;
|
||||||
/**
|
/**
|
||||||
* Class that defines the controller for the edit View (edit.fxml) of the GUI
|
* Class that defines the controller for the edit View (edit.fxml) of the GUI
|
||||||
* Inherits from com.r0r5chach.controllers.Controller
|
* Inherits from com.r0r5chach.controllers.Controller
|
||||||
|
* @author r0r5chach
|
||||||
*/
|
*/
|
||||||
public class EditController extends Controller {
|
public class EditController extends Controller {
|
||||||
/**
|
/**
|
||||||
|
|
@ -121,7 +122,7 @@ public class EditController extends Controller {
|
||||||
* @param rb The resources used to localize the root object
|
* @param rb The resources used to localize the root object
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void initialize(URL location, ResourceBundle resources) {
|
public void initialize(URL url, ResourceBundle rb) {
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
textFields = new TextField[]{playerNumber, playerName, overallScore};
|
textFields = new TextField[]{playerNumber, playerName, overallScore};
|
||||||
scoreFields = new TextField[]{scores0, scores1, scores2, scores3, scores4, scores5};
|
scoreFields = new TextField[]{scores0, scores1, scores2, scores3, scores4, scores5};
|
||||||
|
|
|
||||||
|
|
@ -13,41 +13,60 @@ import javafx.collections.FXCollections;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.fxml.Initializable;
|
import javafx.fxml.Initializable;
|
||||||
import javafx.scene.control.ChoiceBox;
|
import javafx.scene.control.ChoiceBox;
|
||||||
import javafx.scene.control.TextArea;
|
|
||||||
import javafx.scene.control.TextField;
|
import javafx.scene.control.TextField;
|
||||||
import javafx.scene.control.ToggleGroup;
|
import javafx.scene.control.ToggleGroup;
|
||||||
import javafx.scene.control.RadioButton;
|
import javafx.scene.control.RadioButton;
|
||||||
/**
|
/**
|
||||||
* Class that defines the controller for the filters View (filters.fxml) of the GUI
|
* Class that defines the controller for the filters View (filters.fxml) of the GUI
|
||||||
* Inherits from com.r0r5chach.controllers.Controller
|
* Inherits from com.r0r5chach.controllers.Controller
|
||||||
|
* @author r0r5chach
|
||||||
*/
|
*/
|
||||||
public class FiltersController implements Initializable {
|
public class FiltersController implements Initializable {
|
||||||
|
/**
|
||||||
|
* Attribute that stores the filter for player number for the filter View
|
||||||
|
*/
|
||||||
@FXML
|
@FXML
|
||||||
private TextField numberFilter;
|
private TextField numberFilter;
|
||||||
|
/**
|
||||||
|
* Attribute that stores the filter for player name for the filter View
|
||||||
|
*/
|
||||||
@FXML
|
@FXML
|
||||||
private TextField nameFilter;
|
private TextField nameFilter;
|
||||||
|
/**
|
||||||
|
* Attribute that stores the filter for player level for the filter View
|
||||||
|
*/
|
||||||
@FXML
|
@FXML
|
||||||
private ChoiceBox<Rank> levelFilter;
|
private ChoiceBox<Rank> levelFilter;
|
||||||
|
/**
|
||||||
|
* Attribute that stores the filter for player type for the filter View
|
||||||
|
*/
|
||||||
@FXML
|
@FXML
|
||||||
private ToggleGroup typeFilter;
|
private ToggleGroup typeFilter;
|
||||||
|
/**
|
||||||
|
* Attribute that stores the filter for player's favorite agent for the filter View
|
||||||
|
*/
|
||||||
@FXML
|
@FXML
|
||||||
private ChoiceBox<ValorantAgent> agentFilter;
|
private ChoiceBox<ValorantAgent> agentFilter;
|
||||||
|
/**
|
||||||
|
* Attribute that stores the filter for player's favorite attacker for the filter View
|
||||||
|
*/
|
||||||
@FXML
|
@FXML
|
||||||
private ChoiceBox<R6Attacker> attackerFilter;
|
private ChoiceBox<R6Attacker> attackerFilter;
|
||||||
|
/**
|
||||||
|
* Attribute that stores the filter for player's favorite defender for the filter View
|
||||||
|
*/
|
||||||
@FXML
|
@FXML
|
||||||
private ChoiceBox<R6Defender> defenderFilter;
|
private ChoiceBox<R6Defender> defenderFilter;
|
||||||
|
/**
|
||||||
@FXML
|
* Attribute that stores the Array of currently selected filters for the filter View
|
||||||
private TextArea filterBox;
|
*/
|
||||||
|
|
||||||
private static String[] filters;
|
private static String[] filters;
|
||||||
|
/**
|
||||||
|
* Method that runs when the program initializes the edit View
|
||||||
|
* (param details copied from super implementation)
|
||||||
|
* @param url The location used to resolve relative paths for the root object
|
||||||
|
* @param rb The resources used to localize the root object
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void initialize(URL url, ResourceBundle rb) {
|
public void initialize(URL url, ResourceBundle rb) {
|
||||||
attackerFilter.setItems(FXCollections.observableList(Arrays.asList(R6Attacker.values())));
|
attackerFilter.setItems(FXCollections.observableList(Arrays.asList(R6Attacker.values())));
|
||||||
|
|
@ -59,8 +78,17 @@ public class FiltersController implements Initializable {
|
||||||
levelFilter.setItems(FXCollections.observableList(Arrays.asList(Rank.values())));
|
levelFilter.setItems(FXCollections.observableList(Arrays.asList(Rank.values())));
|
||||||
levelFilter.setValue(Rank.NONE);
|
levelFilter.setValue(Rank.NONE);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
@FXML
|
* Gets the Array of currently selected filters
|
||||||
|
* @return the Array of currently selected filters
|
||||||
|
*/
|
||||||
|
public static String[] getFilters() {
|
||||||
|
return filters;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Sets the currently selected filters based off of the selections on the filters View
|
||||||
|
*/
|
||||||
|
@FXML //Triggers when mouse leaves the area of any of the selection boxes
|
||||||
private void setFilters() {
|
private void setFilters() {
|
||||||
String[] output = new String[7];
|
String[] output = new String[7];
|
||||||
for(int i= 0;i < output.length;i++ ) {
|
for(int i= 0;i < output.length;i++ ) {
|
||||||
|
|
@ -86,11 +114,11 @@ public class FiltersController implements Initializable {
|
||||||
|
|
||||||
filters = output;
|
filters = output;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
public static String[] getFilters() {
|
* Checks to see if a string is null
|
||||||
return filters;
|
* @param string The string to be checked
|
||||||
}
|
* @return true if null; false otherwise
|
||||||
|
*/
|
||||||
private boolean isNull(String string) {
|
private boolean isNull(String string) {
|
||||||
if (string == null) {
|
if (string == null) {
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -99,4 +127,4 @@ public class FiltersController implements Initializable {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2,7 +2,7 @@ package com.r0r5chach.controllers;
|
||||||
/**
|
/**
|
||||||
* Class that defines the controller for the main View (main.fxml) of the GUI
|
* Class that defines the controller for the main View (main.fxml) of the GUI
|
||||||
* Inherits from com.r0r5chach.controllers.Controller
|
* Inherits from com.r0r5chach.controllers.Controller
|
||||||
|
* @author r0r5chach
|
||||||
*/
|
*/
|
||||||
public class MainController extends Controller {
|
public class MainController extends Controller {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -11,14 +11,25 @@ import javafx.scene.control.TextArea;
|
||||||
/**
|
/**
|
||||||
* Class that defines the controller for the report View of the GUI
|
* Class that defines the controller for the report View of the GUI
|
||||||
* Inherits from com.r0r5chach.controllers.Controller
|
* Inherits from com.r0r5chach.controllers.Controller
|
||||||
|
* @author r0r5chach
|
||||||
*/
|
*/
|
||||||
public class ReportController extends Controller {
|
public class ReportController extends Controller {
|
||||||
|
/**
|
||||||
|
* Attribute that stores the competitor list for the report View
|
||||||
|
*/
|
||||||
@FXML
|
@FXML
|
||||||
private ListView<Integer> competitorList;
|
private ListView<Integer> competitorList;
|
||||||
|
/**
|
||||||
|
* Attribute that stores the output area for the report View
|
||||||
|
*/
|
||||||
@FXML
|
@FXML
|
||||||
private TextArea outputArea;
|
private TextArea outputArea;
|
||||||
|
/**
|
||||||
|
* Method that runs when the program initializes the edit View
|
||||||
|
* (param details copied from super implementation)
|
||||||
|
* @param url The location used to resolve relative paths for the root object
|
||||||
|
* @param rb The resources used to localize the root object
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void initialize(URL url, ResourceBundle rb) {
|
public void initialize(URL url, ResourceBundle rb) {
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
|
|
@ -26,8 +37,10 @@ public class ReportController extends Controller {
|
||||||
competitorList.setItems(FXCollections.observableList(competitorIds));
|
competitorList.setItems(FXCollections.observableList(competitorIds));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
@FXML
|
* Outputs the short details of the selected player to the output area
|
||||||
|
*/
|
||||||
|
@FXML //Triggers when the short details button is pressed
|
||||||
private void shortDetailsPress() {
|
private void shortDetailsPress() {
|
||||||
Integer item = competitorList.getSelectionModel().getSelectedItem();
|
Integer item = competitorList.getSelectionModel().getSelectedItem();
|
||||||
outputArea.clear();
|
outputArea.clear();
|
||||||
|
|
@ -38,8 +51,10 @@ public class ReportController extends Controller {
|
||||||
outputArea.setText("Select A Competitor");
|
outputArea.setText("Select A Competitor");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
@FXML
|
* Outputs the full details of the selected player to the output area
|
||||||
|
*/
|
||||||
|
@FXML //Triggers when the full details button is pressed
|
||||||
private void fullDetailsPress() {
|
private void fullDetailsPress() {
|
||||||
Integer item = competitorList.getSelectionModel().getSelectedItem();
|
Integer item = competitorList.getSelectionModel().getSelectedItem();
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
|
|
@ -50,4 +65,4 @@ public class ReportController extends Controller {
|
||||||
outputArea.setText("Select A Competitor");
|
outputArea.setText("Select A Competitor");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -7,6 +7,8 @@ import java.util.ResourceBundle;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
import static com.r0r5chach.controllers.FiltersController.getFilters;
|
import static com.r0r5chach.controllers.FiltersController.getFilters;
|
||||||
|
|
||||||
|
import com.r0r5chach.CompetitorList;
|
||||||
import com.r0r5chach.CompetitorRow;
|
import com.r0r5chach.CompetitorRow;
|
||||||
import com.r0r5chach.Manager;
|
import com.r0r5chach.Manager;
|
||||||
import com.r0r5chach.competitor.Competitor;
|
import com.r0r5chach.competitor.Competitor;
|
||||||
|
|
@ -24,36 +26,75 @@ import javafx.scene.Parent;
|
||||||
import javafx.scene.control.Button;
|
import javafx.scene.control.Button;
|
||||||
import javafx.scene.control.TableColumn;
|
import javafx.scene.control.TableColumn;
|
||||||
import javafx.scene.control.TableView;
|
import javafx.scene.control.TableView;
|
||||||
import javafx.scene.control.TextArea;
|
|
||||||
import javafx.scene.control.cell.PropertyValueFactory;
|
import javafx.scene.control.cell.PropertyValueFactory;
|
||||||
import javafx.stage.Popup;
|
import javafx.stage.Popup;
|
||||||
/**
|
/**
|
||||||
* Class that defines the Controller for the view View (view.fxml) of the GUI
|
* Class that defines the Controller for the view View (view.fxml) of the GUI
|
||||||
* Inherits from com.r0r5chach.controllers.Controller
|
* Inherits from com.r0r5chach.controllers.Controller
|
||||||
|
* @author r0r5chach
|
||||||
*/
|
*/
|
||||||
public class ViewController extends Controller {
|
public class ViewController extends Controller {
|
||||||
|
/**
|
||||||
|
* Attribute that stores the table view for the view View
|
||||||
|
*/
|
||||||
@FXML
|
@FXML
|
||||||
private TableView<CompetitorRow> competitorTable;
|
private TableView<CompetitorRow> competitorTable;
|
||||||
|
/**
|
||||||
|
* Attribute that stores the players' number column
|
||||||
|
*/
|
||||||
private TableColumn<CompetitorRow,Integer> playerNumCol;
|
private TableColumn<CompetitorRow,Integer> playerNumCol;
|
||||||
|
/**
|
||||||
|
* Attribute that stores the players' name column
|
||||||
|
*/
|
||||||
private TableColumn<CompetitorRow,String> playerNameCol;
|
private TableColumn<CompetitorRow,String> playerNameCol;
|
||||||
|
/**
|
||||||
|
* Attribute that stores the players' level column
|
||||||
|
*/
|
||||||
private TableColumn<CompetitorRow,Rank> playerLevelCol;
|
private TableColumn<CompetitorRow,Rank> playerLevelCol;
|
||||||
|
/**
|
||||||
|
* Attribute that stores the players' scores column
|
||||||
|
*/
|
||||||
private TableColumn<CompetitorRow,String> scoresCol;
|
private TableColumn<CompetitorRow,String> scoresCol;
|
||||||
|
/**
|
||||||
|
* Attribute that stores the players' favorite characters column
|
||||||
|
*/
|
||||||
private TableColumn<CompetitorRow,String> favoriteCharsCol;
|
private TableColumn<CompetitorRow,String> favoriteCharsCol;
|
||||||
|
/**
|
||||||
|
* Attribute that stores the players' favorite agent column
|
||||||
|
* This is a sub column of the players' favorite characters column
|
||||||
|
*/
|
||||||
private TableColumn<CompetitorRow,String> favoriteAgentCol;
|
private TableColumn<CompetitorRow,String> favoriteAgentCol;
|
||||||
|
/**
|
||||||
|
* Attribute that stores the players' favorite attacker column
|
||||||
|
* This is a sub column of the players' favorite characters column
|
||||||
|
*/
|
||||||
private TableColumn<CompetitorRow,String> favoriteAttackerCol;
|
private TableColumn<CompetitorRow,String> favoriteAttackerCol;
|
||||||
|
/**
|
||||||
|
* Attribute that stores the players' favorite defender column
|
||||||
|
* This is a sub column of the players' favorite characters column
|
||||||
|
*/
|
||||||
private TableColumn<CompetitorRow,String> favoriteDefenderCol;
|
private TableColumn<CompetitorRow,String> favoriteDefenderCol;
|
||||||
|
/**
|
||||||
|
* Attribute that stores the filter button for the view View
|
||||||
|
*/
|
||||||
@FXML
|
@FXML
|
||||||
private Button filterButton;
|
private Button filterButton;
|
||||||
|
/**
|
||||||
|
* Attribute that stores the filter popup
|
||||||
|
*/
|
||||||
private Popup filterPopup;
|
private Popup filterPopup;
|
||||||
|
/**
|
||||||
|
* Attribute that stores the Array that contains active filters
|
||||||
|
*/
|
||||||
private String[] filters;
|
private String[] filters;
|
||||||
|
/**
|
||||||
@FXML
|
* Method that runs when the program initializes the edit View
|
||||||
private TextArea filterBox;
|
* (param details copied from super implementation)
|
||||||
|
* @param url The location used to resolve relative paths for the root object
|
||||||
|
* @param rb The resources used to localize the root object
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void initialize(URL ul, ResourceBundle rb) {
|
public void initialize(URL url, ResourceBundle rb) {
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
filters = new String[]{"", "", "", "", "", "", ""};
|
filters = new String[]{"", "", "", "", "", "", ""};
|
||||||
filterPopup = new Popup();
|
filterPopup = new Popup();
|
||||||
|
|
@ -62,13 +103,29 @@ public class ViewController extends Controller {
|
||||||
loadView();
|
loadView();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Either opens the filters popup or saves the filter selection dependant on what state the button is in
|
||||||
|
*/
|
||||||
|
@FXML //Triggers when filter/save button is pressed
|
||||||
|
private void filterPress() {
|
||||||
|
switch(filterButton.getText().toLowerCase()) {
|
||||||
|
case "filters" -> filterDialog();
|
||||||
|
case "save" -> saveFilters();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Generates the table
|
||||||
|
*/
|
||||||
private void generateTable() {
|
private void generateTable() {
|
||||||
initColumns();
|
initColumns();
|
||||||
setColumnCellValues();
|
setColumnCellValues();
|
||||||
addColumns();
|
addColumns();
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Defines the predicate that controls filtering for the table
|
||||||
|
* @return The predicate
|
||||||
|
*/
|
||||||
private Predicate<CompetitorRow> filter() {
|
private Predicate<CompetitorRow> filter() {
|
||||||
Predicate<CompetitorRow> test = competitor -> {
|
Predicate<CompetitorRow> test = competitor -> {
|
||||||
boolean flag = true;
|
boolean flag = true;
|
||||||
|
|
@ -111,7 +168,11 @@ public class ViewController extends Controller {
|
||||||
};
|
};
|
||||||
return test;
|
return test;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Loads the rows of data into usable data for the table
|
||||||
|
* @param list The list of competitors to be loaded into the table
|
||||||
|
* @return The list of rows as usable data
|
||||||
|
*/
|
||||||
private ObservableList<CompetitorRow> loadTable(ArrayList<Competitor> list) {
|
private ObservableList<CompetitorRow> loadTable(ArrayList<Competitor> list) {
|
||||||
ArrayList<CompetitorRow> outputList = new ArrayList<>();
|
ArrayList<CompetitorRow> outputList = new ArrayList<>();
|
||||||
for(Competitor player: list) {
|
for(Competitor player: list) {
|
||||||
|
|
@ -124,7 +185,9 @@ public class ViewController extends Controller {
|
||||||
}
|
}
|
||||||
return FXCollections.observableArrayList(outputList);
|
return FXCollections.observableArrayList(outputList);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Loads the view View elements with their appropriate data
|
||||||
|
*/
|
||||||
private void loadView() {
|
private void loadView() {
|
||||||
ObservableList<CompetitorRow> table = loadTable(competitors.getCompetitors());
|
ObservableList<CompetitorRow> table = loadTable(competitors.getCompetitors());
|
||||||
generateTable();
|
generateTable();
|
||||||
|
|
@ -138,7 +201,9 @@ public class ViewController extends Controller {
|
||||||
competitorTable.setItems(table);
|
competitorTable.setItems(table);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Initializes the table columns
|
||||||
|
*/
|
||||||
private void initColumns() {
|
private void initColumns() {
|
||||||
playerNumCol = new TableColumn<CompetitorRow,Integer>("Player Number");
|
playerNumCol = new TableColumn<CompetitorRow,Integer>("Player Number");
|
||||||
playerNameCol = new TableColumn<CompetitorRow,String>("Player Name");
|
playerNameCol = new TableColumn<CompetitorRow,String>("Player Name");
|
||||||
|
|
@ -149,7 +214,9 @@ public class ViewController extends Controller {
|
||||||
favoriteAttackerCol = new TableColumn<CompetitorRow,String>("Attacker");
|
favoriteAttackerCol = new TableColumn<CompetitorRow,String>("Attacker");
|
||||||
favoriteDefenderCol = new TableColumn<CompetitorRow,String>("Defender");
|
favoriteDefenderCol = new TableColumn<CompetitorRow,String>("Defender");
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Sets the appropriate attribute to the corresponding column
|
||||||
|
*/
|
||||||
private void setColumnCellValues() {
|
private void setColumnCellValues() {
|
||||||
playerNumCol.setCellValueFactory(new PropertyValueFactory<CompetitorRow,Integer>("playerNumber"));
|
playerNumCol.setCellValueFactory(new PropertyValueFactory<CompetitorRow,Integer>("playerNumber"));
|
||||||
playerNameCol.setCellValueFactory(new PropertyValueFactory<CompetitorRow,String>("playerName"));
|
playerNameCol.setCellValueFactory(new PropertyValueFactory<CompetitorRow,String>("playerName"));
|
||||||
|
|
@ -159,7 +226,9 @@ public class ViewController extends Controller {
|
||||||
favoriteAttackerCol.setCellValueFactory(new PropertyValueFactory<CompetitorRow,String>("favoriteAttacker"));
|
favoriteAttackerCol.setCellValueFactory(new PropertyValueFactory<CompetitorRow,String>("favoriteAttacker"));
|
||||||
favoriteDefenderCol.setCellValueFactory(new PropertyValueFactory<CompetitorRow,String>("favoriteDefender"));
|
favoriteDefenderCol.setCellValueFactory(new PropertyValueFactory<CompetitorRow,String>("favoriteDefender"));
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Add the table columns to the table
|
||||||
|
*/
|
||||||
private void addColumns() {
|
private void addColumns() {
|
||||||
competitorTable.getColumns().add(playerNumCol);
|
competitorTable.getColumns().add(playerNumCol);
|
||||||
competitorTable.getColumns().add(playerNameCol);
|
competitorTable.getColumns().add(playerNameCol);
|
||||||
|
|
@ -170,31 +239,35 @@ public class ViewController extends Controller {
|
||||||
favoriteCharsCol.getColumns().add(favoriteDefenderCol);
|
favoriteCharsCol.getColumns().add(favoriteDefenderCol);
|
||||||
competitorTable.getColumns().add(favoriteCharsCol);
|
competitorTable.getColumns().add(favoriteCharsCol);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
@FXML
|
* Open the filters popup and change the state of the button
|
||||||
private void filterPress() throws IOException {
|
*/
|
||||||
switch(filterButton.getText().toLowerCase()) {
|
private void filterDialog() {
|
||||||
case "filters" -> filterDialog();
|
|
||||||
case "save" -> saveFilters();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void filterDialog() throws IOException {
|
|
||||||
filterPopup = new Popup();
|
filterPopup = new Popup();
|
||||||
Parent root = Manager.loadFXML("pages/filters");
|
Parent root = null;
|
||||||
|
try {
|
||||||
|
root = Manager.loadFXML("pages/filters");
|
||||||
|
}
|
||||||
|
catch (IOException e) {
|
||||||
|
CompetitorList.createErrorLog(e, "src/main/resources/com/r0r5chach");
|
||||||
|
}
|
||||||
filterPopup.getContent().add(root);
|
filterPopup.getContent().add(root);
|
||||||
filterPopup.show(Manager.stage);
|
filterPopup.show(Manager.stage);
|
||||||
filterButton.setText("Save");
|
filterButton.setText("Save");
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Save the filter selection from the filters popup
|
||||||
|
*/
|
||||||
private void saveFilters() {
|
private void saveFilters() {
|
||||||
filterPopup.hide();
|
filterPopup.hide();
|
||||||
filterButton.setText("Filters");
|
filterButton.setText("Filters");
|
||||||
filters = getFilters();
|
filters = getFilters();
|
||||||
loadView();
|
loadView();
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Checks if a filter is selected
|
||||||
|
* @return true if a filter is selected; false otherwise
|
||||||
|
*/
|
||||||
private boolean filterCheck() {
|
private boolean filterCheck() {
|
||||||
for(String filter: filters) {
|
for(String filter: filters) {
|
||||||
if (!filter.equals("")) {
|
if (!filter.equals("")) {
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,18 @@ import org.junit.jupiter.api.Test;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
/**
|
||||||
|
* Class that defines the test for com.r0r5chach.CompetitorList
|
||||||
|
* @author r0r5chach
|
||||||
|
*/
|
||||||
public class CompetitorListTest {
|
public class CompetitorListTest {
|
||||||
|
/**
|
||||||
|
* Attribute that stores the path to the test resources directory
|
||||||
|
*/
|
||||||
private String testPath = "src/test/resources";
|
private String testPath = "src/test/resources";
|
||||||
|
/**
|
||||||
|
* Tests CompetitorList.createReportFile(String)
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void competitorListCreateReportFileTest() {
|
public void competitorListCreateReportFileTest() {
|
||||||
char[] output = new char[10];
|
char[] output = new char[10];
|
||||||
|
|
@ -23,23 +32,31 @@ public class CompetitorListTest {
|
||||||
}
|
}
|
||||||
assertEquals("Competitor", String.valueOf(output));
|
assertEquals("Competitor", String.valueOf(output));
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Tests CompetitorList.createErrorLog(Exception, String)
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void CompetitorListCreateErrorLogTest() {
|
public void CompetitorListCreateErrorLogTest() {
|
||||||
String output = CompetitorList.createErrorLog(new IOException(), testPath+"/log.txt");
|
String output = CompetitorList.createErrorLog(new IOException(), testPath+"/log.txt");
|
||||||
assertEquals("java.io.IOException", output);
|
assertEquals("java.io.IOException", output);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Tests CompetitorList.readCompetitors()
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void competitorListReadCompetitorsTest() {
|
public void competitorListReadCompetitorsTest() {
|
||||||
//Already tested in competitorListCreateReportFileTest()
|
//Already tested in competitorListCreateReportFileTest()
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Tests CompetitorList.getCompetitors()
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void competitorListGetCompetitorsTest() {
|
public void competitorListGetCompetitorsTest() {
|
||||||
//Already tested in competitorListCreateReportFileTest()
|
//Already tested in competitorListCreateReportFileTest()
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Tests CompetitorList.CompetitorList()
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void competitorListTest() {
|
public void competitorListTest() {
|
||||||
//Already tested in competitorListCreateReportFileTest()
|
//Already tested in competitorListCreateReportFileTest()
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
package com.r0r5chach;
|
package com.r0r5chach;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import com.r0r5chach.competitor.Name;
|
import com.r0r5chach.competitor.Name;
|
||||||
|
|
@ -9,9 +8,14 @@ import com.r0r5chach.competitor.Rank;
|
||||||
import com.r0r5chach.competitor.valorant.ValorantAgent;
|
import com.r0r5chach.competitor.valorant.ValorantAgent;
|
||||||
import com.r0r5chach.competitor.r6.R6Attacker;
|
import com.r0r5chach.competitor.r6.R6Attacker;
|
||||||
import com.r0r5chach.competitor.r6.R6Defender;
|
import com.r0r5chach.competitor.r6.R6Defender;
|
||||||
|
/**
|
||||||
|
* Class that defines the test for com.r0r5chach.CompetitorRow
|
||||||
|
* @author r0r5chach
|
||||||
|
*/
|
||||||
public class CompetitorRowTest {
|
public class CompetitorRowTest {
|
||||||
|
/**
|
||||||
|
* Tests CompetitorRow.CompetitorRow(int, Name, Rank, int[])
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void competitorRowCompetitorTest() {
|
public void competitorRowCompetitorTest() {
|
||||||
CompetitorRow cR = new CompetitorRow(101, new Name("Joshua Perry"), Rank.GOLD, new int[]{5,5,5,5,5,5});
|
CompetitorRow cR = new CompetitorRow(101, new Name("Joshua Perry"), Rank.GOLD, new int[]{5,5,5,5,5,5});
|
||||||
|
|
@ -20,46 +24,70 @@ public class CompetitorRowTest {
|
||||||
assertEquals(Rank.GOLD, cR.getPlayerLevel());
|
assertEquals(Rank.GOLD, cR.getPlayerLevel());
|
||||||
assertEquals("5, 5, 5, 5, 5, 5", cR.getScores());
|
assertEquals("5, 5, 5, 5, 5, 5", cR.getScores());
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Tests CompetitorRow.CompetitorRow(int, Name, Rank, int[], ValorantAgent)
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void competitorRowValorantPlayerTest() {
|
public void competitorRowValorantPlayerTest() {
|
||||||
CompetitorRow cR = new CompetitorRow(101, new Name("Joshua Perry"), Rank.GOLD, new int[]{5,5,5,5,5,5}, ValorantAgent.ASTRA);
|
CompetitorRow cR = new CompetitorRow(101, new Name("Joshua Perry"), Rank.GOLD, new int[]{5,5,5,5,5,5}, ValorantAgent.ASTRA);
|
||||||
assertEquals(ValorantAgent.ASTRA.getAgent(), cR.getFavoriteAgent());
|
assertEquals(ValorantAgent.ASTRA.getAgent(), cR.getFavoriteAgent());
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Tests CompetitorRow.CompetitorRow(int, Name, Rank, int[], R6Attacker, R6Defender)
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void competitorRowR6PlayerTest() {
|
public void competitorRowR6PlayerTest() {
|
||||||
CompetitorRow cR = new CompetitorRow(101, new Name("Joshua Perry"), Rank.GOLD, new int[]{5,5,5,5,5,5}, R6Attacker.GLAZ, R6Defender.CASTLE);
|
CompetitorRow cR = new CompetitorRow(101, new Name("Joshua Perry"), Rank.GOLD, new int[]{5,5,5,5,5,5}, R6Attacker.GLAZ, R6Defender.CASTLE);
|
||||||
assertEquals(R6Attacker.GLAZ.getAttacker(), cR.getFavoriteAttacker());
|
assertEquals(R6Attacker.GLAZ.getAttacker(), cR.getFavoriteAttacker());
|
||||||
assertEquals(R6Defender.CASTLE.getDefender(), cR.getFavoriteDefender());
|
assertEquals(R6Defender.CASTLE.getDefender(), cR.getFavoriteDefender());
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Tests CompetitorRow.getPlayerNumber()
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void competitorRowGetPlayerNumberTest() {
|
public void competitorRowGetPlayerNumberTest() {
|
||||||
//Already tested in competitorRowCompetitorTest()
|
//Already tested in competitorRowCompetitorTest()
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Tests CompetitorRow.getPlayerName()
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void competitorRowGetPlayerNameTest() {
|
public void competitorRowGetPlayerNameTest() {
|
||||||
//Already tested in competitorRowCompetitorTest()
|
//Already tested in competitorRowCompetitorTest()
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Tests CompetitorRow.getPlayerLevel()
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void competitorRowGetPlayerLevelTest() {
|
public void competitorRowGetPlayerLevelTest() {
|
||||||
//Already tested in competitorRowCompetitorTest()
|
//Already tested in competitorRowCompetitorTest()
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Tests CompetitorRow.getScores()
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void competitorRowGetScoresTest() {
|
public void competitorRowGetScoresTest() {
|
||||||
//Already tested in competitorRowCompetitorTest()
|
//Already tested in competitorRowCompetitorTest()
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Tests CompetitorRow.getFavoriteAgent()
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void competitorRowGetFavoriteAgentTest() {
|
public void competitorRowGetFavoriteAgentTest() {
|
||||||
//Already tested in competitorRowValorantPlayerTest()
|
//Already tested in competitorRowValorantPlayerTest()
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Tests CompetitorRow.getFavoriteAttacker()
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void competitorRowGetFavoriteAttackerTest() {
|
public void competitorRowGetFavoriteAttackerTest() {
|
||||||
//Already tested in competitorRowR6PlayerTest()
|
//Already tested in competitorRowR6PlayerTest()
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Tests CompetitorRow.getFavoriteDefender()
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void competitorRowGetFavoriteDefenderTest() {
|
public void competitorRowGetFavoriteDefenderTest() {
|
||||||
//Already tested in competitorRowR6PlayerTest()
|
//Already tested in competitorRowR6PlayerTest()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
package com.r0r5chach;
|
package com.r0r5chach;
|
||||||
|
/**
|
||||||
|
* Class that defines the test for com.r0r5chach.competitor.Competitor
|
||||||
|
* @author r0r5chach
|
||||||
|
*/
|
||||||
public class CompetitorTest {
|
public class CompetitorTest {
|
||||||
//Already Tested in com.r0r5chach.ValorantPlayerTest.java
|
//Already Tested in com.r0r5chach.ValorantPlayerTest.java
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,19 @@
|
||||||
package com.r0r5chach;
|
package com.r0r5chach;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
import com.r0r5chach.controllers.Controller;
|
import com.r0r5chach.controllers.Controller;
|
||||||
|
/**
|
||||||
|
* Class that defines the test for com.r0r5chach.controllers.Controller
|
||||||
|
* @author r0r5chach
|
||||||
|
*/
|
||||||
public class ControllerTest {
|
public class ControllerTest {
|
||||||
|
/**
|
||||||
|
* Tests Controller.setCompetitors(CompetitorList)
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void controllerSetCompetitorsTest() {
|
public void controllerSetCompetitorsTest() {
|
||||||
Controller c = new Controller();
|
Controller c = new Controller();
|
||||||
|
|
@ -24,7 +28,9 @@ public class ControllerTest {
|
||||||
c.setCompetitors(cL);
|
c.setCompetitors(cL);
|
||||||
assertEquals(101, c.getCompetitors().getCompetitors().get(0).getPlayerNumber());
|
assertEquals(101, c.getCompetitors().getCompetitors().get(0).getPlayerNumber());
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Tests Controller.getCompetitors()
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void controllerGetCompetitorsTest() {
|
public void controllerGetCompetitorsTest() {
|
||||||
//Already tested in controllerSetCompetitorsTest()
|
//Already tested in controllerSetCompetitorsTest()
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,17 @@
|
||||||
package com.r0r5chach;
|
package com.r0r5chach;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import com.r0r5chach.controllers.FiltersController;
|
import com.r0r5chach.controllers.FiltersController;
|
||||||
|
/**
|
||||||
|
* Class that defines the test for com.r0r5chach.controllers.FiltersController
|
||||||
|
* @author r0r5chach
|
||||||
|
*/
|
||||||
public class FiltersControllerTest {
|
public class FiltersControllerTest {
|
||||||
|
/**
|
||||||
|
* Tests FiltersController.getFilters()
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void filtersControllerGetFiltersTest() {
|
public void filtersControllerGetFiltersTest() {
|
||||||
assertEquals(null, FiltersController.getFilters());
|
assertEquals(null, FiltersController.getFilters());
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,37 @@
|
||||||
package com.r0r5chach;
|
package com.r0r5chach;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import com.r0r5chach.competitor.Name;
|
import com.r0r5chach.competitor.Name;
|
||||||
|
/**
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
* Class that defines the test for com.r0r5chach.competitor.Name
|
||||||
|
* @author r0r5chach
|
||||||
|
*/
|
||||||
public class NameTest {
|
public class NameTest {
|
||||||
|
/**
|
||||||
|
* Tests Name.Name(String, String)
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void nameTestFNameLName() {
|
public void nameFNameLNameTest() {
|
||||||
Name n = new Name("Joshua", "Perry");
|
Name n = new Name("Joshua", "Perry");
|
||||||
assertEquals("Joshua", n.getFirstName());
|
assertEquals("Joshua", n.getFirstName());
|
||||||
assertEquals("", n.getMiddleName());
|
assertEquals("", n.getMiddleName());
|
||||||
assertEquals("Perry", n.getLastName());
|
assertEquals("Perry", n.getLastName());
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Tests Name.Name(String, String, String)
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void nameTestFNameMNameLName() {
|
public void nameFNameMNameLNameTest() {
|
||||||
Name n = new Name("Joshua", "Luke", "Perry");
|
Name n = new Name("Joshua", "Luke", "Perry");
|
||||||
assertEquals("Joshua", n.getFirstName());
|
assertEquals("Joshua", n.getFirstName());
|
||||||
assertEquals("Luke", n.getMiddleName());
|
assertEquals("Luke", n.getMiddleName());
|
||||||
assertEquals("Perry", n.getLastName());
|
assertEquals("Perry", n.getLastName());
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Tests Name.Name(String)
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void nameFullNameTest() {
|
public void nameFullNameTest() {
|
||||||
Name n = new Name("Joshua Luke Perry");
|
Name n = new Name("Joshua Luke Perry");
|
||||||
|
|
@ -35,7 +44,9 @@ public class NameTest {
|
||||||
assertEquals("", n.getMiddleName());
|
assertEquals("", n.getMiddleName());
|
||||||
assertEquals("Perry", n.getLastName());
|
assertEquals("Perry", n.getLastName());
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Tests Name.setFirstName(String)
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void nameSetFirstNameTest() {
|
public void nameSetFirstNameTest() {
|
||||||
Name n = new Name("Joshua Luke Perry");
|
Name n = new Name("Joshua Luke Perry");
|
||||||
|
|
@ -43,7 +54,9 @@ public class NameTest {
|
||||||
n.setFirstName("Bradley");
|
n.setFirstName("Bradley");
|
||||||
assertEquals("Bradley", n.getFirstName());
|
assertEquals("Bradley", n.getFirstName());
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Tests Name.setLastName(String)
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void nameSetLastNameTest() {
|
public void nameSetLastNameTest() {
|
||||||
Name n = new Name("Joshua Luke Perry");
|
Name n = new Name("Joshua Luke Perry");
|
||||||
|
|
@ -51,19 +64,25 @@ public class NameTest {
|
||||||
n.setLastName("Gordon-Taylor");
|
n.setLastName("Gordon-Taylor");
|
||||||
assertEquals("Gordon-Taylor", n.getLastName());
|
assertEquals("Gordon-Taylor", n.getLastName());
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Tests Name.getFistAndLastName()
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void nameGetFirstAndLastNameTest() {
|
public void nameGetFirstAndLastNameTest() {
|
||||||
Name n = new Name("Joshua Luke Perry");
|
Name n = new Name("Joshua Luke Perry");
|
||||||
assertEquals("Joshua Perry", n.getFirstAndLastName());
|
assertEquals("Joshua Perry", n.getFirstAndLastName());
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Tests Name.getLastCommaFirst()
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void nameGetLastCommaFirstTest() {
|
public void nameGetLastCommaFirstTest() {
|
||||||
Name n = new Name("Joshua Luke Perry");
|
Name n = new Name("Joshua Luke Perry");
|
||||||
assertEquals("Perry, Joshua", n.getLastCommaFirst());
|
assertEquals("Perry, Joshua", n.getLastCommaFirst());
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Tests Name.getFullName()
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void nameGetFullNameTest() {
|
public void nameGetFullNameTest() {
|
||||||
Name n = new Name("Joshua Luke Perry");
|
Name n = new Name("Joshua Luke Perry");
|
||||||
|
|
@ -71,7 +90,9 @@ public class NameTest {
|
||||||
n.setMiddleName("");
|
n.setMiddleName("");
|
||||||
assertEquals("Joshua Perry", n.getFullName());
|
assertEquals("Joshua Perry", n.getFullName());
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Tests Name.getInitials()
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void nameGetInitialsTest() {
|
public void nameGetInitialsTest() {
|
||||||
Name n = new Name("Joshua Luke Perry");
|
Name n = new Name("Joshua Luke Perry");
|
||||||
|
|
@ -79,25 +100,32 @@ public class NameTest {
|
||||||
n.setMiddleName("");
|
n.setMiddleName("");
|
||||||
assertEquals("JP", n.getInitials());
|
assertEquals("JP", n.getInitials());
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Tests Name.getFirstName()
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void nameGetFirstNameTest() {
|
public void nameGetFirstNameTest() {
|
||||||
//Already tested in nameFNameLNameTest()
|
//Already tested in nameFNameLNameTest()
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Tests Name.getMiddleName()
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void nameGetMiddleNameTest() {
|
public void nameGetMiddleNameTest() {
|
||||||
//Already tested in nameFNameMNameLNameTest()
|
//Already tested in nameFNameMNameLNameTest()
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Tests Name.getLastName()
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void nameGetLastNameTest() {
|
public void nameGetLastNameTest() {
|
||||||
//Already tested in nameFullNameTest()
|
//Already tested in nameFullNameTest()
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Tests Name.setMiddleName(String)
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void nameSetMiddleNameTest() {
|
public void nameSetMiddleNameTest() {
|
||||||
//Already tested in nameGetFullNameTest()
|
//Already tested in nameGetFullNameTest()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -4,12 +4,17 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import com.r0r5chach.competitor.r6.R6Attacker;
|
import com.r0r5chach.competitor.r6.R6Attacker;
|
||||||
|
/**
|
||||||
|
* Class that defines the test for com.r0r5chach.competitor.r6.R6Attacker
|
||||||
|
* @author r0r5chach
|
||||||
|
*/
|
||||||
public class R6AttackerTest {
|
public class R6AttackerTest {
|
||||||
|
/**
|
||||||
|
* Tests R6Attacker.getAttacker()
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void r6AttackerGetAttackerTest() {
|
public void r6AttackerGetAttackerTest() {
|
||||||
R6Attacker a = R6Attacker.GLAZ;
|
R6Attacker a = R6Attacker.GLAZ;
|
||||||
assertEquals("Glaz", a.getAttacker());
|
assertEquals("Glaz", a.getAttacker());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,16 +1,20 @@
|
||||||
package com.r0r5chach;
|
package com.r0r5chach;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import com.r0r5chach.competitor.r6.R6Defender;
|
import com.r0r5chach.competitor.r6.R6Defender;
|
||||||
|
/**
|
||||||
|
* Class that defines the test for com.r0r5chach.competitor.r6.R6Defender
|
||||||
|
* @author r0r5chach
|
||||||
|
*/
|
||||||
public class R6DefenderTest {
|
public class R6DefenderTest {
|
||||||
|
/**
|
||||||
|
* Tests R6Defender.getDefender()
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void r6AttackerGetAttackerTest() {
|
public void r6AttackerGetDefenderTest() {
|
||||||
R6Defender d = R6Defender.CASTLE;
|
R6Defender d = R6Defender.CASTLE;
|
||||||
assertEquals("Castle", d.getDefender());
|
assertEquals("Castle", d.getDefender());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
package com.r0r5chach;
|
package com.r0r5chach;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import com.r0r5chach.competitor.Name;
|
import com.r0r5chach.competitor.Name;
|
||||||
|
|
@ -9,9 +8,14 @@ import com.r0r5chach.competitor.Rank;
|
||||||
import com.r0r5chach.competitor.r6.R6Attacker;
|
import com.r0r5chach.competitor.r6.R6Attacker;
|
||||||
import com.r0r5chach.competitor.r6.R6Defender;
|
import com.r0r5chach.competitor.r6.R6Defender;
|
||||||
import com.r0r5chach.competitor.r6.R6Player;
|
import com.r0r5chach.competitor.r6.R6Player;
|
||||||
|
/**
|
||||||
|
* Class that defines the test for com.r0r5chach.competitor.r6.R6Player
|
||||||
|
* @author r0r5chach
|
||||||
|
*/
|
||||||
public class R6PlayerTest {
|
public class R6PlayerTest {
|
||||||
|
/**
|
||||||
|
* Tests R6Player.getFullDetails()
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void r6PlayerGetFullDetailsTest() {
|
public void r6PlayerGetFullDetailsTest() {
|
||||||
R6Player r6P = new R6Player(1, new Name("Joshua Perry"), Rank.BRONZE, R6Attacker.ACE, R6Defender.ALIBI, new int[]{5,5,5,5,5,5});
|
R6Player r6P = new R6Player(1, new Name("Joshua Perry"), Rank.BRONZE, R6Attacker.ACE, R6Defender.ALIBI, new int[]{5,5,5,5,5,5});
|
||||||
|
|
@ -28,30 +32,39 @@ public class R6PlayerTest {
|
||||||
Favorite Attacker: Amaru
|
Favorite Attacker: Amaru
|
||||||
Favorite Defender: Aruni""", r6P.getFullDetails());
|
Favorite Defender: Aruni""", r6P.getFullDetails());
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Tests R6Player.setFavoriteAttacker(R6Attacker)
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void r6PlayerSetFavoriteAttacker() {
|
public void r6PlayerSetFavoriteAttacker() {
|
||||||
//Already tested in r6PlayerGetFullDetailsTest()
|
//Already tested in r6PlayerGetFullDetailsTest()
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Tests R6Player.setFavoriteDefender(R6Defender)
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void r6PlayerSetFavoriteDefender() {
|
public void r6PlayerSetFavoriteDefender() {
|
||||||
//Already tested in r6PlayerGetFullDetailsTest()
|
//Already tested in r6PlayerGetFullDetailsTest()
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Tests R6Player.getFavoriteAttacker()
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void r6PlayerGetFavoriteAttacker() {
|
public void r6PlayerGetFavoriteAttacker() {
|
||||||
//Already tested in r6PlayerGetFullDetailsTest()
|
//Already tested in r6PlayerGetFullDetailsTest()
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Tests R6Player.getFavoriteAttacker()
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void r6PlayerGetFavoriteDefender() {
|
public void r6PlayerGetFavoriteDefender() {
|
||||||
//Already tested in r6PlayerGetFullDetailsTest()
|
//Already tested in r6PlayerGetFullDetailsTest()
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Tests R6Player.R6Player(int, Name, Rank, R6Attacker, R6Defender, int[])
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void r6PlayerTest() {
|
public void r6PlayerTest() {
|
||||||
//Already tested in r6PlayerGetFullDetailsTest()
|
//Already tested in r6PlayerGetFullDetailsTest()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -4,12 +4,17 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import com.r0r5chach.competitor.Rank;
|
import com.r0r5chach.competitor.Rank;
|
||||||
|
/**
|
||||||
|
* Class that defines the test for com.r0r5chach.competitor.Rank
|
||||||
|
* @author r0r5chach
|
||||||
|
*/
|
||||||
public class RankTest {
|
public class RankTest {
|
||||||
|
/**
|
||||||
|
* Tests Rank.getRank()
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void valorantRankGetRankTest() {
|
public void valorantRankGetRankTest() {
|
||||||
Rank vR = Rank.BRONZE;
|
Rank vR = Rank.BRONZE;
|
||||||
assertEquals("Bronze", vR.getRank());
|
assertEquals("Bronze", vR.getRank());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,13 +1,20 @@
|
||||||
package com.r0r5chach;
|
package com.r0r5chach;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import com.r0r5chach.competitor.valorant.ValorantAgent;
|
import com.r0r5chach.competitor.valorant.ValorantAgent;
|
||||||
|
/**
|
||||||
|
* Class that defines the test for com.r0r5chach.competitor.valorant.ValorantAgent
|
||||||
|
* @author r0r5chach
|
||||||
|
*/
|
||||||
public class ValorantAgentTest {
|
public class ValorantAgentTest {
|
||||||
|
/**
|
||||||
|
* Tests ValorantAgent.getAgent()
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void valorantAgentGetAgentTest() {
|
public void valorantAgentGetAgentTest() {
|
||||||
ValorantAgent vA = ValorantAgent.HARBOR;
|
ValorantAgent vA = ValorantAgent.HARBOR;
|
||||||
assertEquals("Harbor", vA.getAgent());
|
assertEquals("Harbor", vA.getAgent());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
package com.r0r5chach;
|
package com.r0r5chach;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
|
@ -6,7 +7,14 @@ import com.r0r5chach.competitor.Name;
|
||||||
import com.r0r5chach.competitor.Rank;
|
import com.r0r5chach.competitor.Rank;
|
||||||
import com.r0r5chach.competitor.valorant.ValorantAgent;
|
import com.r0r5chach.competitor.valorant.ValorantAgent;
|
||||||
import com.r0r5chach.competitor.valorant.ValorantPlayer;
|
import com.r0r5chach.competitor.valorant.ValorantPlayer;
|
||||||
|
/**
|
||||||
|
* Class that defines the test for com.r0r5chach.competitor.valorant.ValorantPlayer
|
||||||
|
* @author r0r5chach
|
||||||
|
*/
|
||||||
public class ValorantPlayerTest {
|
public class ValorantPlayerTest {
|
||||||
|
/**
|
||||||
|
* Tests ValorantPlayer.ValorantPlayer(int, Name, Rank, ValorantAgent, int[])
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void valorantPlayerTest() {
|
public void valorantPlayerTest() {
|
||||||
int[] scores = {5,5,5,5,5,5};
|
int[] scores = {5,5,5,5,5,5};
|
||||||
|
|
@ -17,7 +25,9 @@ public class ValorantPlayerTest {
|
||||||
assertEquals("Fade", vP.getFavoriteAgent().getAgent());
|
assertEquals("Fade", vP.getFavoriteAgent().getAgent());
|
||||||
assertEquals(5, vP.getOverallScore());
|
assertEquals(5, vP.getOverallScore());
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Tests ValorantPlayer.setPlayerNumber(int)
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void valorantPlayerTestSetPlayerNumber() {
|
public void valorantPlayerTestSetPlayerNumber() {
|
||||||
int[] scores = {5,5,5,5,5,5};
|
int[] scores = {5,5,5,5,5,5};
|
||||||
|
|
@ -26,7 +36,9 @@ public class ValorantPlayerTest {
|
||||||
vP.setPlayerNumber(5);
|
vP.setPlayerNumber(5);
|
||||||
assertEquals(5, vP.getPlayerNumber());
|
assertEquals(5, vP.getPlayerNumber());
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Tests ValorantPlayer.setPlayerName(Name)
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void valorantPlayerTestSetPlayerName() {
|
public void valorantPlayerTestSetPlayerName() {
|
||||||
int[] scores = {5,5,5,5,5,5};
|
int[] scores = {5,5,5,5,5,5};
|
||||||
|
|
@ -35,7 +47,9 @@ public class ValorantPlayerTest {
|
||||||
vP.setPlayerName(new Name("Bradley Gordon-Taylor"));
|
vP.setPlayerName(new Name("Bradley Gordon-Taylor"));
|
||||||
assertEquals("Bradley Gordon-Taylor", vP.getPlayerName().getFullName());
|
assertEquals("Bradley Gordon-Taylor", vP.getPlayerName().getFullName());
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Tests ValorantPlayer.setPlayerLevel(Rank)
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void valorantPlayerTestSetPlayerLevel() {
|
public void valorantPlayerTestSetPlayerLevel() {
|
||||||
int[] scores = {5,5,5,5,5,5};
|
int[] scores = {5,5,5,5,5,5};
|
||||||
|
|
@ -44,7 +58,9 @@ public class ValorantPlayerTest {
|
||||||
vP.setPlayerLevel(Rank.BRONZE);
|
vP.setPlayerLevel(Rank.BRONZE);
|
||||||
assertEquals("Bronze", vP.getPlayerLevel().getRank());
|
assertEquals("Bronze", vP.getPlayerLevel().getRank());
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Tests ValorantPlayer.setFavoriteAgent(ValorantAgent)
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void valorantPlayerTestSetFavoriteAgent() {
|
public void valorantPlayerTestSetFavoriteAgent() {
|
||||||
int[] scores = {5,5,5,5,5,5};
|
int[] scores = {5,5,5,5,5,5};
|
||||||
|
|
@ -53,7 +69,9 @@ public class ValorantPlayerTest {
|
||||||
vP.setFavoriteAgent(ValorantAgent.VIPER);
|
vP.setFavoriteAgent(ValorantAgent.VIPER);
|
||||||
assertEquals("Viper", vP.getFavoriteAgent().getAgent());
|
assertEquals("Viper", vP.getFavoriteAgent().getAgent());
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Tests ValorantPlayer.setScores(int[])
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void valorantPlayerTestSetScores() {
|
public void valorantPlayerTestSetScores() {
|
||||||
int[] scores = {5,5,5,5,5,5};
|
int[] scores = {5,5,5,5,5,5};
|
||||||
|
|
@ -62,14 +80,18 @@ public class ValorantPlayerTest {
|
||||||
vP.setScores(new int[]{0, 0, 0, 0, 0, 0});
|
vP.setScores(new int[]{0, 0, 0, 0, 0, 0});
|
||||||
assertEquals(0, vP.getOverallScore());
|
assertEquals(0, vP.getOverallScore());
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Tests ValorantPlayer.getOverallScore()
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void valorantPlayerTestGetOverallScore() {
|
public void valorantPlayerTestGetOverallScore() {
|
||||||
int[] scores = {5,5,5,5,5,5};
|
int[] scores = {5,5,5,5,5,5};
|
||||||
ValorantPlayer vP = new ValorantPlayer(2,new Name("Joshua Luke Perry"), Rank.GOLD, ValorantAgent.FADE, scores);
|
ValorantPlayer vP = new ValorantPlayer(2,new Name("Joshua Luke Perry"), Rank.GOLD, ValorantAgent.FADE, scores);
|
||||||
assertEquals(5, vP.getOverallScore());
|
assertEquals(5, vP.getOverallScore());
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Tests ValorantPlayer.getFullDetails()
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void valorantPlayerTestGetFullDetails() {
|
public void valorantPlayerTestGetFullDetails() {
|
||||||
int[] scores = {5,5,5,5,5,5};
|
int[] scores = {5,5,5,5,5,5};
|
||||||
|
|
@ -83,7 +105,9 @@ public class ValorantPlayerTest {
|
||||||
Overall Score: 5.0
|
Overall Score: 5.0
|
||||||
Favorite Agent: Fade""", vP.getFullDetails());
|
Favorite Agent: Fade""", vP.getFullDetails());
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Tests ValorantPlayer.getShortDetails()
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void valorantPlayerTestGetShortDetails() {
|
public void valorantPlayerTestGetShortDetails() {
|
||||||
int[] scores = {5,5,5,5,5,5};
|
int[] scores = {5,5,5,5,5,5};
|
||||||
|
|
@ -91,25 +115,32 @@ public class ValorantPlayerTest {
|
||||||
|
|
||||||
assertEquals("CN 2 (JLP) has overall score 5.0", vP.getShortDetails());
|
assertEquals("CN 2 (JLP) has overall score 5.0", vP.getShortDetails());
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Tests ValorantPlayer.getPlayerNumber()
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void valorantPlayerTestGetPlayerNumber() {
|
public void valorantPlayerTestGetPlayerNumber() {
|
||||||
//Already tested in valorantPlayerTest()
|
//Already tested in valorantPlayerTest()
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Tests ValorantPlayer.getPlayerName()
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void valorantPlayerTestGetPlayerName() {
|
public void valorantPlayerTestGetPlayerName() {
|
||||||
//Already tested in valorantPlayerTest()
|
//Already tested in valorantPlayerTest()
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Tests ValorantPlayer.getPlayerLevel()
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void valorantPlayerTestGetPlayerLevel() {
|
public void valorantPlayerTestGetPlayerLevel() {
|
||||||
//Already tested in valorantPlayerTest()
|
//Already tested in valorantPlayerTest()
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Tests ValorantPlayer.getFavoriteAgent()
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void valorantPlayerTestGetFavoriteAgent() {
|
public void valorantPlayerTestGetFavoriteAgent() {
|
||||||
//Already tested in valorantPlayerTest()
|
//Already tested in valorantPlayerTest()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue