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

33
LINES

< > BotCompany Repo | #1029112 // Live Compressor (LCStreamingCompressor)

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Uses 12447K of libraries. Click here for Pure Java version (11584L/55K).

!7

cmodule LiveCompressor {
  switchable int nPredictions = 5;
  switchable bool optimize;
  S input, output, prediction;
  transient new LCStreamingCompressor comp;
  transient S compressedText;
  
  visual centerAndSouth(jvsplit(
      dm_textAreaAsSection input(),
      dm_textAreaAsSection output()),
    dm_labelAsSection prediction());
    
  start {
    dm_onFieldChangeAndNow input(r calc);
  }
  
  void calc {
    S input = this.input;
    new Matches m;
    if (optimize && startsWith(input, compressedText, m))
      comp.append(m.rest());
    else {
      comp = new LCStreamingCompressor;
      comp.append(input);
    }
    compressedText = input;
    setField(output := lcStream_textWithBrackets(comp));
    
    setField(prediction := join(lcStream_repeatedPrediction2(nPredictions, comp)));
  }
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1029112
Snippet name: Live Compressor (LCStreamingCompressor)
Eternal ID of this version: #1029112/11
Text MD5: 6c500f45b3f06ce293f8a4796a89c670
Transpilation MD5: 855ee50406e80d71f5c4a3a1d381dd3f
Author: stefan
Category: javax
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-12-21 19:18:23
Source code size: 848 bytes / 33 lines
Pitched / IR pitched: No / No
Views / Downloads: 147 / 1103
Version history: 10 change(s)
Referenced in: [show references]