• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem in State Design Pattern

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Really appreciate for all you help with my previous project. It was really nice and I got good grades in that . Thankyou everybody who gave their valuable time to me.

Now this time I have got some problems in making a automatic door locking system in State Design Pattern, I have searched internet but could not find any good examples of that .

My another problem is :

1) How to make an array of captured events.
2) how to synchronise the evetns .

Anyone could please help me understand the state desing pattern .

Regards ,

 
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
'Thinking in Java' should have the pattern discussed and also provide an example.

Our friend Google also gives some advice / directions:
http://www.javabeat.net/tips/5-state-pattern-design-patterns-in-javaj2ee.html
http://java-x.blogspot.com/2006/12/implementing-state-pattern-in-java.html
http://blogs.sun.com/jkumaran/entry/state_design_pattern_using_java

To your questions:
1) Why do you need an array (fixed size) for captured events? Wouldn't something like a Queue seem a natural approach?
2) TellTheDetails
 
Thamu Gurung
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Peter,

Thanks for the links.

Actually was trying to explore some more events in java , and got strucked in handling two or more button events at the same time.

In my simple design there are four button 1,2,3,4 and below is the textarea which is black in colour bydefault and , when any user cliks on 4 and then 3 , in seqeunce (first 4 , then 3), then the Color of the textarea , should be changed as green.

my code is here below:


Much help be appreciated .


Many Thanks
 
Peter Taucher
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe something like a stack for remembering the event sequence?

 
Thamu Gurung
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Peter,

Thanks for your kind reply.

It realy gave me idea of using Stacks , which i have never used .

Really appreicate your kind help.


Best Regards ,


Thamu
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic