Class Symbols

java.lang.Object
it.polimi.ingsw.Misc.Symbols

public class Symbols extends Object
Symbols holds constants and methods used by the CLI. Mainly it focuses on colour management via ANSI codes
  • Field Details

  • Constructor Details

    • Symbols

      public Symbols()
  • Method Details

    • colorizeStudent

      public static String colorizeStudent(PawnColour p, String message)
      Method used to create a visual representation of the students using a colour and the icon. Extends the functionality of the method colour(String, String)
      Parameters:
      p - student object used to access colour information
      message - the icon or character with which the student will be represented
      Returns:
      a String containing the ASCII code of the colour followed by the message
    • colour

      public static String colour(String s, String colour)
      Method used to change the style of a string. It is usually used to change the colour of the string but can be used to change other aspect of the style in general
      Parameters:
      s - the String of which we want to change the style
      colour - the ANSI code with which the String style will be modified
      Returns:
      a String with style changed
    • colorizeBackgroundStudent

      public static String colorizeBackgroundStudent(PawnColour p, String message)
      Method used to create a visual representation of the students using a colour as the background of a String.
      Parameters:
      p - student object used to access colour information
      message - the icon or character with which the student will be represented
      Returns:
      a String containing the ASCII code of the colour followed by the message
    • stripFromANSICodes

      public static String stripFromANSICodes(String s)
      Method used to remove all ANSI codes and tabulation from a String. Useful to count character within a String which has its style affected by ANSI codes
      Parameters:
      s - the message which the ANSI code will be stripped from
      Returns:
      a simple ASCII String