Add: Added Javadoc For "toStringBoard" Method In CavePaintings.java.
This commit is contained in:
+10
-4
@@ -89,13 +89,19 @@ public class CavePaintings extends EventCard {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Prints a string representation of this {@code TribeCard}. This specific variation is used in the {@code Game}'s
|
* Prints a string representation of this {@code TribeCard}. This specific variation is used in the {@code Game}'s
|
||||||
* toString to print a more detailed version; includes: {@code NLower}, {@code NUpper}, {@code NPrestigeRem} and {@code NPrestigeMul}.
|
* toString to print a more detailed version.
|
||||||
|
* <p>NOTE: {@code NUpper} is not a real attribute used in calculations (only {@code NLower} is needed),
|
||||||
|
* however it's a parameter on the cards' design.
|
||||||
|
* </p>
|
||||||
|
* <p>includes:
|
||||||
|
* <li>{@link #NLower}
|
||||||
|
* <li>{@code NUpper}
|
||||||
|
* <li>{@link #NPrestigeRem}
|
||||||
|
* <li>{@link #NPrestigeMul}
|
||||||
|
* </p>
|
||||||
* @return {@code String} - a string representation of this {@code TribeCard}.
|
* @return {@code String} - a string representation of this {@code TribeCard}.
|
||||||
* @see it.polimi.ingsw.gc14.Model.Cards.TribeCard TribeCard
|
* @see it.polimi.ingsw.gc14.Model.Cards.TribeCard TribeCard
|
||||||
* @see it.polimi.ingsw.gc14.Model.Game Game
|
* @see it.polimi.ingsw.gc14.Model.Game Game
|
||||||
* @see #NLower
|
|
||||||
* @see #NPrestigeRem
|
|
||||||
* @see #NPrestigeMul
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String toStringBoard() {
|
public String toStringBoard() {
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import it.polimi.ingsw.gc14.View.TUI.AsciiTable;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static it.polimi.ingsw.gc14.View.TUI.BorderStyle.*;
|
import static it.polimi.ingsw.gc14.View.TUI.BorderStyle.*;
|
||||||
|
|
||||||
@@ -228,17 +227,34 @@ public class Player implements Serializable {
|
|||||||
// endregion constructors
|
// endregion constructors
|
||||||
|
|
||||||
// region Functions
|
// 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
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
int Last = 6;
|
int Last = -1;
|
||||||
|
|
||||||
var table = new AsciiTable(UNICODE, 1);
|
var table = new AsciiTable(UNICODE, 1);
|
||||||
|
|
||||||
table.addHeader(this.getUserName());
|
table.addHeader(this.getUserName());
|
||||||
table.addRow("RESOURCES:");
|
table.addRow("RESOURCES:");
|
||||||
table.addRow("Food: " + this.getFoodValue());
|
table.addRow("Food: " + this.getFoodValue());
|
||||||
table.addSeparator();
|
|
||||||
table.addRow("Prestige: " + this.getPrestigeValue());
|
table.addRow("Prestige: " + this.getPrestigeValue());
|
||||||
|
table.addSeparator();
|
||||||
|
|
||||||
if(!this.hunters.isEmpty()){
|
if(!this.hunters.isEmpty()){
|
||||||
Last = 6;
|
Last = 6;
|
||||||
@@ -267,44 +283,44 @@ public class Player implements Serializable {
|
|||||||
}
|
}
|
||||||
table.addRow("CHARACTERS:");
|
table.addRow("CHARACTERS:");
|
||||||
if(!this.artists.isEmpty()){
|
if(!this.artists.isEmpty()){
|
||||||
|
table.addRow("Artists: " + this.artists.toString());
|
||||||
if(Last == 1){
|
if(Last == 1){
|
||||||
table.addSeparator();
|
table.addSeparator();
|
||||||
}
|
}
|
||||||
table.addRow("Artists: " + this.artists.toString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!this.builders.isEmpty()){
|
if(!this.builders.isEmpty()){
|
||||||
|
table.addRow("Builders: " + this.builders.toString());
|
||||||
if(Last == 2){
|
if(Last == 2){
|
||||||
table.addSeparator();
|
table.addSeparator();
|
||||||
}
|
}
|
||||||
table.addRow("Builders: " + this.builders.toString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!this.gatherers.isEmpty()){
|
if(!this.gatherers.isEmpty()){
|
||||||
|
table.addRow("Gatherers: " + this.gatherers.toString());
|
||||||
if(Last == 3){
|
if(Last == 3){
|
||||||
table.addSeparator();
|
table.addSeparator();
|
||||||
}
|
}
|
||||||
table.addRow("Gatherers: " + this.gatherers.toString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!this.shamans.isEmpty()){
|
if(!this.shamans.isEmpty()){
|
||||||
|
table.addRow("Shamans: " + this.shamans.toString());
|
||||||
if(Last == 4){
|
if(Last == 4){
|
||||||
table.addSeparator();
|
table.addSeparator();
|
||||||
}
|
}
|
||||||
table.addRow("Shamans: " + this.shamans.toString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!this.inventors.isEmpty()){
|
if(!this.inventors.isEmpty()){
|
||||||
|
table.addRow("Inventors: " + this.inventors.toString());
|
||||||
if(Last == 5){
|
if(Last == 5){
|
||||||
table.addSeparator();
|
table.addSeparator();
|
||||||
}
|
}
|
||||||
table.addRow("Inventors: " + this.inventors.toString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(!this.hunters.isEmpty()){
|
if(!this.hunters.isEmpty()){
|
||||||
table.addSeparator();
|
|
||||||
table.addRow("Hunters: " + this.hunters.toString());
|
table.addRow("Hunters: " + this.hunters.toString());
|
||||||
|
table.addSeparator();
|
||||||
}
|
}
|
||||||
|
|
||||||
table.addRow("BUILDING CARDS:");
|
table.addRow("BUILDING CARDS:");
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public class AsciiTable {
|
|||||||
public void addRow(String... cells) { rows.add(Arrays.asList(cells)); }
|
public void addRow(String... cells) { rows.add(Arrays.asList(cells)); }
|
||||||
public void addRow(List<String> cells) { rows.add(cells); }
|
public void addRow(List<String> cells) { rows.add(cells); }
|
||||||
public void addHeader(String... cells) { rows.add(0, Arrays.asList(cells)); separators.add(0); }
|
public void addHeader(String... cells) { rows.add(0, Arrays.asList(cells)); separators.add(0); }
|
||||||
public void addSeparator() { separators.add(rows.size()); }
|
public void addSeparator() { separators.add(rows.size()-1); }
|
||||||
|
|
||||||
public String build() {
|
public String build() {
|
||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
|
|||||||
Reference in New Issue
Block a user