diff --git a/src/main/java/armameeldoparti/Main.java b/src/main/java/armameeldoparti/Main.java index 25ad0e1d..8d35a150 100644 --- a/src/main/java/armameeldoparti/Main.java +++ b/src/main/java/armameeldoparti/Main.java @@ -58,8 +58,8 @@ private Main() { // ---------------------------------------- Main entry point ---------------------------------- /** - * Starts the program by initializing the fields needed along with - * the program's graphical properties, and making the main menu view visible. + * Starts the program by initializing the fields needed along with the program's graphical + * properties, and making the main menu view visible. * * @param args Program arguments (not used yet). */ @@ -98,19 +98,18 @@ private static void populatePlayersSets() { /** * Gets the number of players for each position per team using regular expressions. * - *

{@code [CLMFG].+>.+}: Retrieves the lines that start with C, L, M, F, or W, - * followed by at least one '>' character (these are the lines that matters in the - * .pda file). + *

{@code [CLMFG].+>.+}: Retrieves the lines that start with C, L, M, F, or W, followed by at + * least one '>' character (these are the lines that matters in the .pda file). * *

{@code (?!(?<=X)\\d).}: Gets the part of the line that is not a number that we are * interested in (the number would take the place of the X). * - *

If the .pda file is modified in terms of the order of the important lines, - * it must be taken into account that Position.values()[index] trusts that what is found - * corresponds to the order in which the values in the Position enum are declared. - * Idem, if the order of the Position enum values are changed, it should be noted that - * Position.values()[index] trusts the order in which the data will be retrieved from the - * .pda file and, therefore, you should review the order of the important lines in the file. + *

If the .pda file is modified in terms of the order of the important lines, it must be taken + * into account that Position.values()[index] trusts that what is found corresponds to the order + * in which the values in the Position enum are declared. Idem, if the order of the Position enum + * values are changed, it should be noted that Position.values()[index] trusts the order in which + * the data will be retrieved from the .pda file and, therefore, you should review the order of + * the important lines in the file. */ private static void setPlayersDistribution() { try (BufferedReader buff = new BufferedReader( diff --git a/src/main/java/armameeldoparti/controllers/AnchoragesController.java b/src/main/java/armameeldoparti/controllers/AnchoragesController.java index fb71962b..1e2b1ebe 100644 --- a/src/main/java/armameeldoparti/controllers/AnchoragesController.java +++ b/src/main/java/armameeldoparti/controllers/AnchoragesController.java @@ -50,9 +50,8 @@ public AnchoragesController(@NonNull AnchoragesView anchoragesView) { /** * Resets the controlled view to its default values. * - *

Clears every anchorage made, updating the text area - * and the state of the buttons, and the checkboxes that - * were selected whose players were not anchored, are deselected. + *

Clears every anchorage made, updating the text area and the state of the buttons, and the + * checkboxes that were selected whose players were not anchored, are deselected. */ @Override public void resetView() { @@ -73,11 +72,11 @@ public void updateCheckBoxesText() { /** * 'Finish' button event handler. * - *

Checks if the necessary anchorages conditions are met. - * If so, it proceeds with the distribution. + *

Checks if the necessary anchorages conditions are met. If so, it proceeds with the + * distribution. * - * @param parentComponent Graphical component where the dialogs associated - * with the event should be displayed. + * @param parentComponent Graphical component where the dialogs associated with the event should + * be displayed. */ public void finishButtonEvent(Component parentComponent) { if (!validAnchoragesCombination()) { @@ -92,11 +91,10 @@ public void finishButtonEvent(Component parentComponent) { /** * 'New anchorage' button event handler. * - *

Checks if the necessary conditions to make a new anchorage - * are met. If so, it does it. + *

Checks if the necessary conditions to make a new anchorage are met. If so, it does it. * - * @param parentComponent Graphical component where the dialogs associated - * with the event should be displayed. + * @param parentComponent Graphical component where the dialogs associated with the event should + * be displayed. */ public void newAnchorageButtonEvent(Component parentComponent) { int playersToAnchorAmount = (int) ((AnchoragesView) getView()).getCheckBoxesMap() @@ -140,8 +138,7 @@ public void newAnchorageButtonEvent(Component parentComponent) { /** * 'Delete last anchorage' button event handler. * - *

Deletes the last anchorage made, updating the text area and the - * state of the buttons. + *

Deletes the last anchorage made, updating the text area and the state of the buttons. */ public void deleteLastAnchorageButtonEvent() { deleteAnchorage(anchoragesAmount); @@ -152,11 +149,11 @@ public void deleteLastAnchorageButtonEvent() { /** * 'Delete anchorage' button event handler. * - *

Prompts the user for the number of the anchorage to delete, - * and removes it, updating the text area and the state of the buttons. + *

Prompts the user for the number of the anchorage to delete, and removes it, updating the + * text area and the state of the buttons. * - * @param parentComponent Graphical component where the dialogs associated - * with the event should be displayed. + * @param parentComponent Graphical component where the dialogs associated with the event should + * be displayed. */ public void deleteAnchorageButtonEvent(Component parentComponent) { String[] optionsDelete = new String[anchoragesAmount]; @@ -194,9 +191,8 @@ public void clearAnchoragesButtonEvent() { /** * 'Back' button event handler. * - *

Makes the controlled view invisible, deletes every anchorage made, - * resets the controlled view to its default state and shows the names - * input view. + *

Makes the controlled view invisible, deletes every anchorage made, resets the controlled + * view to its default state and shows the names input view. */ public void backButtonEvent() { hideView(); @@ -325,12 +321,9 @@ private void clearAnchorages() { /** * Deletes a specific anchorage. * - *

The players that have the specified anchorage, now - * will have anchorage number 0. - * If the anchorage number to delete is not the last one, - * then the remaining players (from the chosen anchor + 1 - * to anchoragesAmount) will have their anchorage number - * decreased by 1. + *

The players that have the specified anchorage, now will have anchorage number 0. If the + * anchorage number to delete is not the last one, then the remaining players (from the chosen + * anchor + 1 to anchoragesAmount) will have their anchorage number decreased by 1. * * @param anchorageToDelete Anchorage number to delete. */ @@ -349,10 +342,9 @@ private void deleteAnchorage(int anchorageToDelete) { /** * Changes the anchorage number of certain players. * - *

If the replacement is 0 (an anchorage must be removed), then - * those players will be set as not-anchored, the players corresponding - * checkboxes will be visible and enabled again, and the anchored players - * amount will be decreased as needed. + *

If the replacement is 0 (an anchorage must be removed), then those players will be set as + * not-anchored, the players corresponding checkboxes will be visible and enabled again, and the + * anchored players amount will be decreased as needed. * * @param target Anchorage number to replace. * @param replacement New anchorage number to set. @@ -385,8 +377,8 @@ private void changeAnchorage(int target, int replacement) { } /** - * The checkboxes that were selected whose players were not anchored, - * are deselected. Then, shows the corresponding following view. + * The checkboxes that were selected whose players were not anchored, are deselected. Then, shows + * the corresponding following view. */ private void finish() { hideView(); @@ -407,8 +399,8 @@ private void finish() { } /** - * Sets the corresponding anchorage number to the selected players. - * Then, unchecks their checkboxes and makes them invisible. + * Sets the corresponding anchorage number to the selected players. Then, unchecks their + * checkboxes and makes them invisible. * * @param cbSet Check boxes set with players checked. */ @@ -447,13 +439,12 @@ private void clearCheckBoxes() { } /** - * Checks if the selected players amount is at least 2 and - * at most MAX_PLAYERS_PER_ANCHORAGE. + * Checks if the selected players amount is at least 2 and at most MAX_PLAYERS_PER_ANCHORAGE. * * @param playersToAnchorAmount Checked players to anchor. * - * @return Whether the checked players amount is at least 2 - * and at most MAX_PLAYERS_PER_ANCHORAGE, or not. + * @return Whether the checked players amount is at least 2 and at most MAX_PLAYERS_PER_ANCHORAGE, + * or not. */ private boolean validChecksAmount(int playersToAnchorAmount) { return playersToAnchorAmount <= Constants.MAX_PLAYERS_PER_ANCHORAGE @@ -479,8 +470,8 @@ private boolean validCheckedPlayersPerPosition() { * * @param playersToAnchorAmount Checked players amount. * - * @return Whether the selected players amount is at most the maximum allowed - * per anchorage, or not. + * @return Whether the selected players amount is at most the maximum allowed per anchorage + * or not. */ private boolean validAnchoredPlayersAmount(int playersToAnchorAmount) { return anchoredPlayersAmount + playersToAnchorAmount <= Constants.MAX_ANCHORED_PLAYERS; diff --git a/src/main/java/armameeldoparti/controllers/Controller.java b/src/main/java/armameeldoparti/controllers/Controller.java index 8971b809..197228cf 100644 --- a/src/main/java/armameeldoparti/controllers/Controller.java +++ b/src/main/java/armameeldoparti/controllers/Controller.java @@ -10,8 +10,8 @@ import lombok.Setter; /** - * Abstract class that specifies the basic methods for - * interaction between controllers and their assigned views. + * Abstract class that specifies the basic methods for interaction between controllers and their + * assigned views. * * @author Bonino, Francisco Ignacio. * diff --git a/src/main/java/armameeldoparti/controllers/HelpController.java b/src/main/java/armameeldoparti/controllers/HelpController.java index dcb113e3..887788be 100644 --- a/src/main/java/armameeldoparti/controllers/HelpController.java +++ b/src/main/java/armameeldoparti/controllers/HelpController.java @@ -78,8 +78,8 @@ public void resetView() { /** * 'Back' button event handler. * - *

Resets the page to the beginning, makes the controlled view - * invisible and shows the main menu view. + *

Resets the page to the beginning, makes the controlled view invisible and shows the main + * menu view. */ public void backButtonEvent() { hideView(); @@ -92,8 +92,8 @@ public void backButtonEvent() { /** * 'Next page' button event handler. * - *

Increments the page number, updating the state of the buttons, - * the displayed page in the text area and the reading progress label. + *

Increments the page number, updating the state of the buttons, the displayed page in the + * text area and the reading progress label. */ public void nextPageButtonEvent() { if (++currentPageNumber < TOTAL_PAGES - 1) { @@ -110,8 +110,8 @@ public void nextPageButtonEvent() { /** * 'Previous page' button event handler. * - *

Decrements the page number, updating the state of the buttons, - * the displayed page in the text area and the reading progress label. + *

Decrements the page number, updating the state of the buttons, the displayed page in the + * text area and the reading progress label. */ public void previousPageButtonEvent() { if (--currentPageNumber > 0) { diff --git a/src/main/java/armameeldoparti/controllers/MainMenuController.java b/src/main/java/armameeldoparti/controllers/MainMenuController.java index 6dc808b2..caddd699 100644 --- a/src/main/java/armameeldoparti/controllers/MainMenuController.java +++ b/src/main/java/armameeldoparti/controllers/MainMenuController.java @@ -47,8 +47,7 @@ public void showView() { /** * 'Help' button event handler. * - *

Makes the controlled view invisible - * and shows the help view. + *

Makes the controlled view invisible and shows the help view. */ public void helpButtonEvent() { hideView(); @@ -62,8 +61,7 @@ public void helpButtonEvent() { /** * 'Start' button event handler. * - *

Makes the controlled view invisible - * and shows the names input view. + *

Makes the controlled view invisible and shows the names input view. */ public void startButtonEvent() { hideView(); diff --git a/src/main/java/armameeldoparti/controllers/NamesInputController.java b/src/main/java/armameeldoparti/controllers/NamesInputController.java index 75002433..e9e59040 100644 --- a/src/main/java/armameeldoparti/controllers/NamesInputController.java +++ b/src/main/java/armameeldoparti/controllers/NamesInputController.java @@ -53,8 +53,7 @@ public NamesInputController(@NonNull NamesInputView namesInputView) { /** * Makes the controlled view visible. * - *

Updates the view state according to the combobox - * initial state, and makes it visible. + *

Updates the view state according to the combobox initial state, and makes it visible. */ @Override public void showView() { @@ -69,8 +68,7 @@ public void showView() { } /** - * Resets the controlled view to its default values and - * makes it invisible. + * Resets the controlled view to its default values and makes it invisible. */ @Override public void resetView() { @@ -93,9 +91,8 @@ public void resetView() { /** * 'Back' button event handler. * - *

Resets the controlled view to its default values, - * turns the anchorages flags to false, makes the - * controlled view invisible and shows the main menu view. + *

Resets the controlled view to its default values, turns the anchorages flags to false, makes + * the controlled view invisible and shows the main menu view. */ public void backButtonEvent() { resetView(); @@ -109,12 +106,11 @@ public void backButtonEvent() { /** * 'Mix' button event handler. * - *

Asks the user for the players distribution method, makes - * the controlled view invisible and shows the corresponding - * following view. + *

Asks the user for the players distribution method, makes the controlled view invisible and + * shows the corresponding following view. * - * @param parentComponent Graphical component where the dialogs associated - * with the event should be displayed. + * @param parentComponent Graphical component where the dialogs associated with the event should + * be displayed. */ public void mixButtonEvent(Component parentComponent) { int distribution = JOptionPane.showOptionDialog( @@ -158,13 +154,13 @@ public void mixButtonEvent(Component parentComponent) { /** * Text fields input event handler. * - *

Validates the user input with a regular expression that checks if the string - * contains only latin characters from A to Z including Ñ, uppercase or lowercase, - * with or without accent mark, with or without spaces. - * If the input is not valid or already exists, the program asks for a new input. + *

Validates the user input with a regular expression that checks if the string contains only + * latin characters from A to Z including Ñ, uppercase or lowercase, with or without accent mark, + * with or without spaces. If the input is not valid or already exists, the program asks for a new + * input. * - *

If the input is valid, it will be applied as a player name in the players set - * corresponding to the combobox selected option. + *

If the input is valid, it will be applied as a player name in the players set corresponding + * to the combobox selected option. * * @param playerIndex The index of the player which name will be the text filed input. * @param playersSet The set of players corresponding to the selected combobox option. @@ -216,8 +212,8 @@ public void comboBoxEvent(@NonNull String selectedOption) { /** * Updates the text displayed in the read-only text area. * - *

The players names are shown in the order they are positioned in their respective list. - * The order is the same of the positions enum. + *

The players names are shown in the order they are positioned in their respective list. The + * order is the same of the positions enum. */ private void updateTextArea() { var wrapperCounter = new Object() { @@ -257,7 +253,7 @@ private void updateTextArea() { private void updateTextFields(@NonNull String selectedOption) { JPanel leftPanel = ((NamesInputView) getView()).getLeftPanel(); - // Removes the text fields from the view's left panel. + // Removes the text fields from the view's left panel ((NamesInputView) getView()).getTextFieldsMap() .values() .stream() @@ -322,14 +318,12 @@ private boolean validString(@NonNull String string) { } /** - * Checks if the given name has at most MAX_NAME_LEN characters, - * is not empty or blank and if there isn't already a player - * with that name. + * Checks if the given name has at most MAX_NAME_LEN characters, is not empty or blank and if + * there isn't already a player with that name. * * @param name The name to validate. * - * @return If the given name is valid according to - * the specified conditions. + * @return If the given name is valid according to the specified conditions. */ private boolean validName(@NonNull String name) { return name.length() <= Constants.MAX_NAME_LEN diff --git a/src/main/java/armameeldoparti/controllers/ResultsController.java b/src/main/java/armameeldoparti/controllers/ResultsController.java index 56ee8220..e4b465ae 100644 --- a/src/main/java/armameeldoparti/controllers/ResultsController.java +++ b/src/main/java/armameeldoparti/controllers/ResultsController.java @@ -84,8 +84,8 @@ public void resetView() { } /** - * Creates the teams and the results table, applies the needed table format, fills - * the non-variable table cells and displays the distribution results. + * Creates the teams and the results table, applies the needed table format, fills the + * non-variable table cells and displays the distribution results. */ public void setUp() { Team team1 = new Team(1); @@ -114,9 +114,8 @@ public void setUp() { /** * 'Back' button event handler. * - *

Resets the teams, resets the controlled view to its default - * values and makes it invisible, and shows the corresponding previous - * view. + *

Resets the teams, resets the controlled view to its default values and makes it invisible, + * and shows the corresponding previous view. */ public void backButtonEvent() { resetTeams(); @@ -138,8 +137,8 @@ public void backButtonEvent() { /** * 'Remix' button event handler. * - *

Resets the teams, redistributes the players with the - * specified method and updates the results table. + *

Resets the teams, redistributes the players with the specified method and updates the + * results table. */ public void remixButtonEvent() { resetTeams(); @@ -152,8 +151,8 @@ public void remixButtonEvent() { /** * Fills the table with the distribution results. * - *

The table cells are filled trusting the positions order in the - * first column (same order as the positions enum). + *

The table cells are filled trusting the positions order in the first column (same order as + * the positions enum). */ public void updateTable() { var wrapper = new Object() { @@ -217,19 +216,17 @@ public List bySkillsMix() { // ---------------------------------------- Private methods ----------------------------------- /** - * Sets the table cells format, including text alignment and background and - * foreground colors. + * Sets the table cells format, including text alignment and background and foreground colors. * - *

Row 0 & column 0 have dark green background and white foreground. - * The remaining cells will have black foreground. + *

Row 0 & column 0 have dark green background and white foreground. The remaining cells will + * have black foreground. * - *

The background color will be yellow-ish if the cell shows any skill points - * related information. If the cell contains an anchored player name, its background - * will be the corresponding from the ANCHORAGES_COLORS array. If not, its background - * will be white. + *

The background color will be yellow-ish if the cell shows any skill points related + * information. If the cell contains an anchored player name, its background will be the + * corresponding from the ANCHORAGES_COLORS array. If not, its background will be white. * - *

The cell text will be centered if it shows any skill points related information, - * or a team name. Otherwise, it will be left-aligned. + *

The cell text will be centered if it shows any skill points related information, or a team + * name. Otherwise, it will be left-aligned. */ private void setTableFormat() { ((ResultsView) getView()).getTable().setDefaultRenderer( diff --git a/src/main/java/armameeldoparti/controllers/SkillPointsInputController.java b/src/main/java/armameeldoparti/controllers/SkillPointsInputController.java index 90af71f0..cd08d3f1 100644 --- a/src/main/java/armameeldoparti/controllers/SkillPointsInputController.java +++ b/src/main/java/armameeldoparti/controllers/SkillPointsInputController.java @@ -32,8 +32,7 @@ public SkillPointsInputController(@NonNull SkillPointsInputView skillPointsInput // ---------------------------------------- Public methods ------------------------------------ /** - * Resets the controlled view to its default values - * and makes it invisible. + * Resets the controlled view to its default values and makes it invisible. */ @Override public void resetView() { @@ -44,8 +43,8 @@ public void resetView() { /** * 'Finish' button event handler. * - *

Sets the entered skill points for each player, makes - * the controlled view invisible and shows the results view. + *

Sets the entered skill points for each player, makes the controlled view invisible and shows + * the results view. */ public void finishButtonEvent() { hideView(); @@ -62,8 +61,8 @@ public void finishButtonEvent() { /** * 'Reset skill points' button event handler. * - *

Sets 0 skill points to every player and resets every spinner - * value to the minimum skill point. + *

Sets 0 skill points to every player and resets every spinner value to the minimum skill + * point. */ public void resetSkillsButtonEvent() { resetSkills(); @@ -72,8 +71,7 @@ public void resetSkillsButtonEvent() { /** * 'Back' button event handler. * - *

Resets the controlled view to its default values - * and shows the corresponding next view. + *

Resets the controlled view to its default values and shows the corresponding next view. */ public void backButtonEvent() { resetView(); @@ -95,8 +93,7 @@ public void updateNameLabels() { // ---------------------------------------- Private methods ----------------------------------- /** - * Sets 0 skill points to every player and resets every spinner - * value to the minimum skill point. + * Sets 0 skill points to every player and resets every spinner value to the minimum skill point. */ private void resetSkills() { ((SkillPointsInputView) getView()).getSpinnersMap() diff --git a/src/main/java/armameeldoparti/utils/common/CommonFunctions.java b/src/main/java/armameeldoparti/utils/common/CommonFunctions.java index dc67d3ec..6157106f 100644 --- a/src/main/java/armameeldoparti/utils/common/CommonFunctions.java +++ b/src/main/java/armameeldoparti/utils/common/CommonFunctions.java @@ -58,9 +58,9 @@ public static void exitProgram(Error e) { /** * Builds an error window with a custom message. * - * @param errorMessage Custom error message to show. - * @param parentComponent Graphical component where the dialogs associated - * with the event should be displayed. + * @param errorMessage Custom error message to show. + * @param parentComponent Graphical component where the dialogs associated with the event should + * be displayed. */ public static void showErrorMessage(@NonNull String errorMessage, Component parentComponent) { JOptionPane.showMessageDialog( @@ -99,11 +99,9 @@ public static Component getComponentFromEvent(ActionEvent e) { } /** - * Gets a list containing the anchored players - * grouped by their anchorage number. + * Gets a list containing the anchored players grouped by their anchorage number. * - * @return A list containing the anchored players - * grouped by their anchorage number. + * @return A list containing the anchored players grouped by their anchorage number. */ @NonNull public static List> getAnchoredPlayers() { @@ -142,7 +140,7 @@ public static Position getCorrespondingPosition(@NonNull Map ma * @param view The view whose controller is needed. * * @return The requested view's controller. - */ + */ @NonNull public static Controller getController(@NonNull ProgramView view) { return CommonFields.getControllersMap() diff --git a/src/main/java/armameeldoparti/utils/mixers/BySkillsMixer.java b/src/main/java/armameeldoparti/utils/mixers/BySkillsMixer.java index 292cf6d3..b93797a3 100644 --- a/src/main/java/armameeldoparti/utils/mixers/BySkillsMixer.java +++ b/src/main/java/armameeldoparti/utils/mixers/BySkillsMixer.java @@ -41,19 +41,18 @@ public BySkillsMixer() { * *

Positions are traversed in reverse order to achieve the fairer distribution. * - *

The players of each position are ordered based on their score, from highest to lowest. - * The teams are then ordered based on the sum of their players scores so far, from lowest - * to highest. + *

The players of each position are ordered based on their score, from highest to lowest. The + * teams are then ordered based on the sum of their players scores so far, from lowest to highest. * - *

If the number of players to distribute is 2, the team with less skill points is - * assigned the player with the highest skill points, and the team with more skill points - * is assigned the lowest skill points player. + *

If the number of players to distribute is 2, the team with less skill points is assigned the + * player with the highest skill points, and the team with more skill points is assigned the + * lowest skill points player. * - *

If the number of players to distribute is 4, two subgroups are made with the players - * at the list ends, from the outside to the inside. - * These subsets are then ordered based on their skill points, from highest to lowest. - * The team with less skill points is assigned the set of players with more skill points. - * The team with more skill points is assigned the set of players with the lowest skill points. + *

If the number of players to distribute is 4, two subgroups are made with the players at the + * list ends, from the outside to the inside. These subsets are then ordered based on their skill + * points, from highest to lowest. The team with less skill points is assigned the set of players + * with more skill points. The team with more skill points is assigned the set of players with the + * lowest skill points. * * @param teams List that contains the two teams. * diff --git a/src/main/java/armameeldoparti/utils/mixers/PlayersMixer.java b/src/main/java/armameeldoparti/utils/mixers/PlayersMixer.java index 664e0629..172c3f25 100644 --- a/src/main/java/armameeldoparti/utils/mixers/PlayersMixer.java +++ b/src/main/java/armameeldoparti/utils/mixers/PlayersMixer.java @@ -22,8 +22,7 @@ public interface PlayersMixer { * * @param teams List that contains the two teams. * - * @return The updated teams with the players distributed - * without considering anchorages. + * @return The updated teams with the players distributed without considering anchorages. */ @NonNull List withoutAnchorages(@NonNull List teams); @@ -33,8 +32,7 @@ public interface PlayersMixer { * * @param teams List that contains the two teams. * - * @return The updated teams with the players distributed - * considering anchorages. + * @return The updated teams with the players distributed considering anchorages. */ @NonNull List withAnchorages(@NonNull List teams); diff --git a/src/main/java/armameeldoparti/utils/mixers/RandomMixer.java b/src/main/java/armameeldoparti/utils/mixers/RandomMixer.java index f6d062f7..7ee10edf 100644 --- a/src/main/java/armameeldoparti/utils/mixers/RandomMixer.java +++ b/src/main/java/armameeldoparti/utils/mixers/RandomMixer.java @@ -46,13 +46,12 @@ public RandomMixer() { * *

Half of the players of each players-set are randomly assigned a team number. * - *

The rest of the players in the group without team (team == 0) are assigned - * the opposing team number. + *

The rest of the players in the group without team (team == 0) are assigned the opposing team + * number. * * @param teams List that contains the two teams. * - * @return The updated teams with the players distributed randomly - * without considering anchorages. + * @return The updated teams with the players distributed randomly without considering anchorages. */ @Override @NonNull @@ -101,15 +100,13 @@ public List withoutAnchorages(@NonNull List teams) { /** * Distributes the players randomly considering anchorages. * - *

First, the anchored players are grouped in different lists by their - * anchorage number, and they are distributed randomly starting with the - * sets with most anchored players in order to avoid inconsistencies. - * If a set of anchored players cannot be added to one team, it will be + *

First, the anchored players are grouped in different lists by their anchorage number, and + * they are distributed randomly starting with the sets with most anchored players in order to + * avoid inconsistencies. If a set of anchored players cannot be added to one team, it will be * added to the other. * - *

Then, the players that are not anchored are distributed - * randomly. They will be added to a team only if the players - * per position or the players per team amounts are not exceeded. + *

Then, the players that are not anchored are distributed randomly. They will be added to a + * team only if the players per position or the players per team amounts are not exceeded. * * @param teams List that contains the two teams. * @@ -186,12 +183,10 @@ private void shuffleTeamNumbers(int range) { /** * Checks if a set of anchored players can be added to a team. * - *

It checks if any of the positions of the anchored players - * in the destination team is already complete, and it checks - * if adding them does not exceed the number of players allowed - * per position per team. This is done in order to avoid more - * than half of the registered players of the same position - * remaining on the same team. + *

It checks if any of the positions of the anchored players in the destination team is already + * complete, and it checks if adding them does not exceed the number of players allowed per + * position per team. This is done in order to avoid more than half of the registered players of + * the same position remaining on the same team. * * @param team Team where the anchored players should be added. * @param anchoredPlayers List containing the players with the same anchorage number. @@ -205,15 +200,14 @@ private boolean anchorageCanBeAdded(@NonNull Team team, } /** - * Checks if the amount of anchored players to be added to a - * team would exceed the maximum allowed amount of players - * per team. + * Checks if the amount of anchored players to be added to a team would exceed the maximum allowed + * amount of players per team. * - * @param team Team to check if the anchored players can be added. + * @param team Team to check if the anchored players can be added. * @param anchoredPlayers Anchored players to check. * - * @return If the amount of anchored players to be added to a team - * would exceed the maximum allowed amount of players per team. + * @return If the amount of anchored players to be added to a team would exceed the maximum + * allowed amount of players per team. */ private boolean anchorageOverflowsTeamSize(@NonNull Team team, @NonNull List anchoredPlayers) { @@ -221,16 +215,14 @@ private boolean anchorageOverflowsTeamSize(@NonNull Team team, } /** - * Checks if the amount of anchored players to be added to a - * team would exceed the maximum allowed amount of players - * per team in any position set. + * Checks if the amount of anchored players to be added to a team would exceed the maximum allowed + * amount of players per team in any position set. * - * @param team Team to check if the anchored players can be added. + * @param team Team to check if the anchored players can be added. * @param anchoredPlayers Anchored players to check. * - * @return If the amount of anchored players to be added to a - * team would exceed the maximum allowed amount of players - * per team in any position set. + * @return If the amount of anchored players to be added to a team would exceed the maximum + * allowed amount of players per team in any position set. */ private boolean anchorageOverflowsAnyPositionSet(@NonNull Team team, @NonNull List anchoredPlayers) { @@ -241,17 +233,15 @@ private boolean anchorageOverflowsAnyPositionSet(@NonNull Team team, } /** - * Checks if the amount of anchored players to be added to a - * position set in a team would exceed the maximum allowed - * amount of players per team for that particular position. + * Checks if the amount of anchored players to be added to a position set in a team would exceed + * the maximum allowed amount of players per team for that particular position. * - * @param team Team to check if the anchored players can be added. + * @param team Team to check if the anchored players can be added. * @param anchoredPlayers Anchored players to check. - * @param position Anchored players position. + * @param position Anchored players position. * - * @return If the amount of anchored players to be added to a - * position set in a team would exceed the maximum allowed - * amount of players per team for that particular position. + * @return If the amount of anchored players to be added to a position set in a team would exceed + * the maximum allowed amount of players per team for that particular position. */ private boolean anchorageOverflowsPositionSet(@NonNull Team team, @NonNull List anchoredPlayers, diff --git a/src/main/java/armameeldoparti/views/NamesInputView.java b/src/main/java/armameeldoparti/views/NamesInputView.java index d408045a..4478f7fc 100644 --- a/src/main/java/armameeldoparti/views/NamesInputView.java +++ b/src/main/java/armameeldoparti/views/NamesInputView.java @@ -143,8 +143,7 @@ private void addComboBox() { } /** - * Adds the read-only text area where the entered player names will be displayed - * in real time. + * Adds the read-only text area where the entered player names will be displayed in real time. */ private void addTextArea() { textArea = new JTextArea(TEXT_AREA_ROWS, TEXT_AREA_COLUMNS); diff --git a/src/main/java/armameeldoparti/views/ResultsView.java b/src/main/java/armameeldoparti/views/ResultsView.java index c0801a0f..53d9bd1f 100644 --- a/src/main/java/armameeldoparti/views/ResultsView.java +++ b/src/main/java/armameeldoparti/views/ResultsView.java @@ -26,8 +26,8 @@ public class ResultsView extends View { /** - * Fixed table cells width (in pixels). - * This value depends on the program's font and the maximum player name length. + * Fixed table cells width (in pixels). This value depends on the program's font and the maximum + * player name length. */ private static final int FIXED_CELL_WIDTH = 250; @@ -117,8 +117,7 @@ protected void addButtons() { // ---------------------------------------- Private methods ----------------------------------- /** - * Updates and returns the frame title based on the - * chosen distribution and the anchorages option. + * Updates and returns the frame title based on the chosen distribution and the anchorages option. * * @return The updated frame title. */ diff --git a/src/test/java/armameeldoparti/HelpViewTest.java b/src/test/java/armameeldoparti/HelpViewTest.java index 5b3854aa..0a6e1d1c 100644 --- a/src/test/java/armameeldoparti/HelpViewTest.java +++ b/src/test/java/armameeldoparti/HelpViewTest.java @@ -47,8 +47,8 @@ class HelpViewTest { * *

Instantiates the help view and its controller. * - * @throws URISyntaxException If the specified URI for the help pages - * directory is not correctly formatted. + * @throws URISyntaxException If the specified URI for the help pages directory is not correctly + * formatted. */ @BeforeAll void setUp() throws URISyntaxException { @@ -80,8 +80,7 @@ void resetPages() { // ---------------------------------------- Tests bodies -------------------------------------- /** - * Tests whether the page number shown on the label is correct - * after navigating between pages. + * Tests whether the page number shown on the label is correct after navigating between pages. * * @param timesNext How many times the next page button is pressed. * @param timesPrevious How many times the previous page button is pressed. @@ -131,11 +130,9 @@ void navigationButtonsLimitsTest() { // ---------------------------------------- Arguments providers ------------------------------- /** - * Provides how many times the test should navigate - * back and forth in the help view pages. + * Provides how many times the test should navigate back and forth in the help view pages. * - * @return How many times the test should navigate - * back and forth in the help view pages. + * @return How many times the test should navigate back and forth in the help view pages. */ static Stream navigationProvider() { return Stream.of( diff --git a/src/test/java/armameeldoparti/MainMenuTest.java b/src/test/java/armameeldoparti/MainMenuTest.java index aff563d4..92f049f9 100644 --- a/src/test/java/armameeldoparti/MainMenuTest.java +++ b/src/test/java/armameeldoparti/MainMenuTest.java @@ -74,9 +74,9 @@ void helpViewInitialStateTest() { } /** - * The names input view should start visible, with the first combo box options selected, - * the text area empty, the anchorages checkbox not selected, the mix button disabled, - * and the text fields empty. + * The names input view should start visible, with the first combo box options selected, the text + * area empty, the anchorages checkbox not selected, the mix button disabled, and the text fields + * empty. * *

Also tests the correct navigation between the main menu and the names input view. */ diff --git a/src/test/java/armameeldoparti/NamesInputTest.java b/src/test/java/armameeldoparti/NamesInputTest.java index 00608367..00032bbf 100644 --- a/src/test/java/armameeldoparti/NamesInputTest.java +++ b/src/test/java/armameeldoparti/NamesInputTest.java @@ -49,8 +49,8 @@ void setUp() { // ---------------------------------------- Tests bodies -------------------------------------- /** - * Tests whether empty names and names with numbers and/or symbols are correctly - * detected and if they all trigger their corresponding exception. + * Tests whether empty names and names with numbers and/or symbols are correctly detected and if + * they all trigger their corresponding exception. * * @param invalidString The string that shouldn't pass the name check. */ @@ -70,8 +70,8 @@ void invalidStringsShouldThrowException(@NonNull String invalidString) { } /** - * Tests whether empty names, blank names and long names (more than 10 characters), - * are correctly detected and if they all trigger their corresponding exception. + * Tests whether empty names, blank names and long names (more than 10 characters), are correctly + * detected and if they all trigger their corresponding exception. * * @param invalidName The string that shouldn't pass the name check. */ @@ -91,8 +91,8 @@ void invalidNamesShouldThrowException(@NonNull String invalidName) { } /** - * Tests whether repeated names are correctly detected and if they all trigger - * their corresponding exception. + * Tests whether repeated names are correctly detected and if they all trigger their corresponding + * exception. */ @DisplayName("Tests if repeated names throw the expected exception") @Test @@ -129,10 +129,10 @@ void repeatedNamesShouldThrowException() { * @param playerPosition The position of the player to test. * @param playerName The name to apply to the player. * - * @throws InvalidNameException This exception is never thrown since - * every test string is a valid name. - * @throws IllegalArgumentException This exception is never thrown since - * every test string is a valid name. + * @throws InvalidNameException This exception is never thrown since every test string is a + * valid name. + * @throws IllegalArgumentException This exception is never thrown since every test string is a + * valid name. */ @DisplayName("Tests whether valid names are correctly stored as players names") @ParameterizedTest