Libraryless. Click here for Pure Java version (62L/1K).
// return Int.MAX_VALUE if not applicable // Lower score is better static int methodApplicabilityScore_onTypes(Method m, Class[] argTypes) { ret methodApplicabilityScore_onTypes((Executable) m, argTypes); } static int methodApplicabilityScore_onTypes(Executable m, Class[] argTypes) { Class<?>[] types = m.getParameterTypes(); if (types.length != argTypes.length) ret Int.MAX_VALUE; int score = 0; for (int i = 0; i < types.length; i++) { Class a = argTypes[i]; Class c = types[i]; if (c == a) {} // perfect match else if (isSubclassOf(a, c)) ++score; else ret Int.MAX_VALUE; } ret score; }
Began life as a copy of #1007854
download show line numbers debug dex old transpilations
Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1020935 |
| Snippet name: | methodApplicabilityScore_onTypes |
| Eternal ID of this version: | #1020935/2 |
| Text MD5: | 9ecd910c4d552e273440a0873cd9521d |
| Transpilation MD5: | 4da32f1c7acfcc68ac9f4df8877d1317 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2022-02-01 20:20:14 |
| Source code size: | 656 bytes / 19 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 581 / 682 |
| Version history: | 1 change(s) |
| Referenced in: | [show references] |