Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #32482
| From | Jeff Higgins <jeff@invalid.invalid> |
|---|---|
| Newsgroups | comp.lang.c, comp.lang.java.programmer |
| Subject | Re: Self-updating relationship |
| Date | 2015-09-02 23:52 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <ms8g5j$o5k$1@dont-email.me> (permalink) |
| References | (1 earlier) <55E766BD.3060303@verizon.net> <spaces-20150902222406@ram.dialup.fu-berlin.de> <55E77D04.6080200@verizon.net> <properties-20150903001216@ram.dialup.fu-berlin.de> <55E78636.5000908@verizon.net> |
Cross-posted to 2 groups.
On 09/02/2015 07:28 PM, James Kuyper wrote: > On 09/02/2015 07:13 PM, Stefan Ram wrote: >> James Kuyper <jameskuyper@verizon.net> writes: >>> Those both set spaces to 8, rather than height - number. If >>> height-number is currently 8, that happens to be the right value, but >>> isn't what I'm looking for. >> >> If you just want to set »spaces« to »height - number« once, >> with no further update: > ... >> final javafx.beans.property.IntegerProperty spaces >> = new javafx.beans.property.SimpleIntegerProperty >> ( height.getValue() - number.getValue() ); > > So, using C++ as an analogy that I'm more familiar with, this constructs > "spaces" as a SimpleIntegerProperty initialized with the value of that > expression, which never gets re-evaluated. > > Your earlier version had: >> final javafx.beans.binding.NumberBinding spaces = >> height.subtract( number ); > > which causes spaces.getValue() to behave like the equivalent of a C++ > member function whose return value is calculated using the specified > formula freshly each time "spaces" is referred to. Is this a > characteristic of binding.NumberBinding, or some more general Java feature? It's a characteristic of the javafx.beans.binding.Binding<T> interface. <https://docs.oracle.com/javase/8/javafx/api/javafx/beans/binding/Binding.html> Which depends upon the arguably more general javafx.beans.Observable and javafx.beans.value.ObservableValue<T> interfaces. > > Have I got that right? > > In C++, the equivalent of the first form above would be simpler than the > equivalent of the second form, so it feels odd that the second form is > simpler in Java. I'll try to keep that in mind should I ever need to > program in Java again. It sounds like I've got a lot to learn before I > even get started. >
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: Self-updating relationship James Kuyper <jameskuyper@verizon.net> - 2015-09-02 17:14 -0400
Re: Self-updating relationship Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-09-02 17:46 -0400
Re: Self-updating relationship Arne Vajhøj <arne@vajhoej.dk> - 2015-09-03 21:06 -0400
Re: Self-updating relationship e.d.programmer@gmail.com - 2015-09-04 04:46 -0700
Re: Self-updating relationship Arne Vajhøj <arne@vajhoej.dk> - 2015-09-04 19:43 -0400
Re: Self-updating relationship Jeff Higgins <jeff@invalid.invalid> - 2015-09-04 11:49 -0400
Re: Self-updating relationship Arne Vajhøj <arne@vajhoej.dk> - 2015-09-04 19:45 -0400
Re: Self-updating relationship Jeff Higgins <jeff@invalid.invalid> - 2015-09-04 22:10 -0400
Re: Self-updating relationship Arne Vajhøj <arne@vajhoej.dk> - 2015-09-04 22:31 -0400
Re: Self-updating relationship Arne Vajhøj <arne@vajhoej.dk> - 2015-09-04 22:38 -0400
Re: Self-updating relationship Jeff Higgins <jeff@invalid.invalid> - 2015-09-04 22:51 -0400
Re: Self-updating relationship James Kuyper <jameskuyper@verizon.net> - 2015-09-02 18:49 -0400
Re: Self-updating relationship James Kuyper <jameskuyper@verizon.net> - 2015-09-02 19:28 -0400
Re: Self-updating relationship Jeff Higgins <jeff@invalid.invalid> - 2015-09-02 23:52 -0400
Re: Self-updating relationship Jeff Higgins <jeff@invalid.invalid> - 2015-09-03 10:32 -0400
Re: Self-updating relationship James Kuyper <jameskuyper@verizon.net> - 2015-09-03 10:53 -0400
Re: Self-updating relationship Jeff Higgins <jeff@invalid.invalid> - 2015-09-03 11:31 -0400
Re: Self-updating relationship Jeff Higgins <jeff@invalid.invalid> - 2015-09-03 11:35 -0400
Re: Self-updating relationship Jeff Higgins <jeff@invalid.invalid> - 2015-09-03 11:49 -0400
Re: Self-updating relationship James Kuyper <jameskuyper@verizon.net> - 2015-09-03 12:16 -0400
Re: Self-updating relationship Jeff Higgins <jeff@invalid.invalid> - 2015-09-03 13:03 -0400
Re: Self-updating relationship Jeff Higgins <jeff@invalid.invalid> - 2015-09-03 10:55 -0400
Re: Self-updating relationship James Kuyper <jameskuyper@verizon.net> - 2015-09-03 00:06 -0400
Re: Self-updating relationship Jeff Higgins <jeff@invalid.invalid> - 2015-09-02 23:38 -0400
Re: Self-updating relationship Jeff Higgins <jeff@invalid.invalid> - 2015-09-03 01:22 -0400
csiph-web