Compare commits
No commits in common. "5375db795f8478908e983b1a47006c269e167422" and "2a7a7c81e366461d8c73d114c5916351672b8625" have entirely different histories.
5375db795f
...
2a7a7c81e3
|
|
@ -19,40 +19,20 @@ 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);
|
||||||
|
|
||||||
|
|
@ -65,60 +45,7 @@ public class CompetitorList {
|
||||||
}
|
}
|
||||||
reader.close();
|
reader.close();
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Create a text file containing a report on the currently held competitors at the specified path
|
|
||||||
* @param pathString the absolute path of the folder the report should be made in
|
|
||||||
* @return the text file
|
|
||||||
* @throws IOException if the file cannot be made at that path
|
|
||||||
*/
|
|
||||||
public File createReportFile(String pathString) throws IOException {
|
|
||||||
boolean exists;
|
|
||||||
int count = 0;
|
|
||||||
Path path;
|
|
||||||
FileWriter report = null;
|
|
||||||
|
|
||||||
do {
|
|
||||||
path = Path.of(pathString+"/report"+count+ ".txt");
|
|
||||||
exists = Files.exists(path);
|
|
||||||
|
|
||||||
if(exists) {
|
|
||||||
count += 1;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Files.createFile(path);
|
|
||||||
report = new FileWriter(String.valueOf(path));
|
|
||||||
}
|
|
||||||
}while (exists);
|
|
||||||
|
|
||||||
generateReportContents();
|
|
||||||
report.append(reportContents);
|
|
||||||
report.close();
|
|
||||||
reportContents = reportTemplate();
|
|
||||||
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) {
|
|
||||||
try {
|
|
||||||
FileWriter log = new FileWriter(path);
|
|
||||||
log.append(String.valueOf(e));
|
|
||||||
log.close();
|
|
||||||
return Files.readString(Path.of(path));
|
|
||||||
}
|
|
||||||
catch (IOException ie) {
|
|
||||||
return "Error";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 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) {
|
private ValorantPlayer parseValorantPlayer(String[] row) {
|
||||||
int playerNumber = Integer.parseInt(row[0]);
|
int playerNumber = Integer.parseInt(row[0]);
|
||||||
Name playerName = new Name(row[1]);
|
Name playerName = new Name(row[1]);
|
||||||
|
|
@ -127,11 +54,7 @@ public class CompetitorList {
|
||||||
int[] scores = parseScores(row[4]);
|
int[] scores = parseScores(row[4]);
|
||||||
return new ValorantPlayer(playerNumber, playerName, playerLevel, favoriteAgent, scores);
|
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) {
|
private R6Player parseR6Player(String[] row) {
|
||||||
int playerNumber = Integer.parseInt(row[0]);
|
int playerNumber = Integer.parseInt(row[0]);
|
||||||
Name playerName = new Name(row[1]);
|
Name playerName = new Name(row[1]);
|
||||||
|
|
@ -141,23 +64,16 @@ public class CompetitorList {
|
||||||
int[] scores = parseScores(row[5]);
|
int[] scores = parseScores(row[5]);
|
||||||
return new R6Player(playerNumber, playerName, playerLevel, favoriteAttacker, favoriteDefender, scores);
|
return new R6Player(playerNumber, playerName, playerLevel, favoriteAttacker, favoriteDefender, scores);
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Parse the scores stored in a row
|
private int[] parseScores(String row) {
|
||||||
* @param list the list of scores to be parsed
|
String[] scores = row.split(",");
|
||||||
* @return an Array of the scores
|
|
||||||
*/
|
|
||||||
private int[] parseScores(String list) {
|
|
||||||
String[] scores = list.split(",");
|
|
||||||
int[] parsedScores = new int[scores.length];
|
int[] parsedScores = new int[scores.length];
|
||||||
for (int i = 0; i < scores.length; i++) {
|
for (int i = 0; i < scores.length; i++) {
|
||||||
parsedScores[i] = Integer.parseInt(scores[i]);
|
parsedScores[i] = Integer.parseInt(scores[i]);
|
||||||
}
|
}
|
||||||
return parsedScores;
|
return parsedScores;
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Generate a string that represents a table of the competitors and their attributes
|
|
||||||
* @return the string
|
|
||||||
*/
|
|
||||||
private String generateTable() {
|
private String generateTable() {
|
||||||
StringBuilder table = new StringBuilder("Competitor Level Scores Overall Favorite Character(s)");
|
StringBuilder table = new StringBuilder("Competitor Level Scores Overall Favorite Character(s)");
|
||||||
Competitor best = null;
|
Competitor best = null;
|
||||||
|
|
@ -183,10 +99,7 @@ public class CompetitorList {
|
||||||
table.append("\n\n").append(best.getFullDetails());
|
table.append("\n\n").append(best.getFullDetails());
|
||||||
return table.toString();
|
return table.toString();
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Generate the frequency of each player level across all competitors
|
|
||||||
* @return an Array of the frequencies
|
|
||||||
*/
|
|
||||||
private int[] generateLevelFreqs() {
|
private int[] generateLevelFreqs() {
|
||||||
int[] freqs = {0, 0, 0, 0};
|
int[] freqs = {0, 0, 0, 0};
|
||||||
for (Competitor player: getCompetitors()) {
|
for (Competitor player: getCompetitors()) {
|
||||||
|
|
@ -200,10 +113,7 @@ public class CompetitorList {
|
||||||
}
|
}
|
||||||
return freqs;
|
return freqs;
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Generate the frequency of achieved scores across all competitors
|
|
||||||
* @return an Array of the frequencies
|
|
||||||
*/
|
|
||||||
private int[] generateScoreFreqs() {
|
private int[] generateScoreFreqs() {
|
||||||
int[] freqs = {0, 0, 0, 0, 0, 0};
|
int[] freqs = {0, 0, 0, 0, 0, 0};
|
||||||
for (Competitor player: getCompetitors()) {
|
for (Competitor player: getCompetitors()) {
|
||||||
|
|
@ -220,10 +130,7 @@ public class CompetitorList {
|
||||||
}
|
}
|
||||||
return freqs;
|
return freqs;
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Generate the average score across all competitors
|
|
||||||
* @return the average scores
|
|
||||||
*/
|
|
||||||
private double generateAverageScore() {
|
private double generateAverageScore() {
|
||||||
double avg = 0;
|
double avg = 0;
|
||||||
int totalScores = 0;
|
int totalScores = 0;
|
||||||
|
|
@ -236,10 +143,7 @@ public class CompetitorList {
|
||||||
avg /= totalScores;
|
avg /= totalScores;
|
||||||
return avg;
|
return avg;
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Generate the highest score achieved across all competitors
|
|
||||||
* @return the highest score
|
|
||||||
*/
|
|
||||||
private double getHighScore() {
|
private double getHighScore() {
|
||||||
double hS = 0;
|
double hS = 0;
|
||||||
for (Competitor player: getCompetitors()) {
|
for (Competitor player: getCompetitors()) {
|
||||||
|
|
@ -250,26 +154,55 @@ public class CompetitorList {
|
||||||
|
|
||||||
return hS;
|
return hS;
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Replace the specified target substring in the report and replace it with the replacement string
|
public File createReportFile(String pathString) throws IOException {
|
||||||
* @param target the target substring
|
boolean exists;
|
||||||
* @param replacement the replacement string
|
int count = 0;
|
||||||
*/
|
Path path;
|
||||||
|
FileWriter report = null;
|
||||||
|
|
||||||
|
do {
|
||||||
|
path = Path.of(pathString+"/report"+count+ ".txt");
|
||||||
|
exists = Files.exists(path);
|
||||||
|
|
||||||
|
if(exists) {
|
||||||
|
count += 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Files.createFile(path);
|
||||||
|
report = new FileWriter(String.valueOf(path));
|
||||||
|
}
|
||||||
|
}while (exists);
|
||||||
|
|
||||||
|
generateReportContents();
|
||||||
|
report.append(reportContents);
|
||||||
|
report.close();
|
||||||
|
reportContents = reportTemplate();
|
||||||
|
return new File(path.toUri());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String createErrorLog(Exception e, String path) {
|
||||||
|
try {
|
||||||
|
FileWriter log = new FileWriter(path);
|
||||||
|
log.append(String.valueOf(e));
|
||||||
|
log.close();
|
||||||
|
return Files.readString(Path.of(path));
|
||||||
|
}
|
||||||
|
catch (IOException ie) {
|
||||||
|
return "Error";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
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()));
|
||||||
|
|
|
||||||
|
|
@ -11,47 +11,16 @@ 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());
|
||||||
|
|
@ -61,15 +30,7 @@ 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());
|
||||||
|
|
@ -79,16 +40,7 @@ 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);
|
||||||
|
|
@ -98,52 +50,25 @@ 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,32 +15,15 @@ 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();
|
||||||
|
|
@ -50,9 +33,7 @@ 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 {
|
||||||
|
|
@ -62,20 +43,11 @@ 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();
|
||||||
|
|
@ -103,19 +75,14 @@ public class Manager extends Application {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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,6 +117,7 @@ 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,7 +19,6 @@ 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,7 +24,6 @@ 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 {
|
||||||
/**
|
/**
|
||||||
|
|
@ -122,7 +121,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 url, ResourceBundle rb) {
|
public void initialize(URL location, ResourceBundle resources) {
|
||||||
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,60 +13,41 @@ 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;
|
||||||
/**
|
|
||||||
* Attribute that stores the Array of currently selected filters for the filter View
|
@FXML
|
||||||
*/
|
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())));
|
||||||
|
|
@ -78,17 +59,8 @@ 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);
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Gets the Array of currently selected filters
|
@FXML
|
||||||
* @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++ ) {
|
||||||
|
|
@ -114,11 +86,11 @@ public class FiltersController implements Initializable {
|
||||||
|
|
||||||
filters = output;
|
filters = output;
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Checks to see if a string is null
|
public static String[] getFilters() {
|
||||||
* @param string The string to be checked
|
return filters;
|
||||||
* @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;
|
||||||
|
|
|
||||||
|
|
@ -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,25 +11,14 @@ 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(() -> {
|
||||||
|
|
@ -37,10 +26,8 @@ public class ReportController extends Controller {
|
||||||
competitorList.setItems(FXCollections.observableList(competitorIds));
|
competitorList.setItems(FXCollections.observableList(competitorIds));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Outputs the short details of the selected player to the output area
|
@FXML
|
||||||
*/
|
|
||||||
@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();
|
||||||
|
|
@ -51,10 +38,8 @@ public class ReportController extends Controller {
|
||||||
outputArea.setText("Select A Competitor");
|
outputArea.setText("Select A Competitor");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Outputs the full details of the selected player to the output area
|
@FXML
|
||||||
*/
|
|
||||||
@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) {
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,6 @@ 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;
|
||||||
|
|
@ -26,75 +24,36 @@ 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;
|
||||||
/**
|
|
||||||
* Method that runs when the program initializes the edit View
|
@FXML
|
||||||
* (param details copied from super implementation)
|
private TextArea filterBox;
|
||||||
* @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 ul, ResourceBundle rb) {
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
filters = new String[]{"", "", "", "", "", "", ""};
|
filters = new String[]{"", "", "", "", "", "", ""};
|
||||||
filterPopup = new Popup();
|
filterPopup = new Popup();
|
||||||
|
|
@ -103,29 +62,13 @@ 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;
|
||||||
|
|
@ -168,11 +111,7 @@ 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) {
|
||||||
|
|
@ -185,9 +124,7 @@ 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();
|
||||||
|
|
@ -201,9 +138,7 @@ 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");
|
||||||
|
|
@ -214,9 +149,7 @@ 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"));
|
||||||
|
|
@ -226,9 +159,7 @@ 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);
|
||||||
|
|
@ -239,35 +170,31 @@ public class ViewController extends Controller {
|
||||||
favoriteCharsCol.getColumns().add(favoriteDefenderCol);
|
favoriteCharsCol.getColumns().add(favoriteDefenderCol);
|
||||||
competitorTable.getColumns().add(favoriteCharsCol);
|
competitorTable.getColumns().add(favoriteCharsCol);
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Open the filters popup and change the state of the button
|
@FXML
|
||||||
*/
|
private void filterPress() throws IOException {
|
||||||
private void filterDialog() {
|
switch(filterButton.getText().toLowerCase()) {
|
||||||
|
case "filters" -> filterDialog();
|
||||||
|
case "save" -> saveFilters();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void filterDialog() throws IOException {
|
||||||
filterPopup = new Popup();
|
filterPopup = new Popup();
|
||||||
Parent root = null;
|
Parent root = Manager.loadFXML("pages/filters");
|
||||||
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,18 +6,9 @@ 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];
|
||||||
|
|
@ -32,31 +23,23 @@ 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,6 +1,7 @@
|
||||||
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;
|
||||||
|
|
@ -8,14 +9,9 @@ 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});
|
||||||
|
|
@ -24,68 +20,44 @@ 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,8 +1,5 @@
|
||||||
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,19 +1,15 @@
|
||||||
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();
|
||||||
|
|
@ -28,9 +24,7 @@ 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,17 +1,13 @@
|
||||||
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,37 +1,28 @@
|
||||||
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;
|
||||||
/**
|
|
||||||
* Class that defines the test for com.r0r5chach.competitor.Name
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
* @author r0r5chach
|
|
||||||
*/
|
|
||||||
public class NameTest {
|
public class NameTest {
|
||||||
/**
|
|
||||||
* Tests Name.Name(String, String)
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
public void nameFNameLNameTest() {
|
public void nameTestFNameLName() {
|
||||||
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 nameFNameMNameLNameTest() {
|
public void nameTestFNameMNameLName() {
|
||||||
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");
|
||||||
|
|
@ -44,9 +35,7 @@ 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");
|
||||||
|
|
@ -54,9 +43,7 @@ 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");
|
||||||
|
|
@ -64,25 +51,19 @@ 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");
|
||||||
|
|
@ -90,9 +71,7 @@ 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");
|
||||||
|
|
@ -100,30 +79,23 @@ 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,14 +4,9 @@ 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;
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,15 @@
|
||||||
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 r6AttackerGetDefenderTest() {
|
public void r6AttackerGetAttackerTest() {
|
||||||
R6Defender d = R6Defender.CASTLE;
|
R6Defender d = R6Defender.CASTLE;
|
||||||
assertEquals("Castle", d.getDefender());
|
assertEquals("Castle", d.getDefender());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
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;
|
||||||
|
|
@ -8,14 +9,9 @@ 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});
|
||||||
|
|
@ -32,37 +28,28 @@ 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,14 +4,9 @@ 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;
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,10 @@
|
||||||
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;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
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;
|
||||||
|
|
||||||
|
|
@ -7,14 +6,7 @@ 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};
|
||||||
|
|
@ -25,9 +17,7 @@ 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};
|
||||||
|
|
@ -36,9 +26,7 @@ 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};
|
||||||
|
|
@ -47,9 +35,7 @@ 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};
|
||||||
|
|
@ -58,9 +44,7 @@ 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};
|
||||||
|
|
@ -69,9 +53,7 @@ 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};
|
||||||
|
|
@ -80,18 +62,14 @@ 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};
|
||||||
|
|
@ -105,9 +83,7 @@ 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};
|
||||||
|
|
@ -115,30 +91,23 @@ 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