Module AM37

Class RawConsoleOutput

java.lang.Object
it.polimi.ingsw.view.cli.console.RawConsoleOutput

public class RawConsoleOutput
extends java.lang.Object
Raw console printing utilities
  • Constructor Summary

    Constructors 
    Constructor Description
    RawConsoleOutput()  
  • Method Summary

    Modifier and Type Method Description
    protected void del()
    Clears the last character printed
    void drawMatrix​(java.lang.String[][] matrix)
    Shows a matrix on the console
    void drawMatrix​(java.lang.String[][] matrix, CursorPosition initCoord)
    Shows a matrix on the console; requires the terminal to be in non-canonical mode
    protected void echo​(char c)
    Echoes back on the console the pressed key
    void print​(java.lang.String str)
    Prints a string starting from the current cursor position
    The cursor is moved at the end of the printed string
    void printAt​(CursorPosition position, java.lang.String string)
    Prints a string starting from a certain position
    The cursor is moved at the end of the printed string
    void println​(java.lang.String str)
    Prints a string starting from the current cursor position, then terminates the line
    The cursor is moved at the beginning of the first free row from the starting point
    void printlnAt​(CursorPosition position, java.lang.String string)
    Prints a string starting from a certain position, then terminates the line
    The cursor is moved one row below the initial cursor position
    static java.util.List<java.lang.String> splitMessage​(java.lang.String message, int maxLength)
    Splits a long message on multiple lines, separating the words at blank spaces OR whenever a '\n' is found

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • splitMessage

      public static java.util.List<java.lang.String> splitMessage​(java.lang.String message, int maxLength)
      Splits a long message on multiple lines, separating the words at blank spaces OR whenever a '\n' is found
      Parameters:
      message - the message to be split
      maxLength - the maximum length for a line
      Returns:
      the original message, split in lines
    • print

      public void print​(java.lang.String str)
      Prints a string starting from the current cursor position
      The cursor is moved at the end of the printed string
      Parameters:
      str - the string to print
    • printAt

      public void printAt​(CursorPosition position, java.lang.String string)
      Prints a string starting from a certain position
      The cursor is moved at the end of the printed string
      Parameters:
      position - the starting position
      string - the string to print
    • println

      public void println​(java.lang.String str)
      Prints a string starting from the current cursor position, then terminates the line
      The cursor is moved at the beginning of the first free row from the starting point
      Parameters:
      str - the string to print
    • printlnAt

      public void printlnAt​(CursorPosition position, java.lang.String string)
      Prints a string starting from a certain position, then terminates the line
      The cursor is moved one row below the initial cursor position
      Parameters:
      position - the starting position
      string - the string to print
    • drawMatrix

      public void drawMatrix​(java.lang.String[][] matrix, CursorPosition initCoord)
      Shows a matrix on the console; requires the terminal to be in non-canonical mode
      Parameters:
      matrix - the matrix to show
      initCoord - the matrix initial position
    • drawMatrix

      public void drawMatrix​(java.lang.String[][] matrix)
      Shows a matrix on the console
      Parameters:
      matrix - the matrix to show
    • echo

      protected void echo​(char c)
      Echoes back on the console the pressed key
      Parameters:
      c - the pressed key
    • del

      protected void del()
      Clears the last character printed