Class GridBuilder
java.lang.Object
it.polimi.ingsw.eriantys.client.cli.GridBuilder
This utility class is used to print various fragments of text in a grid-like structure.
-
Constructor Summary
ConstructorDescriptionGridBuilder
(int cols) Constructs a new emptyGridBuilder
specifying a fixed number of columns.GridBuilder
(int cols, int tabSize) Constructs a new emptyGridBuilder
specifying a fixed number of columns and the tab size. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds an element to the grid in the first available spot.void
setHorizontal
(char horizontal) Sets the character used to make horizontal lines.void
setVertical
(char vertical) Sets the character used to make vertical lines.toString()
-
Constructor Details
-
GridBuilder
public GridBuilder(int cols) Constructs a new emptyGridBuilder
specifying a fixed number of columns. The default tab size is used.- Parameters:
cols
- The number of columns of the grid
-
GridBuilder
public GridBuilder(int cols, int tabSize) Constructs a new emptyGridBuilder
specifying a fixed number of columns and the tab size.- Parameters:
cols
- The number of columns of the gridtabSize
- The amount of spaces that make a tab
-
-
Method Details
-
add
Adds an element to the grid in the first available spot.- Parameters:
element
- The text fragment to add to the grid
-
setHorizontal
public void setHorizontal(char horizontal) Sets the character used to make horizontal lines.- Parameters:
horizontal
- The desired character
-
setVertical
public void setVertical(char vertical) Sets the character used to make vertical lines.- Parameters:
vertical
- The desired character
-
toString
-