From e30d11545f7ad66af401a7e843cf2a30727aa93e Mon Sep 17 00:00:00 2001 From: Ehsan Date: Fri, 29 Nov 2019 02:59:56 +0330 Subject: [PATCH] removes the Citizen class in src directory. changes messages printed by the secretary and the president. --- .../com/designpatterns/structural/proxy/Citizen.java | 11 ----------- .../structural/proxy/president/President.java | 2 +- .../proxy/president/PresidentSecretary.java | 4 ++-- 3 files changed, 3 insertions(+), 14 deletions(-) delete mode 100644 src/main/java/com/designpatterns/structural/proxy/Citizen.java diff --git a/src/main/java/com/designpatterns/structural/proxy/Citizen.java b/src/main/java/com/designpatterns/structural/proxy/Citizen.java deleted file mode 100644 index 3f34e5f7..00000000 --- a/src/main/java/com/designpatterns/structural/proxy/Citizen.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.designpatterns.structural.proxy; - -import com.designpatterns.structural.proxy.president.PresidentSecretary; - -public class Citizen { - - public static void main(String[] args) { - PresidentSecretary presidentSecretary = new PresidentSecretary(); - presidentSecretary.leaveValidMessageForPresident("Hello president."); - } -} diff --git a/src/main/java/com/designpatterns/structural/proxy/president/President.java b/src/main/java/com/designpatterns/structural/proxy/president/President.java index 18d0e31c..50b712b4 100644 --- a/src/main/java/com/designpatterns/structural/proxy/president/President.java +++ b/src/main/java/com/designpatterns/structural/proxy/president/President.java @@ -22,6 +22,6 @@ public class President { void talkToThePresident(String message){ - System.out.println("I, the President, have received this message:" + message); + System.out.println("President: I have received the message:" + message); } } diff --git a/src/main/java/com/designpatterns/structural/proxy/president/PresidentSecretary.java b/src/main/java/com/designpatterns/structural/proxy/president/PresidentSecretary.java index fd90a0b0..fb951ed9 100644 --- a/src/main/java/com/designpatterns/structural/proxy/president/PresidentSecretary.java +++ b/src/main/java/com/designpatterns/structural/proxy/president/PresidentSecretary.java @@ -13,9 +13,9 @@ public class PresidentSecretary { if(!isMessageValid(message)) throw new RuntimeException("invalid message"); - System.out.println("message is being sent to the President..."); + System.out.println("Secretary: message is being sent to the President..."); president.talkToThePresident(message); - System.out.println("message is received by the President."); + System.out.println("Secretary: message is sent to the President."); }