Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-27-2007, 06:32 PM
Senior Member
 
Join Date: Jun 2007
Posts: 114
Albert is on a distinguished road
Like fighting with the tiped one of JAVA
The problem is to implement a Observer pattern with two types of “dependents” that do not have anything to do to each other, the only thing that they share is a update() method . I am going to show it graphically, maybe you understand what am I talking about:

Code:
|--------------| |--------------------| |--------------| | Observer1 | | Model | | Observer2 | |--------------| |--------------------| |--------------| | |<--------- |dependents:ArrayList| --->| | |--------------| |--------------------| |--------------| |update():void | | changed():void | |update():void | |--------------| |--------------------| |--------------|
Code:
public void changed(){ Iterator it=dependents.iterator(); while(ir.hasNext()){ ______ object = (______) it.next(); object.update(); } }
any ideas? I want the solution without making 2 differents arrays.

Albert

Last edited by Albert : 06-27-2007 at 06:36 PM.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 06-27-2007, 06:38 PM
Member
 
Join Date: Jun 2007
Posts: 92
Marcus is on a distinguished road
RE: Like fighting with the tiped one of JAVA
The solution that you are looking for is deciphers here:

design-nation.blog/en: An example of the Observer pattern (the java version)

Marcus

Last edited by Marcus : 06-27-2007 at 06:40 PM.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +3. The time now is 04:07 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org