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

32
LINES

< > BotCompany Repo | #1020759 // callFInRealOrMyMC - callF + adjust for real main class [now just a synonym of callF since string functions are discontinued]

JavaX fragment (include)

ifclass F0
  static <A> A callFInRealOrMyMC(O realm, F0<A> f) {
    ret f == null ? null : f.get();
  }
endif

ifclass F1
  static <A, B> B callFInRealOrMyMC(O realm, F1<A, B> f, A a) {
    ret f == null ? null : f.get(a);
  }
endif

ifclass F2
  static <A, B, C> C callFInRealOrMyMC(O realm, F2<A, B, C> f, A a, B b) {
    ret f == null ? null : f.get(a, b);
  }
endif

ifclass VF1
  static <A> void callFInRealOrMyMC(O realm, VF1<A> f, A a) {
    if (f != null) f.get(a);
  }
endif

static O callFInRealOrMyMC(O realm, O f, O... args) {
  if (f cast S) {
    Class mc = getMainClass(realm);
    if (hasMethod(mc, f, args))
      ret call(mc, f, args);
  }
  ret callF(f, args);
}

Author comment

Began life as a copy of #1020757

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1020759
Snippet name: callFInRealOrMyMC - callF + adjust for real main class [now just a synonym of callF since string functions are discontinued]
Eternal ID of this version: #1020759/3
Text MD5: 4538dc3ce59ba78b11233d2753e0762d
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-26 12:40:13
Source code size: 712 bytes / 32 lines
Pitched / IR pitched: No / No
Views / Downloads: 207 / 243
Version history: 2 change(s)
Referenced in: [show references]