| Author |
Problem in State Design Pattern
|
Thamu Gurung
Ranch Hand
Joined: Feb 02, 2010
Posts: 39
|
|
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
Joined: Nov 18, 2006
Posts: 174
|
|
'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
|
Censorship is the younger of two shameful sisters, the older one bears the name inquisition.
-- Johann Nepomuk Nestroy
|
 |
Thamu Gurung
Ranch Hand
Joined: Feb 02, 2010
Posts: 39
|
|
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
Joined: Nov 18, 2006
Posts: 174
|
|
Maybe something like a stack for remembering the event sequence?
|
 |
Thamu Gurung
Ranch Hand
Joined: Feb 02, 2010
Posts: 39
|
|
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
|
 |
 |
|
|
subject: Problem in State Design Pattern
|
|
|