From 8c199926b3d45121755468737d863958abd9322a Mon Sep 17 00:00:00 2001
From: Roland Haeder <roland@mxchange.org>
Date: Wed, 15 Jul 2015 15:21:13 +0200
Subject: [PATCH] =?utf8?q?Renamed=20some=20methods=20and=20auto-sorted=20t?=
 =?utf8?q?hem=20Signed-off-by:Roland=20H=C3=A4der=20<roland@mxchange.org>?=
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit

---
 .../mxchange/addressbook/client/Client.java   |   2 +-
 .../client/console/ConsoleClient.java         |  72 ++++++------
 .../manager/contact/ContactManager.java       | 108 +++++++++---------
 .../manager/contact/ManageableContact.java    |   8 +-
 4 files changed, 95 insertions(+), 95 deletions(-)

diff --git a/Addressbook/src/org/mxchange/addressbook/client/Client.java b/Addressbook/src/org/mxchange/addressbook/client/Client.java
index 4a48b04..ea748a5 100644
--- a/Addressbook/src/org/mxchange/addressbook/client/Client.java
+++ b/Addressbook/src/org/mxchange/addressbook/client/Client.java
@@ -62,7 +62,7 @@ public interface Client extends FrameworkInterface {
      * @param contact Contact instance to let the user change data
      * @throws UnhandledUserChoiceException If choice is not supported
      */
-    public void doUserChangeAdressChoice (final Contact contact) throws UnhandledUserChoiceException;
+    public void userChooseChangeContactData (final Contact contact) throws UnhandledUserChoiceException;
 
     /**
      * Asks the user for a choice and proceeds accordingly
diff --git a/Addressbook/src/org/mxchange/addressbook/client/console/ConsoleClient.java b/Addressbook/src/org/mxchange/addressbook/client/console/ConsoleClient.java
index 532ba61..841b7b6 100644
--- a/Addressbook/src/org/mxchange/addressbook/client/console/ConsoleClient.java
+++ b/Addressbook/src/org/mxchange/addressbook/client/console/ConsoleClient.java
@@ -120,35 +120,6 @@ public class ConsoleClient extends BaseClient implements Client {
 	this.outputMessage("Telefonnumer: " + contact.getPhoneNumber() + "\nFaxnummer: " + contact.getFaxNumber() + "\nHandy: " + contact.getCellphoneNumber() + "\nKommentar:\n" + contact.getComment());
     }
 
-    @Override
-    public void doUserChangeAdressChoice (final Contact contact) throws UnhandledUserChoiceException {
-	// Ask the user for editing [name], [a]ddress or [other] data
-	char choice = this.enterChar(new char[]{'n', 'a', 'o', 'x'}, "Welchen Daten möchten Sie ändern? (n=Namensdaten, a=Anschriftsdaten, o=Andere, x=Zurück zur Hauptauswahl) ");
-
-	// @TODO Get rid of this ugly switch block, too
-	switch (choice) {
-	    case 'n': // Name data
-		this.getContactManager().changeNameData(contact, this);
-		break;
-
-	    case 'a': // Address data
-		this.getContactManager().changeAddressData(contact, this);
-		break;
-
-	    case 'o': // Other data
-		this.getContactManager().changeOtherData(contact, this);
-		break;
-
-	    case 'x': // Exit this menu
-		// Ignored as it should go back
-		break;
-
-	    default:
-		// @TODO throw own exception
-		throw new UnhandledUserChoiceException("Choice '" + choice + "' not handled yet.");
-	}
-    }
-
     @Override
     public void doUserMenuChoice () throws UnhandledUserChoiceException {
 	// Get all access keys from menu
@@ -160,7 +131,7 @@ public class ConsoleClient extends BaseClient implements Client {
 	// @TODO Rewrite this ugly switch() block
 	switch (choice) {
 	    case '1': // Enter/add own data
-		this.getContactManager().enterOwnData();
+		this.getContactManager().doEnterOwnData();
 		break;
 	
 	    case '2': // Change own data
@@ -316,14 +287,43 @@ public class ConsoleClient extends BaseClient implements Client {
      */
     @Override
     public void showWelcome () {
-	 this.outputMessage("Welcome to " + AddressbookApplication.APP_TITLE + " v" + AddressbookApplication.APP_VERSION);
-	 this.outputMessage("");
-	 this.outputMessage("Copyright(c) 2015 by Roland Haeder, this is free software");
-	 
-	 // Debug message
-	 this.getLogger().debug("Intro shown to user");
+	this.outputMessage("Welcome to " + AddressbookApplication.APP_TITLE + " v" + AddressbookApplication.APP_VERSION);
+	this.outputMessage("");
+	this.outputMessage("Copyright(c) 2015 by Roland Haeder, this is free software");
+	
+	// Debug message
+	this.getLogger().debug("Intro shown to user");
      }
 
+    @Override
+    public void userChooseChangeContactData (final Contact contact) throws UnhandledUserChoiceException {
+	// Ask the user for editing [name], [a]ddress or [other] data
+	char choice = this.enterChar(new char[]{'n', 'a', 'o', 'x'}, "Welchen Daten möchten Sie ändern? (n=Namensdaten, a=Anschriftsdaten, o=Andere, x=Zurück zur Hauptauswahl) ");
+	
+	// @TODO Get rid of this ugly switch block, too
+	switch (choice) {
+	    case 'n': // Name data
+		this.getContactManager().doChangeNameData(contact, this);
+		break;
+		
+	    case 'a': // Address data
+		this.getContactManager().doChangeAddressData(contact, this);
+		break;
+		
+	    case 'o': // Other data
+		this.getContactManager().doChangeOtherData(contact, this);
+		break;
+		
+	    case 'x': // Exit this menu
+		// Ignored as it should go back
+		break;
+		
+	    default:
+		// @TODO throw own exception
+		throw new UnhandledUserChoiceException("Choice '" + choice + "' not handled yet.");
+	}
+    }
+
     /**
      * Fills menu map with menu entries
      */
diff --git a/Addressbook/src/org/mxchange/addressbook/manager/contact/ContactManager.java b/Addressbook/src/org/mxchange/addressbook/manager/contact/ContactManager.java
index 0b4b47b..befd9a6 100644
--- a/Addressbook/src/org/mxchange/addressbook/manager/contact/ContactManager.java
+++ b/Addressbook/src/org/mxchange/addressbook/manager/contact/ContactManager.java
@@ -89,6 +89,56 @@ public class ContactManager extends BaseManager implements ManageableContact {
 	throw new UnsupportedOperationException("Not supported yet.");
     }
 
+    /**
+     * Let the user change other address
+     */
+    @Override
+    public void changeOtherAddress () {
+	throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    /**
+     * Allows the user to change his/her own data
+     */
+    @Override
+    public void changeOwnData () {
+	/*
+	 * First check if the user has registered own contact, before that
+	 * nothing can be changed.
+	 */
+	if (!this.isOwnContactAdded()) {
+	    // Not added
+	    this.getClient().outputMessage("Sie haben noch nicht Ihre Daten eingegeben.");
+	    
+	    // Skip any below code
+	    return;
+	}
+	
+	// Instance
+	Contact contact = this.getOwnContact();
+	
+	// It must be found
+	assert(contact instanceof Contact);
+	
+	// Display contact
+	contact.show(this.getClient());
+	
+	try {
+	    // Ask user what to change
+	    this.getClient().userChooseChangeContactData(contact);
+	} catch (final UnhandledUserChoiceException ex) {
+	    this.getLogger().catching(ex);
+	}
+    }
+
+    /**
+     * Let the user delete other address
+     */
+    @Override
+    public void deleteOtherAddress () {
+	throw new UnsupportedOperationException("Not supported yet.");
+    }
+
     /**
      * Let the user change address data
      * 
@@ -96,7 +146,7 @@ public class ContactManager extends BaseManager implements ManageableContact {
      * @param client Client instance to call back
      */
     @Override
-    public void changeAddressData (final Contact contact, final Client client) {
+    public void doChangeAddressData (final Contact contact, final Client client) {
 	// First display it again
 	client.displayAddressBox(contact);
 
@@ -129,7 +179,7 @@ public class ContactManager extends BaseManager implements ManageableContact {
      * @param client Client instance to call back
      */
     @Override
-    public void changeNameData (final Contact contact, final Client client) {
+    public void doChangeNameData (final Contact contact, final Client client) {
 	// First display them again
 	client.displayNameBox(contact);
 
@@ -156,14 +206,6 @@ public class ContactManager extends BaseManager implements ManageableContact {
 	}
     }
 
-    /**
-     * Let the user change other address
-     */
-    @Override
-    public void changeOtherAddress () {
-	throw new UnsupportedOperationException("Not supported yet.");
-    }
-
     /**
      * Let the user change other data
      *
@@ -171,49 +213,7 @@ public class ContactManager extends BaseManager implements ManageableContact {
      * @param client Client instance to call back
      */
     @Override
-    public void changeOtherData (final Contact contact, final Client client) {
-	throw new UnsupportedOperationException("Not supported yet.");
-    }
-
-    /**
-     * Allows the user to change his/her own data
-     */
-    @Override
-    public void changeOwnData () {
-	/*
-	 * First check if the user has registered own contact, before that 
-	 * nothing can be changed.
-	 */
-	if (!this.isOwnContactAdded()) {
-	    // Not added
-	    this.getClient().outputMessage("Sie haben noch nicht Ihre Daten eingegeben.");
-
-	    // Skip any below code
-	    return;
-	}
-
-	// Instance
-	Contact contact = this.getOwnContact();
-
-	// It must be found
-	assert(contact instanceof Contact);
-
-	// Display contact
-	contact.show(this.getClient());
-
-	try {
-	    // Ask user what to change
-	    this.getClient().doUserChangeAdressChoice(contact);
-	} catch (final UnhandledUserChoiceException ex) {
-	    this.getLogger().catching(ex);
-	}
-    }
-
-    /**
-     * Let the user delete other address
-     */
-    @Override
-    public void deleteOtherAddress () {
+    public void doChangeOtherData (final Contact contact, final Client client) {
 	throw new UnsupportedOperationException("Not supported yet.");
     }
 
@@ -221,7 +221,7 @@ public class ContactManager extends BaseManager implements ManageableContact {
      * Asks user for own data
      */
     @Override
-    public void enterOwnData () {
+    public void doEnterOwnData () {
 	// First ask for gender
 	char gender = this.enterOwnGender();
 
diff --git a/Addressbook/src/org/mxchange/addressbook/manager/contact/ManageableContact.java b/Addressbook/src/org/mxchange/addressbook/manager/contact/ManageableContact.java
index 1d41304..9378f65 100644
--- a/Addressbook/src/org/mxchange/addressbook/manager/contact/ManageableContact.java
+++ b/Addressbook/src/org/mxchange/addressbook/manager/contact/ManageableContact.java
@@ -45,7 +45,7 @@ public interface ManageableContact extends Manageable {
      * @param contact Instance to change data
      * @param client Client instance to call back
      */
-    public void changeAddressData (final Contact contact, final Client client);
+    public void doChangeAddressData (final Contact contact, final Client client);
 
     /**
      * The user can change name data, like gender, surname, family name and
@@ -54,7 +54,7 @@ public interface ManageableContact extends Manageable {
      * @param contact Instance to change data
      * @param client Client instance to call back
      */
-    public void changeNameData (final Contact contact, final Client client);
+    public void doChangeNameData (final Contact contact, final Client client);
 
     /**
      * Let the user change other address
@@ -67,7 +67,7 @@ public interface ManageableContact extends Manageable {
      * @param contact Instance to change data
      * @param client Client instance to call back
      */
-    public void changeOtherData (final Contact contact, final Client client);
+    public void doChangeOtherData (final Contact contact, final Client client);
 
     /**
      * Let the user change own data
@@ -82,7 +82,7 @@ public interface ManageableContact extends Manageable {
     /**
      * Asks user for own data
      */
-    public void enterOwnData ();
+    public void doEnterOwnData ();
 
     /**
      * Getter for size
-- 
2.39.5