Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

18
LINES

< > BotCompany Repo | #1016014 // dm_calculatedLiveValue - live-value for a calculation that is updated when DynModule changes

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (15232L/93K).

static <A> LiveValue<A> dm_calculatedLiveValue(final DynModule module, final Class type, final F0<A> calc) {
  lock module.lock;
  final SimpleLiveValue value = new(type, callF(calc));
  module.onChange(r { value.set(callF(calc)) });
  ret value;
}

static <A> LiveValue<A> dm_calculatedLiveValue(Class type, F0<A> calc) {
  ret dm_calculatedLiveValue(dm_current_mandatory(), type, calc);
}

static <A> LiveValue<A> dm_calculatedLiveValue(Class<A> type, IF0<A> calc) {
  ret dm_calculatedLiveValue(type, if0ToF0(calc));
}

static LiveValue<O> dm_calculatedLiveValue(IF0<?> calc) {
  ret dm_calculatedLiveValue(O, (F0) if0ToF0(calc));
}

Author comment

Began life as a copy of #1015971

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1016014
Snippet name: dm_calculatedLiveValue - live-value for a calculation that is updated when DynModule changes
Eternal ID of this version: #1016014/9
Text MD5: e7653b8060cf4ac35f3d5bd18e73bfb1
Transpilation MD5: 1fcf9afbf32a88c450882f7a90d9b90b
Author: stefan
Category: javax / stefan's os
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-08-14 09:07:32
Source code size: 652 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 367 / 461
Version history: 8 change(s)
Referenced in: [show references]