Add: Added Javadoc For "toStringBoard" Method In CavePaintings.java.

This commit is contained in:
GabrieleRadice
2026-04-30 16:41:14 +02:00
parent 1af39bc558
commit 3c0ea0f9eb
3 changed files with 36 additions and 14 deletions
@@ -8,7 +8,6 @@ import it.polimi.ingsw.gc14.View.TUI.AsciiTable;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import static it.polimi.ingsw.gc14.View.TUI.BorderStyle.*;
@@ -228,17 +227,34 @@ public class Player implements Serializable {
// endregion constructors
// region Functions
/**
* Prints the {@code Player}'s attributes for the {@code Board}'s representation.
* Uses the {@code UNICODE} border style.
* <p><b>Includes:</b>
* <li>{@link #FoodValue Food}
* <li>{@link #PrestigeValue Prestige}
* <li>{@link #artists Artists}
* <li>{@link #builders Builders}
* <li>{@link #gatherers Gatherers}
* <li>{@link #shamans Shamans}
* <li>{@link #inventors Inventors}
* <li>{@link #hunters Hunters}
* <li>{@link #buildingCards Buildings}
* </p>
* @return {@code String} - A string representation of the {@code Player}'s attributes.
* @see it.polimi.ingsw.gc14.View.TUI.BorderStyle BorderStyle
*/
@Override
public String toString() {
int Last = 6;
int Last = -1;
var table = new AsciiTable(UNICODE, 1);
table.addHeader(this.getUserName());
table.addRow("RESOURCES:");
table.addRow("Food: " + this.getFoodValue());
table.addSeparator();
table.addRow("Prestige: " + this.getPrestigeValue());
table.addSeparator();
if(!this.hunters.isEmpty()){
Last = 6;
@@ -267,44 +283,44 @@ public class Player implements Serializable {
}
table.addRow("CHARACTERS:");
if(!this.artists.isEmpty()){
table.addRow("Artists: " + this.artists.toString());
if(Last == 1){
table.addSeparator();
}
table.addRow("Artists: " + this.artists.toString());
}
if(!this.builders.isEmpty()){
table.addRow("Builders: " + this.builders.toString());
if(Last == 2){
table.addSeparator();
}
table.addRow("Builders: " + this.builders.toString());
}
if(!this.gatherers.isEmpty()){
table.addRow("Gatherers: " + this.gatherers.toString());
if(Last == 3){
table.addSeparator();
}
table.addRow("Gatherers: " + this.gatherers.toString());
}
if(!this.shamans.isEmpty()){
table.addRow("Shamans: " + this.shamans.toString());
if(Last == 4){
table.addSeparator();
}
table.addRow("Shamans: " + this.shamans.toString());
}
if(!this.inventors.isEmpty()){
table.addRow("Inventors: " + this.inventors.toString());
if(Last == 5){
table.addSeparator();
}
table.addRow("Inventors: " + this.inventors.toString());
}
if(!this.hunters.isEmpty()){
table.addSeparator();
table.addRow("Hunters: " + this.hunters.toString());
table.addSeparator();
}
table.addRow("BUILDING CARDS:");