Libraryless. Click here for Pure Java version (29432L/179K).
1 | interface IG22MasksHolder<A> { |
2 | replace Mask with IG22Mask<A>. |
3 | |
4 | WidthAndHeight maskSize(); |
5 | L<Image2B> maskImages(); |
6 | //LPair<Image2B, A> maskImagesWithLabels(); |
7 | L<? extends Mask> masks(); |
8 | G22GhostImage ghost(); |
9 | double certainty(); |
10 | default int nMasks() { ret l(masks()); } |
11 | |
12 | default S renderCountAndCertainty() { |
13 | ret main nMasks(nMasks()) + " with c=" + formatDouble3(certainty()); |
14 | } |
15 | |
16 | default bool canSplit() { ret nMasks() > 1; } |
17 | |
18 | default L<IG22MasksHolder<A>> subHolders() { null; } |
19 | default void transformSubHolders(IF1<IG22MasksHolder<A>> f) {} |
20 | |
21 | default PStackComputable<Void> findSimilarMasks(G22FindSimilarMasksTask<A> task) { |
22 | ret new FindSimilarMasks_BruteForce<A>(this, task); |
23 | } |
24 | |
25 | srecord noeq FindSimilarMasks_BruteForce<A>(IG22MasksHolder<A> masksHolder, G22FindSimilarMasksTask<A> task) extends PStackComputableWithStep<Void> { |
26 | Mask maskBeingTested; |
27 | |
28 | toString { ret formatFunctionCall(shortClassName(this), masksHolder, "step=" + step); } |
29 | |
30 | void step(IPStack stack) { |
31 | if (task.ended()) ret with stack.ret(); |
32 | if (step == 0) { |
33 | ++step; |
34 | stack.optionsOrReturn(this, map(masksHolder.masks(), mask -> |
35 | self -> self.maskBeingTested = mask)); |
36 | } else { |
37 | task.tryMask(maskBeingTested); |
38 | stack.ret(); |
39 | } |
40 | } |
41 | } |
42 | |
43 | <B> IG22MasksHolder<B> cloneTreeWithLabelTransform(IF1<A, B> transformLabel); |
44 | |
45 | default L<A> labels() { ret map(masks(), -> .label()); } |
46 | |
47 | default Image2B regionToMaskImage(IImageRegion region) { |
48 | ret region == null ?: g22standardRegionToMaskImage(region, maskSize()); |
49 | } |
50 | } |
Began life as a copy of #1035849
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): elmgxqgtpvxh, mqqgnosmbjvj, wnsclhtenguj
No comments. add comment
Snippet ID: | #1035852 |
Snippet name: | IG22MasksHolder - interface to masks holders |
Eternal ID of this version: | #1035852/44 |
Text MD5: | 967e3b71dce6528418e81d880297cf11 |
Transpilation MD5: | 64c3d5f7bd55d908281d4ef5ee30aa5a |
Author: | stefan |
Category: | javax / gazelle 22 |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2023-02-13 22:56:55 |
Source code size: | 1675 bytes / 50 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 222 / 420 |
Version history: | 43 change(s) |
Referenced in: | [show references] |