From: Roland Haeder Date: Fri, 18 Sep 2015 08:43:40 +0000 (+0200) Subject: added assert messages + removed redundant javadoc (see implemented interfaces) X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=f089b707058b6326f7bf1c7e504485d939099ecb;p=jfinancials-lib.git added assert messages + removed redundant javadoc (see implemented interfaces) Signed-off-by:Roland Häder --- diff --git a/src/org/mxchange/addressbook/client/console/ConsoleClient.java b/src/org/mxchange/addressbook/client/console/ConsoleClient.java index ecfbd4d..715a93a 100644 --- a/src/org/mxchange/addressbook/client/console/ConsoleClient.java +++ b/src/org/mxchange/addressbook/client/console/ConsoleClient.java @@ -70,11 +70,6 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC this.getLogger().trace("EXIT!"); //NOI18N } - /** - * Displays a textual address "box" of given contact - * - * @param contact Contact to show address for - */ @Override public void displayAddressBox (final Contact contact) { // Trace message @@ -93,11 +88,6 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC this.getLogger().trace("EXIT!"); //NOI18N } - /** - * Displays a textual name "box" of given contact - * - * @param contact Contact to show name for - */ @Override public void displayNameBox (final Contact contact) { // Trace message @@ -129,11 +119,6 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC this.getLogger().trace("EXIT!"); //NOI18N } - /** - * Displays a textual other data "box" of given contact - * - * @param contact Contact to show other data for - */ @Override public void displayOtherDataBox (final Contact contact) { // Trace message @@ -312,9 +297,6 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC return contact; } - /** - * Shutdown this client - */ @Override public void doShutdown () throws SQLException, IOException { // Trace message @@ -324,7 +306,6 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC super.doShutdown(); // TODO Add other shutdown stuff - // Trace message this.getLogger().trace("EXIT!"); //NOI18N } @@ -381,14 +362,14 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC manager.doDeleteOtherAddress(); break; - case '0': - try { - // Program exit - this.getApplication().doShutdown(); - } catch (final SQLException | IOException ex) { - this.abortProgramWithException(ex); - } - break; + case '0': + try { + // Program exit + this.getApplication().doShutdown(); + } catch (final SQLException | IOException ex) { + this.abortProgramWithException(ex); + } + break; default: // TODO throw own exception @@ -403,13 +384,6 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC this.getLogger().trace("EXIT!"); //NOI18N } - /** - * Asks the the user to enter a single character which must match validChars - * - * @param validChars Valid chars that are accepted - * @param message Message to user - * @return Allowed character - */ @Override public char enterChar (final char[] validChars, final String message) { // Trace message @@ -445,12 +419,6 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC return input; } - /** - * Asks the user to enter his/her gender - * - * @param message Message to the user - * @return Gender enum - */ @Override public Gender enterGender (final String message) { // Trace message @@ -468,7 +436,7 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC Gender g = Gender.fromChar(gender); // g must not be null - assert(g instanceof Gender) : "g is not set."; //NOI18N + assert (g instanceof Gender) : "g is not set."; //NOI18N // Trace message this.getLogger().trace(MessageFormat.format("g={0} - EXIT!", g)); //NOI18N @@ -477,22 +445,14 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC return g; } - /** - * Reads an integer (int) with a textural message from the user - * - * @param minimum Minimum allowed number - * @param maximum Maximum allowed number - * @param message Messager to display in console - * @return - */ @Override public int enterInt (final int minimum, final int maximum, final String message) { // Trace message this.getLogger().trace(MessageFormat.format("minimum={0},maximum={1},message={2} - CALLED!", minimum, maximum, message)); //NOI18N // Minimum should not be below zero - assert (minimum >= 0); - assert (maximum > minimum); + assert (minimum >= 0) : MessageFormat.format("minimum={0} is below zero", minimum); //NOI18N + assert (maximum > minimum) : MessageFormat.format("maximum {0} is smaller than minimum {1}", maximum, minimum); //NOI18N // Init input int input = -1; @@ -512,15 +472,6 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC return input; } - /** - * Reads a string of minimum and maximum length from the user - * - * @param minLength Minimum length of the string to read - * @param maxLength Maximum length of the string to read - * @param message Message to user - * @param allowEmpty Whether to allow empty string - * @return Entered string by user or null for empty strings - */ @Override public String enterString (final int minLength, final int maxLength, final String message, final boolean allowEmpty) { // Trace message @@ -548,23 +499,12 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC return input; } - /** - * Returns a console menu item - * - * @param accessKey Key to access the menu - * @param text Text to show to user - * @return A SelectableMenuItem - * TODO Make sure the access key is unique - */ @Override public SelectableMenuItem getMenuItem (final char accessKey, final String text) { // Return a new console menu item return new ConsoleMenuItem(accessKey, text); } - /** - * Initializes this client - */ @Override public void init () { // Trace message @@ -585,43 +525,27 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC this.getLogger().trace("EXIT!"); //NOI18N } - /** - * Displays textural message to the user - * - * @param message - */ @Override public void outputMessage (final String message) { System.out.println(message); } - /** - * Shows textural menu on console - */ @Override public void showCurrentMenu () { this.showMenu(this.getCurrentMenu()); } - /** - * Shows given menu entry to user - * - * @param item Menu entry - */ @Override public void showEntry (final SelectableMenuItem item) { // Access key then text - this.outputMessage(MessageFormat.format("[{0}] {1}", item.getAccessKey(), item.getText())); + this.outputMessage(MessageFormat.format("[{0}] {1}", item.getAccessKey(), item.getText())); //NOI18N } - /** - * Shows a textural message to the user - */ @Override public void showWelcome () { - this.outputMessage(MessageFormat.format("Welcome to {0}", AddressbookApplication.printableTitle())); - this.outputMessage(""); - this.outputMessage("Copyright(c) 2015 by Roland Haeder, this is free software"); + this.outputMessage(MessageFormat.format("Welcome to {0}", AddressbookApplication.printableTitle())); //NOI18N + this.outputMessage(""); //NOI18N + this.outputMessage("Copyright(c) 2015 by Roland Haeder, this is free software"); //NOI18N // Debug message this.getLogger().debug("Intro shown to user"); //NOI18N @@ -732,9 +656,6 @@ public class ConsoleClient extends BaseAddressbookClient implements AddressbookC return this.scanner.nextLine(); } - /** - * Fills menu map with menu entries - */ @Override protected final void fillMenuMap () { // Trace message