This commit is contained in:
Joshua Perry 2023-02-05 21:45:14 +00:00
parent 65bae824a5
commit de3bec19cc
2 changed files with 82 additions and 7 deletions

View File

@ -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,25 +98,52 @@ 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();
} }