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

22
LINES

< > BotCompany Repo | #1033207 // JE_RepElement

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

Transpiled version (7433L) is out of date.

1  
sclass JE_RepElement<A> extends JEInstantCompressor_AnyType<L<A>> {
2  
  scaffolded public IJavaExpr compress(L<A> data) {
3  
    bool sc = scaffoldingEnabled(this);
4  
    if (empty(data)) null;
5  
    A a = first(data);
6  
    int n = l(data);
7  
    for (int i = 1; i < n; i++)
8  
      if (!eq(data.get(i), a)) {
9  
        if (sc) scaffoldCalled(this, "diff at " + i + "/" + n);
10  
        null;
11  
      }
12  
    ret javaExpr(
13  
      functionCall repSimple(n, elementToJava(a)),
14  
      -> repSimple(n, a));
15  
  }
16  
  
17  
  swappable IJavaExpr elementToJava(A o) {
18  
    var e = javaObjectToIJavaExpr(o);
19  
    if (e == null) fail("elementToJava: " + className(o));
20  
    ret e;
21  
  }
22  
}

Author comment

Began life as a copy of #1033095

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1033207
Snippet name: JE_RepElement
Eternal ID of this version: #1033207/14
Text MD5: 93b3c943256abefa2c3327f1c57a594a
Author: stefan
Category: javax / recognition by compression
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-16 05:36:17
Source code size: 662 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 199 / 330
Version history: 13 change(s)
Referenced in: [show references]