Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #18891
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Best strategy to follow a state transition? |
| Date | Sat, 22 Sep 2012 00:08:42 +0200 |
| Organization | A noiseless patient Spider |
| Lines | 31 |
| Message-ID | <k3ioh9$a21$1@dont-email.me> (permalink) |
| References | <505c4afc$0$6941$e4fe514c@news2.news.xs4all.nl> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | 7bit |
| Injection-Date | Fri, 21 Sep 2012 22:08:41 +0000 (UTC) |
| Injection-Info | mx04.eternal-september.org; posting-host="569992357cbe055fba9aefbb043cb68d"; logging-data="10305"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/QzWoJCFM/CJSM8l8YTP7+" |
| User-Agent | Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.28) Gecko/20120306 Thunderbird/3.1.20 |
| In-Reply-To | <505c4afc$0$6941$e4fe514c@news2.news.xs4all.nl> |
| Cancel-Lock | sha1:e+SxGHPsFmubBuetIoleugXHYTU= |
| Xref | csiph.com comp.lang.java.programmer:18891 |
Show key headers only | View raw
On 21/09/2012 13:09, Ben Engbers allegedly wrote: > Hi, > > 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? > > Ben Listeners. <http://docs.oracle.com/javase/tutorial/uiswing/events/changelistener.html> See also the (somewhat older) <http://docs.oracle.com/javase/7/docs/api/java/util/Observable.html>. -- DF.
Back to comp.lang.java.programmer | Previous | Next — Previous 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