-
Notifications
You must be signed in to change notification settings - Fork 0
Console & ConsoleObserver
These classes were implemented to make it easier to print informations to the console. Also, they enable you to not print the text to the console, but to save them and notify "ConsoleObserver"-Objects with the new text, if something gets printed to the console, so that you could for example set up a textarea in a gui to be your console.
The Console-Class has a few simple static methods. They will be explained here:
-
private static int indentionLevelis the level of indention used when callingprintlnIndented([...]). -
private static printingToConsoledetermines, whether the print methods are outputting the text to the actual console viaSystem.out.print(). -
private static String consoleTextis where all lines printed will be stored in. -
private static ArrayList<ConsoleObservers> observersis a list of objects implementing the classConsoleObserver(see below), which will be notified, if something gets printed.
This method simply adds the String given by object.toString() to the console text (and, if printingToConsole is true, to the actual console) (this will from here on be reffered to as 'printing') without generating a new line or indenting.
This method simply prints the String given by object.toString() after a generated new line (via '\n').
This method simply prints the String given by object.toString() after a generated new line (via '\n').