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

22
LINES

< > BotCompany Repo | #1029268 // createSuffixTreeForLCArchive

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

Uses 11335K of libraries. Click here for Pure Java version (16353L/113K).

1  
static File createSuffixTreeForLCArchive(File archiveFile, File treeFile) {
2  
  print("Reading " + archiveFile);
3  
  L<Int> encoding = LineCompReader(archiveFile).encoding();
4  
  
5  
  int endSymbol = -2;
6  
  IntBuffer buf = new(l(encoding)+1);
7  
  buf.addAll(encoding);
8  
  buf.add(endSymbol);
9  
  encoding = null;
10  
  print("Symbols: " + l(buf));
11  
  
12  
  time "Make Ukkonen tree" {
13  
    UkkonenIntSuffixTree uTree = new(buf.asVirtualList());
14  
  }
15  
  time "Convert Ukkonen tree to managed" {
16  
    IntSuffixTree_managed tree = ukkonenToIntSuffixTree_managed(uTree);
17  
  }
18  
  time "Save tree" {
19  
    tree.saveToFile(treeFile);
20  
  }
21  
  ret treeFile;
22  
}

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: #1029268
Snippet name: createSuffixTreeForLCArchive
Eternal ID of this version: #1029268/9
Text MD5: ab52a6b2db759eba038c35445481eac3
Transpilation MD5: 754eb386cc64d5210c4dcf8813dcb31c
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-07-29 21:21:45
Source code size: 638 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 285 / 394
Version history: 8 change(s)
Referenced in: [show references]