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.

sclass JE_RepElement<A> extends JEInstantCompressor_AnyType<L<A>> {
  scaffolded public IJavaExpr compress(L<A> data) {
    bool sc = scaffoldingEnabled(this);
    if (empty(data)) null;
    A a = first(data);
    int n = l(data);
    for (int i = 1; i < n; i++)
      if (!eq(data.get(i), a)) {
        if (sc) scaffoldCalled(this, "diff at " + i + "/" + n);
        null;
      }
    ret javaExpr(
      functionCall repSimple(n, elementToJava(a)),
      -> repSimple(n, a));
  }
  
  swappable IJavaExpr elementToJava(A o) {
    var e = javaObjectToIJavaExpr(o);
    if (e == null) fail("elementToJava: " + className(o));
    ret e;
  }
}

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: 200 / 332
Version history: 13 change(s)
Referenced in: #1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674)