Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #18874
| From | "John B. Matthews" <nospam@nospam.invalid> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Best strategy to follow a state transition? |
| Date | 2012-09-21 07:36 -0400 |
| Organization | The Wasteland |
| Message-ID | <nospam-80C602.07363821092012@news.aioe.org> (permalink) |
| References | <505c4afc$0$6941$e4fe514c@news2.news.xs4all.nl> |
In article <505c4afc$0$6941$e4fe514c@news2.news.xs4all.nl>, Ben Engbers <Ben.dot.Engbers@Be-Logical.dot.nl> wrote: > In my program, I know that at some moment the value of a variable X > will change from value 1 to value 2. I am not interested in the value > of X itself but the transition should trigger an event. Example, if > the value of a stock will reach a certain value, I want to sell but > after that I'm not interested in the value anymore (until it might > reach another break-value). > > Of course I could program this as: > if oldvalue <= testvalue and newvalue > testvalue then > do something; > oldvalue = newvalue; > end > But suppose that there are a lot of variables that I need to watch > and I don't want to write a test for every one. > > Wat is the best strategy to watch the transition? It sounds like you want a bound property: <http://docs.oracle.com/javase/tutorial/javabeans/writing/properties.html> -- John B. Matthews trashgod at gmail dot com <http://sites.google.com/site/drjohnbmatthews>
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Best strategy to follow a state transition? Ben Engbers <Ben.dot.Engbers@Be-Logical.dot.nl> - 2012-09-21 13:09 +0200
Re: Best strategy to follow a state transition? "John B. Matthews" <nospam@nospam.invalid> - 2012-09-21 07:36 -0400
Re: Best strategy to follow a state transition? Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-09-21 09:51 -0400
Re: Best strategy to follow a state transition? Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-09-21 10:26 -0700
Re: Best strategy to follow a state transition? Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2012-09-22 00:08 +0200
csiph-web