Libraryless. Click here for Pure Java version (6181L/37K).
//set flag JSONSpecialIntegral_debug. svoid test_JSONSpecialIntegral() { new JSONSpecialIntegral integral; integral.analyze([[{"abcdefghijklmnop": "abcdefghijklmnopq", "abcdefghijklmnopq": ["abc","abcdefghijklmnop"]}]]); print(integral.stats()); print(sfuWithIndent(1, integral)); int n = integral.n(); embedded void descend(int i, int iEnd, int remainingDepth) { printVars descend(i, iEnd, remainingDepth); if (i >= iEnd || remainingDepth <= 0) ret; // out of characters or depth // bracket level at start, bracket level at end int lvlLeft = integral.bracketLevel(i-1); int lvlRight = integral.bracketLevel(iEnd-1); // count at start, count at end int cntLeft = integral.bracketCount(i-1); int cntRight = integral.bracketCount(iEnd-1); int brackets = cntRight-cntLeft; print("Brackets in range " + i + " to " + iEnd + ": " + brackets); if (brackets == 0) ret; int iMid = (i+iEnd) >> 1; descend(i, i, iMid); descend(i, iMid, iEnd); } int lvl = integral.bracketLevel(n-1); if (lvl != 0) fail("Bad brackets: level at end is " + lvl); int depth = 1; descend(0, n, depth); }
Began life as a copy of #1032590
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1032594 |
Snippet name: | test_JSONSpecialIntegral [dev.] |
Eternal ID of this version: | #1032594/15 |
Text MD5: | 1636594e74c3872a252ec71f315f408b |
Transpilation MD5: | ca38c888e498204d1adf87d87558637c |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-09-23 10:05:23 |
Source code size: | 1229 bytes / 39 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 145 / 251 |
Version history: | 14 change(s) |
Referenced in: | [show references] |