Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem in State Design Pattern

 
Thamu Gurung
Ranch Hand
Posts: 39
  • 0
  • Mark post as helpful
  • send pies
  • 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 ,

 
Peter Taucher
Ranch Hand
Posts: 174
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe something like a stack for remembering the event sequence?

 
Thamu Gurung
Ranch Hand
Posts: 39
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic