IITDU Forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Mediator Design pattern

3 posters

Go down

Java Mediator Design pattern

Post by BIT0119-Asif Sat Jan 29, 2011 12:50 am

public class Head extends Friend {

public Head(String name) {
super(name);
}

public void receive(String from, String message) {
System.out.println("Head '" + this.getName()
+ "' received a message from '" + from + "': " + message);
}
}
........................................................................
public class Receiver {

public static void main(String args[]) {

Head he = new Head("Asif Imran");
Friend f1 = new Friend("Amit");
Friend f2 = new Friend("Muctadir");


System.out.println("Chat Server");

he.send("Lets play NFS mostwanted");
f1.send("Asif Imran", "I need to do my design pattern home task");
he.send("Amit", "I have not done mine yet, but i want to play");
f2.send("No I want to play urban terror");
}

}
........................................................................................
public interface Connect {

/**
* Retrieve the name of the colleague.
*/
public String getName();




public void send(String to, String message);


public void send(String message);


public void receive(String from, String message);
}
....................................................................................
public class Friend implements Colleague {

private String name;


public Friend(String name) {
this.name = name;
}

public String getName() {
return this.name;
}


public void send(String to, String message) {
System.out.println("yes'" + this.name + "' is sending a message to '" + to
+ "': " + message);

}

public void send(String message) {
System.out.println("yes'" + this.name + "' is sending a public message: "
+ message);
this.forum.send(this.name, message);
}

public void receive(String from, String message) {
System.out.println("Hello, '" + this.name
+ "' received a message from '" + from + "': " + message);
}

}
BIT0119-Asif
BIT0119-Asif
Study Moderator
Study Moderator

Course(s) :
  • BIT

Blood Group : B+
Posts : 163
Points : 432

Back to top Go down

Java Re: Mediator Design pattern

Post by BIT0122-Amit Sat Jan 29, 2011 1:03 am

খাইছে!! আসিফ নাকি!!
দোস্ত, কোডটা কোড ট্যাগ ব্যবহার করে দাও একটু কষ্ট করে। আর আলাদা আলাদা করে কোড ট্যাগ ব্যবহার করলে পড়তে সুবিধা। নাহলে বার বার গুলায়ে যাচ্ছে। Razz
BIT0122-Amit
BIT0122-Amit
Founder
Founder

Course(s) :
  • BIT

Blood Group : O+
Posts : 4187
Points : 6605

https://iitdu.forumotion.com

Back to top Go down

Java Re: Mediator Design pattern

Post by BIT0111-muctadir Sat Jan 29, 2011 2:05 am

এখানে দুইজন লোককে তেল দেওয়া হয়েছে..... very very funny very very funny
BIT0111-muctadir
BIT0111-muctadir
Expert
Expert

Course(s) :
  • BIT

Blood Group : B+
Posts : 233
Points : 395

Back to top Go down

Java Re: Mediator Design pattern

Post by BIT0122-Amit Sat Jan 29, 2011 2:59 am

ঘন্টার তেল। ব্যাটা আমাদের ফাকিবাজ হিসেবে চিত্রায়িত করেছে।
ভালো করে দেখ। আমাদের দেখাচ্ছে আমরা তার পড়াশুনায় ব্যাঘাত করছি।
ওরে যদি আর খেলায় নিছি....
BIT0122-Amit
BIT0122-Amit
Founder
Founder

Course(s) :
  • BIT

Blood Group : O+
Posts : 4187
Points : 6605

https://iitdu.forumotion.com

Back to top Go down

Java Re: Mediator Design pattern

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum