Class GridBuilder

java.lang.Object
it.polimi.ingsw.eriantys.client.cli.GridBuilder

public class GridBuilder extends Object
This utility class is used to print various fragments of text in a grid-like structure.
  • Constructor Details

    • GridBuilder

      public GridBuilder(int cols)
      Constructs a new empty GridBuilder 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 empty GridBuilder specifying a fixed number of columns and the tab size.
      Parameters:
      cols - The number of columns of the grid
      tabSize - The amount of spaces that make a tab
  • Method Details

    • add

      public void add(String element)
      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

      public String toString()
      Overrides:
      toString in class Object