From f2c4e7752e3e99321094ea5af7d8ad038588b204 Mon Sep 17 00:00:00 2001 From: nyabkun Date: Fri, 2 Jun 2023 04:31:30 +0900 Subject: [PATCH] [auto] Reflect the changes of main repository. --- CallChainNodeHitCount.txt | 23 - README.md | 168 ++- VERSION | 5 +- build.gradle.kts | 60 +- img/001-num-unicode.png | Bin 1255 -> 0 bytes img/002-num-ascii.png | Bin 1429 -> 0 bytes img/003-walk-tree.png | Bin 2001 -> 0 bytes img/004-string-tree.png | Bin 1132 -> 0 bytes img/005-dir-tree.png | Bin 1664 -> 0 bytes img/01-num-tree.png | Bin 0 -> 4402 bytes img/02-tree-walk.png | Bin 0 -> 5943 bytes img/03-file-tree.png | Bin 0 -> 12887 bytes rsc-test/root/Adir/A.txt | 0 rsc-test/root/Adir/Bdir/D.txt | 0 rsc-test/root/Adir/C.txt | 0 rsc-test/root/B.txt | 0 src-example/QTreeNodeExample.kt | 53 +- src-single/QTreeNode.kt | 625 +++++----- src-split/nyab/conf/QMyException.kt | 26 +- src-split/nyab/conf/QMyLog.kt | 2 +- src-split/nyab/conf/QMyMark.kt | 5 +- src-split/nyab/conf/QMyToString.kt | 2 +- src-split/nyab/match/QMFunc.kt | 64 +- src-split/nyab/util/QCache.kt | 24 +- src-split/nyab/util/QConcurrent.kt | 2 +- src-split/nyab/util/QException.kt | 12 +- src-split/nyab/util/QExtraProp.kt | 20 +- src-split/nyab/util/QLog.kt | 10 +- src-split/nyab/util/QOut.kt | 2 +- src-split/nyab/util/QReflection.kt | 11 +- src-split/nyab/util/QRegex.kt | 19 +- src-split/nyab/util/QShColor.kt | 214 ++-- src-split/nyab/util/QShortExtensions.kt | 2 +- src-split/nyab/util/QString.kt | 21 +- src-split/nyab/util/QStringMask.kt | 178 +-- src-split/nyab/util/QTime.kt | 2 +- src-split/nyab/util/QTreeNode.kt | 3 +- src-test-single/QTreeNodeTest.kt | 1106 +++++++++--------- src-test-split/nyab/conf/QMyException.kt | 51 +- src-test-split/nyab/conf/QMyLog.kt | 6 +- src-test-split/nyab/conf/QMyMark.kt | 15 +- src-test-split/nyab/conf/QMyPath.kt | 18 +- src-test-split/nyab/conf/QMyTest.kt | 4 +- src-test-split/nyab/conf/QMyToString.kt | 2 +- src-test-split/nyab/match/QM.kt | 46 +- src-test-split/nyab/match/QMFunc.kt | 64 +- src-test-split/nyab/match/QMMethod.kt | 6 +- src-test-split/nyab/test/QTest.kt | 28 +- src-test-split/nyab/util/QBit.kt | 2 +- src-test-split/nyab/util/QCache.kt | 30 +- src-test-split/nyab/util/QConcurrent.kt | 2 +- src-test-split/nyab/util/QException.kt | 34 +- src-test-split/nyab/util/QExtraProp.kt | 16 +- src-test-split/nyab/util/QFile.kt | 116 +- src-test-split/nyab/util/QFlag.kt | 24 +- src-test-split/nyab/util/QFormat.kt | 6 +- src-test-split/nyab/util/QLog.kt | 52 +- src-test-split/nyab/util/QOut.kt | 22 +- src-test-split/nyab/util/QReflection.kt | 19 +- src-test-split/nyab/util/QRegex.kt | 19 +- src-test-split/nyab/util/QShColor.kt | 240 ++-- src-test-split/nyab/util/QShortExtensions.kt | 2 +- src-test-split/nyab/util/QString.kt | 87 +- src-test-split/nyab/util/QStringAlign.kt | 2 +- src-test-split/nyab/util/QStringMask.kt | 180 +-- src-test-split/nyab/util/QTime.kt | 2 +- src-test-split/nyab/util/QTreeNode.kt | 7 +- stat.txt | 71 ++ 68 files changed, 1940 insertions(+), 1892 deletions(-) delete mode 100644 CallChainNodeHitCount.txt delete mode 100644 img/001-num-unicode.png delete mode 100644 img/002-num-ascii.png delete mode 100644 img/003-walk-tree.png delete mode 100644 img/004-string-tree.png delete mode 100644 img/005-dir-tree.png create mode 100644 img/01-num-tree.png create mode 100644 img/02-tree-walk.png create mode 100644 img/03-file-tree.png create mode 100644 rsc-test/root/Adir/A.txt create mode 100644 rsc-test/root/Adir/Bdir/D.txt create mode 100644 rsc-test/root/Adir/C.txt create mode 100644 rsc-test/root/B.txt create mode 100644 stat.txt diff --git a/CallChainNodeHitCount.txt b/CallChainNodeHitCount.txt deleted file mode 100644 index 0d9c75e..0000000 --- a/CallChainNodeHitCount.txt +++ /dev/null @@ -1,23 +0,0 @@ -## main - N.depthFirst() [KtNamedFunction] : 401 - QE.throwIt() [KtNamedFunction] : 397 - QException.QException() [KtPrimaryConstructor] : 332 - QException.printStackTrace() [KtNamedFunction] : 186 - QException.mySrcAndStack [KtProperty] : 185 - qLogStackFrames() [KtNamedFunction] : 162 - QException.toString() [KtNamedFunction] : 134 - QException.qToString() [KtNamedFunction] : 133 - yellow [KtProperty] : 113 - qMySrcLinesAtFrame() [KtNamedFunction] : 96 - -## test - QTreeNodeTest.testDepthFirstSearch() [KtNamedFunction] : 457 - Any?.shouldBe() [KtNamedFunction] : 421 - qBrackets() [KtNamedFunction] : 200 - QE.throwItBrackets() [KtNamedFunction] : 194 - QException.QException() [KtPrimaryConstructor] : 192 - QException.printStackTrace() [KtNamedFunction] : 178 - QException.mySrcAndStack [KtProperty] : 177 - main() [KtNamedFunction] : 171 - qTest() [KtNamedFunction] : 170 - qLogStackFrames() [KtNamedFunction] : 155 \ No newline at end of file diff --git a/README.md b/README.md index e710052..b426783 100644 --- a/README.md +++ b/README.md @@ -1,107 +1,143 @@ + + # 🐕 qq-tree **qq-tree** is a Kotlin library that can construct a tree structure. -- Just copy and paste 🟦 Single-File version [QTreeNode.kt](src-single/QTreeNode.kt) into your project.- Or you can use 🟩 Split-File Jar version. See [Maven Dependency Section](#-split-file-jar-version-maven-dependency). -- Feel free to fork or copy to your own codebase. +## How to use +- Just copy and paste Single-File version [QTreeNode.kt](src-single/QTreeNode.kt) into your project. +- Or you can use Jar version. See [Maven Dependency Section](#jar-version-maven-dependency). +- Feel free to fork or copy to your own codebase 😍 ## Example ### output

- 001-num-unicode.png -002-num-ascii.png + 01-num-tree.png

- 003-walk-tree.png + 02-tree-walk.png

- 004-string-tree.png -005-dir-tree.png + 03-file-tree.png

-### code +### code example -Full Source [QTreeNodeExample.kt](src-example/QTreeNodeExample.kt) +Full Source : [QTreeNodeExample.kt](src-example/QTreeNodeExample.kt) ```kotlin -// First, you have to create the root node. -val root = QTreeNode(0) - -val node1 = root add 1 -val node2 = root add 2 -val node3 = node2 add 3 -val node4 = node2 add 4 -val node5 = node4 add 5 -val node6 = node4 add 6 -val node7 = node2 add 7 - -val unicodeTree = root.tree(color = QShColor.GREEN, style = QTreeStyle.UNICODE) +fun intTree() { + // First, you have to create the root node. + val root = QTreeNode(0) -println(unicodeTree) + val node1 = root add 1 + val node2 = root add 2 + val node3 = node2 add 3 + val node4 = node2 add 4 + val node5 = node4 add 5 + val node6 = node4 add 6 + val node7 = node2 add 7 -val asciiTree = root.tree(color = QShColor.BLUE, style = QTreeStyle.ASCII) + val unicodeTree = root.tree(color = QShColor.Green, style = QTreeStyle.UNICODE) -println(asciiTree) + println(unicodeTree) -println() + val asciiTree = root.tree(color = QShColor.Blue, style = QTreeStyle.ASCII) -val depthFirstResult = root.descendantsList(QSearchAlgo.DepthFirst).toString() + println(asciiTree) -println("DepthFirst : $depthFirstResult") // [0, 1, 2, 3, 4, 5, 6, 7] + println() -val breadthFirstResult = root.descendantsList(QSearchAlgo.BreadthFirst).toString() + val depthFirstResult = root.descendantsList(QSearchAlgo.DepthFirst).toString() -println("BreadthFirst : $breadthFirstResult") // [0, 1, 2, 3, 4, 7, 5, 6] + println("DepthFirst : $depthFirstResult") // [0, 1, 2, 3, 4, 5, 6, 7] -println() + val breadthFirstResult = root.descendantsList(QSearchAlgo.BreadthFirst).toString() -// node can store anything -val rootA = QTreeNode("A") -val nodeB = rootA add "B" -val nodeC = nodeB add "C" -val nodeD = nodeB add "D" -val nodeE = nodeD add "E" -val nodeF = nodeE add "F" -val nodeG = nodeC add "G" - -val textTree = rootA.tree(color = QShColor.CYAN, style = QTreeStyle.UNICODE) + println("BreadthFirst : $breadthFirstResult") // [0, 1, 2, 3, 4, 7, 5, 6] +} -println(textTree) +fun textTree() { + // node can store anything + val rootA = QTreeNode("A") + val nodeB = rootA add "B" + val nodeC = nodeB add "C" + val nodeD = nodeB add "D" + val nodeE = nodeD add "E" + val nodeF = nodeE add "F" + val nodeG = nodeC add "G" -// You can implement QLazyNode for more complicated situations. -class QFileNode(override val value: Path) : QLazyTreeNode { - override fun hasChildNodesToFill(): Boolean { - return value.isDirectory() - } + val textTree = rootA.tree(color = QShColor.Cyan, style = QTreeStyle.UNICODE) - override fun fillChildNodes(): List = Files.walk(value, 1).filter { - it != value - }.map { - QFileNode(it) - }.toList() + println(textTree) +} - override fun toTreeNodeString(): String { - return value.name +fun fileTree() { + // You can implement QLazyNode for more complicated situations. + class QFileNode(override val value: Path) : QLazyTreeNode { + override fun hasChildNodesToFill(): Boolean { + return value.isDirectory() + } + + override fun fillChildNodes(): List { + return Files.walk(value, 1).asSequence().filter { + it != value + }.sortedBy { + it.name + }.sortedBy { + !it.isDirectory() + }.map { + QFileNode(it) + }.toList() + } + + override fun toTreeNodeString(): String { + return if (value.isDirectory()) "📁" + value.name else value.name + } } -} -val rootDir = Paths.get("rsc-test/root-dir").toAbsolutePath() + val rootDir = Paths.get("src-split").toAbsolutePath() -val fileTree = QFileNode(rootDir).fillTree(maxDepth = 2).tree() + val fileTree = QFileNode(rootDir).fillTree(maxDepth = 3).tree() -println(fileTree) + println(fileTree) +} ``` Please see [QTreeNodeTest.kt](src-test-split/nyab/util/QTreeNodeTest.kt) for more code examples. Single-File version [src-test-single/QTreeNodeTest.kt](src-test-single/QTreeNodeTest.kt) is a self-contained source code that includes a runnable main function. You can easily copy and paste it into your codebase. -## 🟦 Single-File version Dependency - -If you copy & paste [QTreeNode.kt](src-single/QTreeNode.kt). - -Refer to [build.gradle.kts](build.gradle.kts) to directly check project settings. +## Public API + +- [`N.fillTree()`](src-split/nyab/util/QTreeNode.kt#L71-L110) *extension function* +- [`N.root()`](src-split/nyab/util/QTreeNode.kt#L112-L122) *extension function* +- [`N.isRoot()`](src-split/nyab/util/QTreeNode.kt#L124-L128) *extension function* +- [`N.hasCycle()`](src-split/nyab/util/QTreeNode.kt#L130-L149) *extension function* +- [`N.depth()`](src-split/nyab/util/QTreeNode.kt#L191-L207) *extension function* +- [`N.tree()`](src-split/nyab/util/QTreeNode.kt#L222-L269) *extension function* +- [`N.descendants()`](src-split/nyab/util/QTreeNode.kt#L271-L284) *extension function* +- [`N.add()`](src-split/nyab/util/QTreeNode.kt#L385-L393) *extension function* +- [`N.add()`](src-split/nyab/util/QTreeNode.kt#L395-L407) *extension function* +- [`N.add()`](src-split/nyab/util/QTreeNode.kt#L409-L415) *extension function* +- [`N.newNode()`](src-split/nyab/util/QTreeNode.kt#L417-L425) *extension function* +- [`N.ancestors()`](src-split/nyab/util/QTreeNode.kt#L427-L449) *extension function* +- [`N.descendantsList()`](src-split/nyab/util/QTreeNode.kt#L451-L458) *extension function* +- [`N.ancestorsList()`](src-split/nyab/util/QTreeNode.kt#L460-L466) *extension function* +- [`N.isLeaf`](src-split/nyab/util/QTreeNode.kt#L151-L156) *extension property* +- [`N.parent`](src-split/nyab/util/QTreeNode.kt#L158-L174) *extension property* +- [`N.children`](src-split/nyab/util/QTreeNode.kt#L176-L189) *extension property* +- [`QTreeNode`](src-split/nyab/util/QTreeNode.kt#L22-L31) *class* +- [`QLazyTreeNode`](src-split/nyab/util/QTreeNode.kt#L33-L54) *interface* +- [`QTreeNodeI`](src-split/nyab/util/QTreeNode.kt#L56-L69) *interface* +- [`QTreeStyle`](src-split/nyab/util/QTreeNode.kt#L209-L220) *enum class* +- [`QSearchAlgo`](src-split/nyab/util/QTreeNode.kt#L468-L476) *enum class* + +## Single-File version Dependency + +If you copy & paste [QTreeNode.kt](src-single/QTreeNode.kt), +fefer to [build.gradle.kts](build.gradle.kts) to directly check project settings. @@ -112,9 +148,10 @@ dependencies { } ``` -## 🟩 Split-File Jar version Maven Dependency +## Jar version Maven Dependency -If you prefer a jar library. Add [jitpack.io](https://jitpack.io/#nyabkun/qq-tree) repository to the build script. +If you prefer a jar library, +you can use [jitpack.io](https://jitpack.io/#nyabkun/qq-tree) repository. ### build.gradle ( Groovy ) ```groovy @@ -162,7 +199,8 @@ dependencies { ## How did I create this library -- This library was created using [qq-compact-lib](https://github.com/nyabkun/qq-compact-lib) to generates compact, self-contained libraries. +- This library was created using [qq-compact-lib](https://github.com/nyabkun/qq-compact-lib) to generates a compact, self-contained library. +- **qq-compact-lib** is a Kotlin library that can extract code elements from your codebase and make a compact library. - It utilizes [PSI](https://plugins.jetbrains.com/docs/intellij/psi.html) to resolve function calls and class references. - The original repository is currently being organized, and I'm gradually extracting and publishing smaller libraries. diff --git a/VERSION b/VERSION index dbfca95..8a83a77 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,3 @@ -v2023-05-28 -f5b4d712c22124fd15407d08997388b76e203043bd70d311e0d99743b371686862e5dc3710e95643d6996905b36afa739d1a85608de21f0974de692eb1475d3b \ No newline at end of file +v2023-06-02 +9f574957f68e0c5fa892cca1a02c6780848e9703f7469edf640b72eae033539c1a1d8f3eaf980b909a7c78afbd552713b64c4474dbb5def02299498427a080fe +build/libs/qq-tree-v2023-06-02.jar;build/libs/qq-tree-v2023-06-02-sources.jar \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 218388c..cea21eb 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -27,9 +27,9 @@ plugins { } -group = "com.nyabkun.qol" +group = "com.github.nyabkun" -version = "v2023-05-28" +version = "v2023-06-02" repositories { mavenCentral() @@ -45,37 +45,37 @@ java { sourceSets.main { - java.srcDirs("src-split") + java.srcDirs("src-split") - resources.srcDirs("rsc") - } + resources.srcDirs("rsc") +} - sourceSets.test { - java.srcDirs("src-test-split") +sourceSets.test { + java.srcDirs("src-test-split") - resources.srcDirs("rsc-test") - } - - sourceSets.register("example") { - java.srcDirs("src-example") - val jarFile = "$buildDir/libs/$qMavenArtifactId-$version.jar" - compileClasspath += files(jarFile) - runtimeClasspath += files(jarFile) - - resources.srcDirs("rsc") - } - - tasks.getByName("compileExampleKotlin").dependsOn("jar") - - val exampleImplementation: Configuration by configurations.getting { - extendsFrom(configurations.implementation.get()) - } - - val exampleRuntimeOnly: Configuration by configurations.getting { - extendsFrom(configurations.runtimeOnly.get()) - } - - sourceSets.register("single") { + resources.srcDirs("rsc-test") +} + +sourceSets.register("example") { + java.srcDirs("src-example") + val jarFile = "$buildDir/libs/$qMavenArtifactId-$version.jar" + compileClasspath += files(jarFile) + runtimeClasspath += files(jarFile) + + resources.srcDirs("rsc") +} + +tasks.getByName("compileExampleKotlin").dependsOn("jar") + +val exampleImplementation: Configuration by configurations.getting { + extendsFrom(configurations.implementation.get()) +} + +val exampleRuntimeOnly: Configuration by configurations.getting { + extendsFrom(configurations.runtimeOnly.get()) +} + +sourceSets.register("single") { java.srcDirs("src-single") } diff --git a/img/001-num-unicode.png b/img/001-num-unicode.png deleted file mode 100644 index 17b6802391e07d917788ac2a6ccf7cfac57253df..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1255 zcmY+DeN0nV7{-r$ODU7iSj34#ER|AgODjUF2nAB06t%4mu~!OQKo}}sTM9L(Fg|py zwWz=hvI)277Mv6Di_1s1F|dG&6CJ2%RVV@q1esvnOm}g~68|{wo9CSTo;=Bub7WJj zfavVu3;-ZTMTU#<-Ho5uPPX{Gx9L|HUv_DsqEGp%C6L3Ryi7|a&r|NKLQZ$XNQHeCDPMIJIOVDZNrW!-_O07Cf04r7c zFo9Zw>Sc4F4#f=xY^&8OhKc2P@_7nztOSG%_ovQ@B%vTYs1KBd;KET6C5mu-VZVU5 zn3rex+5-Sv->C3VY0ks(ss~7A$byJ8es|pV!z=tc0s?Qh#%-Q4TMcvZ-K%f`-zd+`o^76_+$mywmCpzk+;rkF zRwFkjl9>B8%(WB3Xj%eIFrMWxEY)Ns&6{O zC&!HNoxD~!l;4IiIj*FPqlD5|c_!hW_S%VFyG&m1_46ABc-PuqX8buxZl2hN1sV%u zPHDW$BSgDv+yb9UEd8?{55>N(q_xKLKU^nqHhMM@K4c78oEPro3^5nCbRY12J%3V@ zxW%P~weZJ--<9xegr(Th3dm+{oWLwT797$XD+wPfVYvp3k@~4wQ$HP;{P}5s3q)(B zKbtt?d8bCRbZ9&BO8kZXlQ1H}x*{J$x~bv_vtz1~XUe#7u1pB=~}O9PT& ztmO}{0NbAyTzafj!QJJmw$y+sITAA5ly0SEdmq$%jcgy+Jt?xAbbeN(B? z%2BatE5}ege%Gbv+B1J*Uu1Aew`C2d@?i1IKwsz3@&|Sktt8T1mw2zNiwd7!`%f`> zO_pVeYjs}AJtO3?JRmlE{5gR)-7(cwv&W|0@8~2?uz* zmawv+tbmeb4iK@AJIhd*1Io6&pjg zvUIWp0Kke8MT&#{EqE_jn821-dc*~Gru)Ka;Q-K5wstAi490G0QE@Z?;Cljqpa=lo z!AF8A0N{WC@PYvV_zD1U%&vxZguxdNVzApgyW>Zf_w~7k zG|e$e@9tAGATmb+L!=?HEaqkV$GzPtraTtsQR=M0GPB=Na69k zC$lwsb`F8|MHhB=6-CpKUPgy3Stj$=_PePD#mY(*b_g*`40UOq<;i9ifOWXa``WY2 z{G)89(3W8F%4X(f?~M`a=libVl01umRc-eE8~kf%W<9ZqRxB=U7dOH8^L@^zx{rB-HVc)6!|?)#tgR zKTeCE>DzdCL*8)NZl@(__M6Pb=`ALw>DOQAtC4fNUwG%s2*QgS*(@nK0j{bL79T4IUe&hYu~3CjH5oP5thm{ zi21&r+XMUhQ`}}Z|5Ov5oHx8ERVFka-xU$#8tpXj_6}Ni@XbVDMW%e_(ZF?suHGkK zR$h*4+jzz__XKUfC+4}9d}-n$(yXibvO-eizawL6MXU~6DA$zf?4M-ier|0Q0&To%(#pcMw@0-J}Xx)u` zbdDV-vaGnSa>3UDpOa?oS2{hm$%L(PE$_q`Y@8-|Jd6mG2^I4)^6EqP*15mt+JOZNT3TIuu^FE=Dvh1IcHyl@=(?qP ze3kT}Lr>PFG=%Z7oh~%nmsKx#g@TcIvc2icdc3QtJZILtigkHfyb{hSQ21Er zB2W2P^sXAxvY)j`?fvh6CzRe9bClJTrY*LDzVJk&*%66sW-2=!pO%vjJ0JiI!1;ok ze8Hf2|3G{o4iAQSgCHIR(-YeJ|3_eDF%M+q|3~oO9Pf|A2L$4A;77s^P5*0{08k=g JNKFJr;Xh0+XN3R& diff --git a/img/003-walk-tree.png b/img/003-walk-tree.png deleted file mode 100644 index e5ddfb990a31152c26ee1757bb73083326754a92..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2001 zcmZWq2~g788vnbdmJ2Q|mSc-TQYMK~Lb+ifDr7FHDXzFlm7<@|o%nRCARzKvk7BLnxI>1zaj828}?H=mLpE z!iz$pB@!W>fJP9Q-yK{k0!igaBmx1C9zzm900s|_L`QLj5&;uIpwhWQ4ugb`VR9g} z0Me-(fiQ|IK@cD(Prx7{Vt5h(FN%Psf5-6XTqd0%6mXeQ5P-o$#4rT{D7Y|+A(U{L zoEQ>4hR0zr@dRk01yD3Dq(HYw=v6sa?!)4d~VhsTLIz%6@kP|&)McE0xaI;riss?>7$M5oYNhSv? zFRLq3i@@&r=Go=LxjJ^#7n>q#k}Zqt4zHt}v%O^!+0xw|VL4E$(8e9LQq7e=SH$Rn zOUSCJupEA!k!B$@cIda6CT?rn^4{VuAw>nlVxli0rWZa`sqL@69hh8eah&Og#(dp2 z#-i@xi$ z(RcQ>1+~dI(5$tQn{Dlc{+2RcT4;lHiOl1Nina}>*~rJo79CS2sd?Mp|oRo%rSrCV`(O*(;u*Ga7Dxa&z7*W4pFtwG-A zQ}(>am$k!)#fg5jD*tD{@{c6Ux&#m33uKpW!L3%Hrhegnayk_shnAXx&8vowG`VXU zxDT1CkY1C-*GbGbH={)hg;VaZXp@(HFP|P(41}F*=UlAx7MIKDE+wM%_rxXL$rtkP z!|re<2O3b}>vEh_yBT{@BdhR5&)fAKl0Fzp3x6+Wgg*+twfqO>wUHz2QAWPFe=iKZ zN^TH%#WqcILO0wP1GYW{K%!c_xOe<5?WM*1i`rsMYX$8Iv*AVVGEO<}{m zipS&AJ^Qm(b#@)9*xWr_p9X$W7LX=>OLq%CMJ2q?3!F~4-YcaS?^{xdtmLD%*-^cjqJ-3C`%H&N?w<`ZW_6ul zU}mT2%r)zXixgRo72VE@cnGhw9)GnX$UgAGU4=sfd4E7#du^^wq_C2*W-Qmn%fuOF zbd`S-=eBut?mut~J)_>nk(TP8WaNVh6D1x;29-0Kw;mp$j1E|jfyWlJlg}(NGW*wH zt#NoAj6;uYqhpNWBHgJ}(RsV6@S47+m39d@^^-E{(u~2k8nLK6jOTZ=KP{Ca+xlfr z@x1cEnmY>e=~J8TJ)w#GMvufN>ndfEO7*+8ME;!I_~&x3vZKi0Tz%ZByqAA^a^vZ7 zix!-W{3`!q9};Y+P*I7@yxyYjt|!S-ws^0pTnmjS7sN=T6IRJ zn*1+QO*9)@y%L-Ff2FI9JNu)mM+`Kq7XzL>e9Geq%Fw|L@b~ipW32cUbv~VS7BxI7 zBPyRA7F|HvRbPWGBpm}EHk(}5a7R%SP5#xUAW6)go5kIj`#Nq?H+NfOGKiXJ_P;Ah z8>5Da4gVm2R%NjoXB|E=XdHIQivFVH3Ge1jHgKKK1?Q?5zS5f{GjNLiIiH60`fAyz z3%K9$e(DQ)=F7~U*lnct(lJFUm6nj+ag3ExQ}DGU{Wj)&tx?w=HSOb@MQninU-mE# zZ&0bEu|&DUowqjLtnm365!zieHl&7afS)-@ylc=0^5t+}#p$zMr=`^gx61ouTPLk( z$15^p^Vy7O^LIP7Mq)AbX;y113i;d1BE(J7)?9U^iN*L6JA3-|cVlw6jcT~2K>LaA zVa0YksQ?>rdaA%BhFGhgmX4`cFy>ypNv|;v7pz1bwS1sF?QN<-t;@Ua(+4if;U_Ap z(++*@tubFZaM^uX{%Z5LxD9ap=K_}+%2}~t6FH=uncH*7Jo{tmv>q@&8PNAk$WqsD z`2IUCCEo+^|4j98({p0a)NQK5=?PvBpCppW_5OD$Yqh0eP|EdE|L(>ANa&9?tvnky zVYyk;aSwUtVC==W+Eg2XOuJA5#{Q*6CHxujYYX)T~XUmC@czfu*qrq nAB2pf)YPPtKM0tRooKAH3l{x9f~;ig!Sk`|51v0Wv diff --git a/img/004-string-tree.png b/img/004-string-tree.png deleted file mode 100644 index 1cbc2fce271be17eb023d86df649f5eb937d8662..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1132 zcmYk6e=yr;9LJwk9pkif{h_IeDHftgB$Y{vA%sSv^>eyNbb_|4R`navD04lIbxXw6 zYF&cfzTa`+|_MpXcuR z^aO|L;&jjn0N|1k&q&5}16w~j+F?7+{&PMiJM*L1Q2^Yjb$)f)9`o5WfpR zMdj=Gia!7lk^p#~4FLU10Ne@{=*eSPZ1ai4)L6g6R05GLgi)1Bg~H+(B89*d!ze0| z%1{&$GAS`41Vv?BqCkS8u!xOH1zagg;L9X@3Kt9JH3XnT{yYjS6?2&sA$G(R`1iK> zD<2Y-4Su$4Y@rk(5HSitVHpY|5|IFw3SzL#e6a*ZU|0r=1QMxO!e__uWiX6#F@(?N ziey%+HGKZub*$Alpkz)8czxHQ8;lNFU<+1asmyAQ#Bf){; z9eJI+{&Bo2UF^7d1b(TH2Pgwxyhj?RZOImv60xi zMBcePQ~$NetEH-gSGs1=_AD1#lx>|s_Z^xe)%VKPLwaG#u&aBN*#E=**Rn>6#y$AL zxn;`vkxAqR(nIFr&3#=-Gxh41&-RVCw+Gw5%81!6dQk(_zTIjEj{Ej0zbH)dX@tfT ztOo1h)ns09Zk2cb#sCMGo9G#Brg!F*UvA*h=Hpc9{%Q&9mVQcGeaVOh%&Q|x8;TCB zpLdFPJ5W56_QRFwf_~Fh>1@tMabxJ2@D`nVEQ7`p_gx+~>7z8ewC&GdZuYV)F{(`O zvdsAP8VG=qdGlf%ie1!)4njJ+xz-6hdTOI+|5tZgYWaAPdxxi8U31Af*hr`w(T;jv z6@M4jBQY`!5znBU{9{?S>)V5pXjWcB>+Z#iD+8vD3=>Ufh#bXP8QvV)Cl6e)Nv>5j zI@e;=Oqne|dn_!ULdFse-PLTmK1}OuNuRXn_GZST46i*+wgKdeU7Hu<9WacWy)@uG z9)76o=9W|S-`;Nj$HHiVbKl%=3Of0HCBZf~f(HhG^Zz-}pJKSsY#{&u zhQ2A*1!E8G2WjeLX#b_xDefW-yA0MxBDHM~m-;_1V;>#>78t=G2WpZJE=W z85o@1;*^coyYkvRXlZeon{h^R^I~00<+vFRqi=x$8*dKfMKQ77h@bgY12;FpouQVh zF&uNW&Gj>Z4N7_mIlGA;MzW<2c?!<=##2)rH#ShR;}uyg+Bn~`@9x{-kDu>Q=R(qZ zn|l25m)34iDcT!C+@Cr9)`Fbs)Bxg@$$cKi>l`14<1t&(#qpBsnjss*g;rk?E+~4Ju5pwH=d~M~oD22TQzc_~q8L$S!BYGY~Sb zAU+nKZcI7jgm({f_$-vhYxKDhh4!=fvwh2SLLpVs1F zeef2f}_WJYNNiOsAE%^mZ zzpnvq7oot6=>zM6@7*rV$Yx5@8misSuPN;9e6HWU|GIeb!DpGoYA2tx&V(=ic`RLQ zcj0@R6Q54Gsnf$cV3BIZ8^Gxrbnn+5luty`B3_ELxoVSK( zHCN1PH$2-plFH2=o6iJ5dR-wi^D?XcSn<+OH^?BU% zaLzP&RRIx8OP>tQ*$qhBnQvOG>MwqXo*muU^<SQf3m0!j6P{iO;mIbZOp-&C8$(MM%B0P^8^8_D-vT2?ta3C zt$=VCr~pa{=>o_o+!>>)!K2`u8$XVFftsVx0biYGGN8BBvbOBh+eO$&eQabE z^A8$R@a-8InpR+^J9v#YTZp~6n6H~Y4RWwXVE3`C$~{?Cxe)%>sZ0g^>!V24QRj&5 z7tBr7{mbnonRgod*t>8y`j<0aTbmEq z^9#N#D)6{DLw$I7->!Om%pX(f)84NK`+bZ@)-f(;Xu|$(gm3NeS4S{^+nZ#Gfl^A^ zSr4rF>NDXbIsiX8LJtu$jyRf=lN-wRJo08Ol!2}4*2i`+yTVI4@E8k~KwH_fZn%HB z5c?`VNS+l#zc^D6A7mOly?Es~Z1=E&r|zj)FG$LXb_qjgd1K#=Dnhxet9RrZ9~5`s}!#tDM(aG42h8(gE{~r zLa+nT#lZ;$XN7`V*$%+@$~j diff --git a/img/01-num-tree.png b/img/01-num-tree.png new file mode 100644 index 0000000000000000000000000000000000000000..b8e3ac4a80c2121d414beef8f103451e8403e1c0 GIT binary patch literal 4402 zcmbuDc|25mAIBM!r7*TjWI4Lps4Nwg?FbiTnJzt)P*I|$xotDn8K)72IL~#Zav4e` zL$=IRV`*dNhEy&x8e})(jd4WUiK>ZwI=Vmd6zN$7shYWU+TCpb_f%thJvC&Kv%(08m%;US>y?nlwi13b+(L< zhpI9`-$6r-)iSef-(y2MoqBIv-ooBTDYar z@8QfOl{`2-_MBLlTv$VgYRW;*}F4KYz9M(~(|J?$`k< z{0iGJ;>f|S)6Nu7@<=bE=Axi$jZA9RTR&Vx#su1=Q1j2ikau?t{Rj!;6UJ{@tXRR5 zE_(8hu-Q>}UaB&${#Ze>3o29sa!v((4_Y@=`NTL=Ka|AE7YJG`Zw+LExqW^t z0&!j99VNCZEj8rs31OR@;Ha@BN-SPeCPX}k{aCvMr} z+B7O100IdzpDS}gkuJQ1AE{`s={bv%k&gapQIxcPkpV{C`Q+A>m<9Wy%*2yoD50(=ET{Xm3^2(1h<|97WfTV?c&&V$#cT`&6t zn9rx{kqYW6m63Wm%m(`t00l#}P53@;wLlShNEm=?_DYy8ez6)t=Pr3dnk|V-APSYG z=m-Lv=e=57j!M6zr7re$u9|YR*^@mDHOJR0yX-*xl+V`r6M&l$f40D+ko{?_@bWf$ zv=Z{xU|{Obp7=wb>bvTTR?d1=y{QmAynWV$;fUbU`;nv@zk$AMU{HtsW~1#bx3QMU z7*EFXYKhLdUHSt+mpd(EZpTe9hCISfkk|p}&Xy>49elw(4|(UmYZY<6%Yc&k=DLKQOL>B;hF14Fqs+9(!QZUz_A2T;avZZ5}(o8sxxMy`CHy=kJ zG;-yR$YJDqqXuk|*h;;^mX^wNZ^|Jk$nEj=)?u%^Rg73Q0BGdWO`!59}0||C1<>+_0tzR(k=39A!o-=kB%-&I&GorN! z$@@5vTSoUs5@pqA}GsH8QRUh__Ha>O7aL*T6vpkWX+^2ukoESTF+VnE$n%!yh zC+$8xUNk0~$G<@rxf!d^mOipbr?-p`1fTn3s3h}B*1RwQsCTB}24IxXkJ zn8|#@_iF%Hc=*2m`lnvDUKA>9~t+o447OP z_n>mmJ{mD4Brz1(=oZU1S3r5xB6lR}POrNzd@;1e(lpkx#0gOL7rwa!u6`ycGKZWm zaQ%skC-p)R{HB){P4)kC?=xRyY+IdCGsAE@hl)hwz0_1yp(l5;KWPQ^yzqDdxKZHu zWO>;Bw{g)w6XXL31qAu*0qvwD>chUXn&n9O z4F6WMamOn2B_`(KoON`&mjt*^KA|Mbxqe!anzfWQhqK1Kf8L=r$S`wbzf5_vC(LMSST5H&zh#3UyL$ zhnBhIYlp%IyY9!^+nX|>gB>xqR;L`G&D!Yl;pEfkx?QO{~ER z?k8?I{aci{-k#`mq5!;RdVioR$@;9HOM7O}JXZ7-r0_WA@bsZ6uVh(rJ=(-4T>C5<2MHMwrL~gx+M%HTO-rRcYLne5w zu_`RzyJ8`CNJ+is4O{k*A6Va3WsO}=y5Tz7-`fse<5z`2-W8FWHI*6h6vIRn$CSaq zIy_0V^qn!W_*U;$NM)RK8C-6@6L4u93^c~EmSw*amRzCVSc3ZDe=y2?dtQad`8Xnj z)J7T;^IB0G$=5B623KGIibdK?R0b`Bp#3}^L5(6FGPOCJ^1y!CXHk1;R%whX zBW;B>2+joLpIU$)?s*+N3zM!W1xLqOUP9!!Q>E{7LnyCCwtpk<3y(Wr(8IZ-Pf+H% zkROLhwJ+{IWIoR8$m-B6j6~)EEVKovHheHQKOfVr;=cFGj7tNpD2uqGm3|CnRoxZ{ zdOl?KB_YhW6XBQ#PwVL5{%qUM;FpC_SfA5HVe8w9V~E}D>nUf!Lb@ZR2J{Vh$MTh9mz=O*g&YUrMks*u605;u2n zTj&aMV3?g@UnJ_AvkiK3Rr+V1M97!)i*3r-Bw5ihb3YKsJL5O=*D>Kx>>$$+vz#&# zZdO?~fGB$4D^HA@1Z6Gi<{RGku+h9f>E>-;@a)|P_Q|q;j zt*usaY~LXDDts)W#_WL?j}Icq!8^2^-T7W4pu(yy*t*gyN!zlUV>b&Qn`!Z5LUIiQ z6VQ50zL-~zpj)HFd;GXSzc~n3)XBp z59UT#8!)kWV)5jvDP;URW(@|)5fctCuMux*+Z|$pwCf&Wg4PmM^|C5g98f+JMIM1r)+|tdhEbF1CgeoCn0OliDBaQsnfN*{VNC zS>Q)3RC^zJqCHl_8}#Kv+NuRZvxqMjqFoYRhTsf7w40E+tptfxMZY%wM;N>*Uhj`^ ziL&GM=TW^yy}Q$;oGqzKAw7M$5J7prcG}a77CqS0L;bI}CE@))0R=guQ|p;50eU!Y zC$GLZyx$eTV~0e0k!QCZ2wBH+obS25H|=arifobH z0)aq8PFWtahd>1A;B#oRAlS3NXR;FlkzPG@?5Jb72ek8 zm((9ECVkj$U(~E{uenU@h)J9Bqvs zCjfc1Z2Ln9av`6vF@7UL7$QuOfJh{&LiTL7f>?^Wvk!w)R<*TC@}g>h@Ow2?2E9yBWIwW)2C{2?We zTRrXfTdifBQ8I;tJ1Wph%`)294uh|`k3AiipY|SVQgVHGKTQwe>UI%Mc0&6t1aN*$ z%iRsw9(=A)cC;EF%q;N32d>%l#_b4mvdkNK?Mu9dcEt$@ zZFGilh`Hgwc-B%ed7%xHQX`T)rJs<9B6XltGsS92-@6jM3k{U7oPmq>4mrHPoa}o? z5|=UD>(EA+>}{3eSBi34h2as>ao4lig?OO@=IkrRT|@Bw^qKGT<^5tg z4KaevYll&Mn`Dg^DTSSTq;Ih^k+m zM8%1!c%R25=m7fIJX@gOILlP7%!+h22hq!`iQ>^O%`kc|u;v~LQO6$pwd`+BlOZ2x zpn0KD38&jb59_mAd`MIJL-84sxUQS;hW9s;*G??WcStw zak*9XgueMT9Bj(*p&HDcU(n8YF!JVU#r&#wnL)u!tL$4wrs|9X+7if=kozG`Q|kjdH69p>H7hL$Wv zl@f#6j<|a2@AGvcQz4}lUDbj1DJd7?qTgxrzztFdsPfQ7J||-KjLzf9Eat>E8JzYaR!iy3+`GGlc2> z+#q^wCSo{B-dIuH7oOZtuC=ok_8fI#V^I;Gq&#Hz2^G%1oq9-}l_E96;aD0w%S*dB zP+pEj9Bs2>&L8b`#C(*Jd%}9!G=#h@i)-z5X%l^KkdyLgQFjpU8#oo+|32+7xzVBB z%0zKLoosez+7l0DzoP2C7onq-{5;Ietl?Lc92{=GoX<6{zHUGLgh-drXy|4(-Bv$1 z9h&J!nH70y;2e;aymapz5_KqSO7?XAc~nJA15A&02_fS_lEN*f(=vFX4GG=zCT+Q) zRe~P~ez}cG(HDxx8x1nbkUm?w?5`@=jEXi_GtK=jwOZ-8H))*AVeHh!mchszB24$t za8mj^dF`gc+dFU}Y}s^-;J5c=*vo?MZ|W~|vyX5%Ck#i3B6*P>lixCCj_rvyUf-jJ z0E=~{*_NsoqTqn^&FjF@XzIfB)9&@^0}U9c!Etz~!gEZ$VN(-S5!dAyQ|ZSro**05 z!YTqtTPse4>(;MH8)bz(D&m{}c$S1Ru&X;!KmOS{eGKW&4fMC+b=|Fb$*lM8b#m==WMWLQlztH0XJ37JIyYLU!NDLl!imvm6Q9Rcx@nLA)Dg+1EAAG6(98EgQuYYhA6da2-^rfx4&tfV( zrv{2JdfIevCc+{^xe(KGNwyq1{z;TLx?A@v)C0T3)1ozV=OWXH2K7=nWb>ED9jf|3 zI?+{HZk!jq&*Heu{$_#-P>>9xl&?O$#FgSZfIW6+u@)4G$jzD3$#B_Xp`=;8t3@ax z@i%k3n=$nkaC0n-B5~OEoE#1ksPUiaX`R35TkY4PS$FiEH|?^9#}-fLgiZx~Oyj$f zTXTq_F>0yRvn)cON!w~Af+|p?m=Waf9BETSDK8z}zs)X&q7~XXl`FvitWD1iJ*!gu}1Z&w2)r-uET9w8TJ?CbObuI62#F2Hn` z?b?WZr`G!;dJf-H+h9J|7sQ1A6Um6Q>H0JHnWbSXrH4@ht}%`x{J z24*~>SuwDWj|o+*1{HqBw0nw(4yzn`c{Pua_{F7N*9)Et|-+9VV&Cjoh4gJCkX?&`yP0AsAZk^ zU;1@gFFcabRawW0X?vrSQ4Y0jyyd6>cX&|XEcS`LY|1-Kra3NjsV`kLIbr?H!=1eF zq3?UjO8ISAQ2vI#XoQbBr$W7?N}mb+P85oZ(DF#KO>M)=LJU#yX(t+-3dpuqVB z4rVZGC?@z-MSF(Lm3!nkV;ZeWU6&elEA((Op-(a4;HZ11Dbla(EG0>~^}lqHj)d0NG@pMfI=S2g%_|QxI61qw^ICOBY)i#rl+|Nc4UCeLRIo- zyR2-8zw91wA@_>bo;SCW*)72Et0W)Q>Jo^on4Yhg9}Eaq<{PXofeBIC-x5@npe=)I z%=RV4VHRk2g*e1Eb-?y4j&XB3LrII-HY6Kj8UnX5DFNO!y(lvCb4u5@Weax>B-hW= zma;y>BW{1BlovZ5{>51SmGAHo`PH={T`gHt467hlG-r59RhMa-;;h#(pQF_AD<__WfkkMW_sm zi2Q8FTsrE|vuc_8fVL9=7BUfGJ#;VSyTwOrERu{$m+Vd$SBX)y%1Oyv=rfDNv^iwaT|^?vZ_~I`^MkZVrBruZ;9^C0sGn^C zXJecXy|$nIh>(iyZi#P&Ek;27o#R~g?pLCUm)!S;86C zLLG%rnm5NCs>NUiM_Vo@2j7Fzn|kLOg>r0kEJJu7)u%iScZMBl>5}%c;JB#z%GSzT zx6;poR}68v_NER4;+Js0O6xVECL5rZzmmx^l2z#=Gp{Xkz91l>BJs5XBQyLU^v;)D z@h@&MOavH4kZ$wJee=WJgPFs*PpRdv>m6cc$?BnfXP!melbs)RsOct5P3Awhuly*5 z>ChW!*$66eRobUg=d%2+ZiOtLJToVav5sakL=J*yS+Irj_i#StHM za_^PeW^sQO`C@HkiJ|#a{EIM`7u6)D=!<{Smn*a2v$Q4#^=0yv!DLXtfRW0cAa)|^ zoSCmL?e%OZRKA+Y4EdeEKErg5%hWInUZ#t56NcHcbx?O2 z`p&@uQzQc1+2vf7rkDeE`N!W1@&c2&eDOC+bF{6dX7b|xwTluz#%&lGyoKAZMAHLV zTu!F9Q)61~uLK||gh_TisRqrL#0|rLqcyTirA6u5SCi+a90e~s%c)Vgoo>GVF&Qt~ zx6i1}tb)n(ekDU+(|{XVZ(k{}tSvGT%aPf%*@0leebnly6b3O{_DS(LPi|{)v;i>e z#>TQ?p;q>zb+MwT7wc>lnyC6+^8~!Rr_R@%l=?e?1zN(*#fCqPh+A2(#BNlqe4UZX zDEJ$6JL<(-(`02pnYt4poT~`wj|^mrw8x#I#L~1 zxn{x;glK#WL_{pumv(bTc-+@;yxFbiMhM|I#!zV-eLQ_odC{Y9&{P`VU=hq);a-q~ zR2>6rq}Lm3W25@`EPDW=4Lbvm)oAP{eel6uR+o;C*trLw212Ql5RKkUsup=lc3BSM zR*X+Z(Sg}j3%n!ISXR_)_gaqFFWt?cz;T{g#r#QR=WhO2RML}(C~|B~6N3U-YKUHCXRzrO zL$?MVPedh?eQ}%zVm}~m_s>$auFfrZzH4od6J1r*?j~27#Yx3|&lM&op%k*{d3d2W zC|Mm~d~ZF}HTKQ(rRB**R%0+EOX=sV&)#v7-)cN^+&8!hBYMG--%bLj;DtCJ+dey> z1-xTAh8ApexJpx>!N>WSFLgoc0Gc)#}?400{W}Hn_Ng5EQ<13XXp0@b_#cf@@=2 zX1!sLF#XKj7P^mc=+D&7^i+x`f?XkStpDn2N!8+Fd*dLoi8((%o<5SUSfB<7EN#PO zw*UfVnS>S{JmG4q#A7i;_GKHy`I@-p73TZ7$^;sOp$2HT9t2?=VkzxmM7Ng{Nhx_(9+e+By@yAX8?7>lq4>DOcn=u3OYfN7>fM!<}bw> ztZSdokYJZ4@I5?&JzTh&sH{zfJ213ob96`;Epwn&F{?)X?e?8N_ zaG$_m_ONnX@y^r!ej?xZf=G1jP6wB=W*3oicM5ou&)@@X&&%HYSf5MqG{!%~)wpgN zeXl(|s3rl zecl57xiF6t#~dpog+uxCReaZQzWtpIF(7u()Xu%KqjfNDyS~|)!H=jGIBQ^a@3F0zoYaY+J~oybN_)S%UYYsmE=&T0YvN+~^B zK#$Tphndk|!1@A5XxRfCIvJB%4sDs`sDx;4u^NI?wC)q?WxV0y%H6+hR(Bi2L!3wqKD19A$gs`$=;(m+a=_l>f=R?Xj% zpBl8x=%?@1?BOho3`|K}uz;g$9uihesL?JD5R0Hf=N{`WfZYXXyIa9=Uk8hyF?y1z zG)UQ9LW^TEYGQ1<;Z{!mn*53hx)c)-x4LijMxsZKBU~fjEK&7H0-?^lh@eB-2GLkvH!-&1&h6uEHI2QqEG1H(FhWXS&t{KojiHGzA_H}$_cIc^II;*e9vZH|?hU%381ADl-w literal 0 HcmV?d00001 diff --git a/img/03-file-tree.png b/img/03-file-tree.png new file mode 100644 index 0000000000000000000000000000000000000000..f277a3888d967b6124c3544d00e5e943c1d3e97c GIT binary patch literal 12887 zcmcJ0c|4SF`}RmkLQ#aQS(0TeMUpjZL?LU8>_wI-#28f8DEpSJLfK1%F=mtyhD4Sy zNM>xq$TEf*%X^RN`+T40`8>bpec#Xf{^6dFai7z*@LKXPDf08Y7kZTBf+3f8kNt^R1tzOJD(ms&D!?oZ9xgaq!?(StyCIlW9E zkmIrz5d>oVzr65>lHZL6j^WFO#;nl6Xxvt$GIq2MJ#dQUbrfllp1iT_tUNq=D~CQD z|GW%@uY-i^qJJj+MyX|0QpRwzn{j8S<$48;a z=;*9s`e^=U2iVd{vTt(O^iSW3G1!uK!6A?|6AB-S@4gl|-Nh3~qG~_|ceZ-OCPFt( zsg7r)-I>8g4uRdTH-uF9@wfAw3^bj{LV}fVfIxB>Ap`{B+qR9*c#UY1-=E7np3DW8QAY9O$`RGI2#6Ht#|fit6_E7>z0PeGVpG^wjqoCR z>n>qidcE@Xk)PFeQhcaS9UU2?MJ$Oe%o z!s1V%1Sn^dT4trlR|50bqt5&DHJdX4^Gsod()Bs(k^Dhe9raOH z3J1Zk_Z6x{NhlC>?j|D!p1!<(v}mjUg)=0{)io{)<~0rPD;&vAh3U6@T+x7~cjNOM zS{TAx-QHj!Cqlm*4uCZLSQG#^jCt|huy2-^Uq6;5oz1edpWA||rtZ9DS~pi%+%P&l z)W%Im1KDZ0ygTmz3g>6UY~$Spl?%r*9G2Hx0(2ADPOcrZu~Dx&_Vb+LH{r$0t;^MK z&*M@(JT=wtACep;Wm($*`^VU^O(D3Ch3&{u?@=2d&yH3RynHqs?nJ3r5QE0lWkcU; zIL(iaXJXkUb|~F%B{vzLNRh3Pqn-QSJINamDPoS!$9a9~bfhilL2@j?n6aknZOXjz zlkU;FanF8~G;I-Nf-(G0*nwsHx(|^r(#{VuVZpJ191s7Gm&6ZH2sK}Zytzx&Anxw4 z!`{(>rjPy2#NkZvlFji8+r)bkUpJj!+6nL- z*q-V|5|^3~c=cVrmmXm0(&=%buR7VOJ%*p-J_#zB?O!i4 z<@jmE{CmWgf8w?;eLptttZCbJ60!~j5g$~~Ss3ED8(laWosz5PeXR$D`lx5N^zN|? z*>~w#dO1v?f}D40%l_RYajj=g3H09SA$G|F5%yu5oRF^sctfq|_Zx%dDQ50awVX%w zhc`!Hf{5spm+x2abQgYq-dJfq#5a;C_LIx7x$JE>f$qK21ME^ie&@A5#Pa~`z*3m| zSsovDXwQC)wCemcm^?MBUPJt%m}fRM2(g%O%Rgf3-CGAD>}wX;?V8dxpSP?xzF!@p z4{vp;!Jh5O8xJ&n62SY(xvO+xwLpd}#L+gZ-MQU5#m?JIG_q<`i@El>K}|j>L-Fph zrybe~vA&PRl@6zxvIl=LxXupZO8Ee-i%F$oCc4GPiH0(6Z8(8W%oW3!RswVrQId1= zITsw|!l!-e0D?Xf*uW$xd3oKGw~uIK*Ep7P)Ki;iJB?T%$ltXwG2%ziOM~0DO~lAH zZKG<2RWET4oZids$NH8dzENCM6P^=-VI67;L(rH z3I_&x2aaNt(b+||=PJ~j(1@vkIQ}z!h`0^(gdUG13n-3d&+2y&R^CIpr()wGO~TZV zDI}>nIg9@?me^Y3}j5JZEpvl>0zI;!T3BbGGFF0TfS{a`W-6+})<*JnlB;z*r> zs+ktDsh|9fy{)+k~_JJLsm_GUgKzzLjiFr zardw!8q5!R#)?yqj*z>2Oeyx$$ljeQqV1^o+>-&I;|HKjAi4i`;kGswJ^;cnL%D$% zezWhd59>7Q$Rd)sGC&|oLDV47oo2pamalhhKyT=v+}5eoZlCc0ZdnJYdk?(Vok;Jnnw^yVPV7SZMw(MGq{ngNvemAVbk>Bb{Bz$vH<|o&56eSmGWrSc@kj-@0T7BP9lMGxM(1So@>aPp#-g42 z)HVC*0ushYf-QZN8a@=_Z0j%`o0|?V?zHqj83+O<2PT8-cXyV*(vFC<{UNtcnzmO= zVG%iHFy3bIhU?{CF}Z}u-bSx9D<%I$+aLwo4;=Tg41@m?c^S>=!v$}7C;{+v{)k0a zKDT)VNO_JQCbIX6kAqT^rL~YQ5#*nU6l%9$U6_NDaUQSyF0_?*s%wlu+4W)!{~m1Z z@1%~J$plzd6Kn6_HJ{D1mK<=7{m6^~36XgR-HG5ZW#m0r;_V^JkFv`Y9>k&U{Rl#E zlB%X^yS<|wQGI;J@Zt!3?or(<(egPCFqG*W53q)BvF;gP72=7v<+4apeJ{6X3Q!flUt=;o@I4z0D>!lBOz3VyPVdRU za6h5I`_~YVu9v3|@jK~P>dbV0Q4N;*k6F#PJ?O@xf_$IoTP*+8pI zG$%raxl>64J}0v4d{9Hhe4uG=U^`9)f~-vvkst(p__049s-SQ!fHeJw3-bMnr2z&` zA1)5OzfE{Ll@WBAHfxX!nHBUDc(5y-Es?K_eeziM4yl`RB1iVmeXCjqDVa_AO<8(= z4%VaJ{8B!C^pFJ^{W4jwGnkxdDi)sm)Zz{;b%mEkq+HsNx74}KQ{*&cr?X`oqVRo3 zy15G;kBuIW4gvv-c~H)=!pCfcH*3)JptZZ(={txgTYa(*vD<3Au(0Vgc_^fX8V>l* z{!>+hb#fQGpq1$&WW!pP8>RtoQ{h_gkud5zuzTp1WAK*aT1Eg*-=@rq{sv8=QOsGo zOVXr@)Y40hx%n9PwaM#}4D4aDef0na?@q%Gu%4WzWPxS}i+Rk-t)!#;n8b!5L6iF z6?%5XwQtg@T}l{eYdmC-zfywGO(GfW^5A$sre5+y~={IY2I;IAS%|bKv>Aha znA2abOof&?U&IT{ceK>xhEisO6?#dnmB&)N=FvqItYz4vZ~kR>CJl>hAPd*MlycK9 zA9@c@f-ap5=mFM{T`2H_Li?EZL<1TtiJ;!ms+_E@;z7h;c6Sv?SRP*HN-9dMUP+a9 zy8Wn^>&F3u8-Z$)T@J*#I|8VeNnSpmn!>p8O*5kE_gaqsHTlOy=((R!dY7KdD<*8& zv*=(hWWZPB#>C2wLu&=gzNREUWkd*?6G!dvPovRMZnN-ACLk1&L1)t`mQgYykXkdL z*vtm;)8wZMk2Lfn`T@hD_eyca>C5jim6;MAwUBD)8#&X@xgz9N6;B9;y%p2 z8muzN;{lc-oxua)^Ch7l*7e~Rs&Y}e`aXAv9^=gS5KbyFXp$=nzWQw=uom2>I`OG} ztjWvkt0cjs&1YXWCoYx4>vSP@rmzM!$uO^X1L{pgU+wH@YEMGaKE=rM4$JZ1z8{9;6 zO2oW-{IjMHUUAfxh!@H{E~*BnGVPsv9M8npF8@0TU~Iqmxr>A-e=Uh%D)C|J(8me5 z&7MA!VkpZ|Id`&YKK7Z7Y=CSUTaTciswde1K|X?fWxDIAzDIzNk?10~p(+4Dcdo~P zqkG!iaJDak+oS+P3xih<`m1x3S8(^$db6m7n>C3qe%b9a+ShMAZztANpM&eF+d~wL zJq=N=`@(U`)s+`eV?qhd~)vRzDkXbFJFk18GZ3vbT-I$Fv}G7(m{ zSW@{m<1Ie>eriVrgp9JtZ*QtY+40)Q&MQVvTJOs5Or5ODtFIL26MfWR=682n=LM6t z{kVCBkHunCD{$hLGhcD4@X@k3@0HX8CB&uNUg>L=O29yB^|;LFwMOJ`sXFSwpDsjO zzt|D#Ki&af{t;Tpm~9Oi&3o{6wN>aPu?}w{?yca6_Ee z(qN$#70`g(-27Th&s)-aVWtO$qU!>j%b8iQpbO`&+)k~yk$+Ny!C}Syb@l!^0=#HqzC?n6gMLH%f&Ocz_QoXo1Uv&Na`gpX$dQMDaKG$T& z^CL5P#_p@xG5i!Da`wU)^kqMS9(4SFxUfk3aQ{=}(@a>TS-wCgK+k}@!kX(D9!;nD z=fQSvW=kF#vel*BCbY$q){KK=AY8Q&Onaf?v5q?F`M_sZ;DdZSpVw^$R8wsX?-`@i zUPR{E)9n8ueUBhHisM=R(x!;hOUl^J;Ny9r?7 zQ;-;N#H_@-l}rLaVTI>%k{NFm5N$-xaJpLk=tvMWPN1F%`55^RQ!q3i{L2tH?_8yB zxrvtc_2XwQG5bXAa&e4fdl*5xY#Ty_3I*mOhWfIvCrRnIrJ%*Nkx4GQjn=N-{pF3p zrtnM6cp>E#)Eb;Hz-;0)d;a@fVA{W8MRHPy7bRELgR@R0t#splV~6YYgGhC`{z@Lk z)E}!C=eso~xb(~(Y9>-GaKdZmQeX;yitnaHO1%br)()5=Vh{lSQ~=12KoPuZ*!NJTa_4Tzs(GJUH*?J|)Bc3yrC7G`QV5C#&TV!C3 zL)LBmaoCw(^9MK$!*Ywxi@-jQxmz_6tLGm@4oJ6{ZP~;Ic%TNl&}f)$2IjSf9x>GY zahO6er4qw-!x)9Yj$+==(R>_$qrp0;QQky=b(HCf&C8qt_B7wAjoOUstE(3Y62b7a4WV(di*UpDl_HqCq!Y`Es zU%E(O{bA&12F>{7WU92%h_&iDK;JAgmbYL@7jxmDKtAeLE8EDIp##_4`5k;kqCuP z9xeeV-2R?GWrb`5G$OGx-h^3lW~H<;i^FpO-7p*S*(x7db2dKJKtZNt#Qbwyq&3jw9OrbR-)^E>Y1z2C2O@*s%}JBAb`zW6}@1~PcDvo+oKC3eLqrQx;M^mOg(IM>73cU$5}zRCEF)7 zAuzk|QtVm1Vsj%n5wFf)+?7N8#O3ZtL*(84XCF>(1gV(5tv ztfN&UpTjf$)_wB@^~m+i;D{vHfSAO00K zAhqJ_s8=n#C%N)7TILTt7;LY7Ir8Onpx=^{sm9y*t&ma9l*X6hgN&JKzy@6o=ZJ&H z$y}k38)o@s0Ew|T?)B4DYxDk4m%FnQTGeUY6yk%IWQuQm z$PvCq-aokHrf;B<*>uM}6cUybyt}0UL@Gd9s(dyv&87Q~4=?mdBpr@bDa=`;j+b#q zvSwJ?i5IU_B+D3THyn7)@4YS~3)Vp9#n0*sa^09#*CSRpx&z|>-on^U6xN(ID}8r2 z=#q)6z~B+cPn%BrTAP$xgtro0K-rH#KJ*7uZYX6H!K8GF?#N%s$W;@Kk<0GvgFJ?4#0{TmD^N-jNFy>|Sjeq@r!zLiC(z~U42V~YVDFiOPnTLgA= zPj-+Xyj~)V<53ve(~$*^A=+gM#~sdUl$ccScvVnIAZuYzJtDsOu-f)tv8X+9=HIFh zj_f)kTPE?~rGeSZ3)TA}jcW2`iziD@=L|>>t#6{CLo?3w zuBXbD%#V%SbZBBXBf?vVHwo1YG=Ia&97)leZ%jpMSjk#)?Ti7oe^pX&%Z=82c@Ll#T8>V-s)nnPu$WyS@x{L^xM5@yjW|19+ z^tU&=x=w}-IrS;@xK7C4w^qX=*i-^K)DoWxTlwFusVd-?Y*1G=*h{6h;l(@MwVnQ) zV*;0dEdU)9a;TGGpq;z=pjwOb{L{=-plHGsCAotY&a+m#2A|8id0LwDARKe<(SFRcm{ymtU{RD|~= zd1U!E`0?5dAO0kioVqwx#-;DfQi{l2uWtQJ5g@zS7`|gmatK*WzWb=MhcyYNVwbn> zj+)9#C&k>(E;-i_I@0&BQFdwW&YpK@65}pzC`1qE>wJFTzjeK!=!yUsmpH(kCF$9K zlO=q0(P%jxnJ;U#F4LFc3%{%;+9x}wPHLU!7a?C!((~#GvrO2iGf|st+2J3}`{_bG zL)negW!PKLB$<}jPt=9DlF)cXOQHa3V?-|lTdgn*HYQ9S*p{-eF=2CvPI=+=LNJeX zlW)yoH7EsnqVcYsn*5Q3ECfNRoz9}q|IZ{11*@KXpgb78X>JF(^3X!|=k>P|+e`K3 zLV>`V8{bNph&(f>9EkOHN*{`hkF?8b?WTv`7;Y-n%)`{e+-CYrZR8H&WP!IeI`F(- zU>VlZDR%y-{MzallToF1(8IY702$liejQ=GHmxQ83n+Hi5Tzq5(Nmmxk9hrvPSJ_7 z>{EcC0#rdQHUCQs#lBkYegBZU{|Mhe&11-W!aw7+Lm*^xelvNMd)(J&f?`=94f;lt znmf0rm3@#b++alY40=`;9{AB7LH!sHhQK~ml$X~J@GaF3ybfF)?0%;=7H2%qkE2aw zUmUb)Wx7=L&U8GIvMq>U58IhZ_R$DQdBJL2I2^osA_UOU-&*jSsc{$&a14*jZ zOaQ`lZg)m162VO&-P?;pj&fu1iFQ zKKR?fwYR9-WDzWCxPm)fTjk3Kdrez3-p3~z*p3~&RLwR0S ze#_P>hO%VJi()-U9V?D)kS6{?!~8b1E`EdGjH`pSb;7Nriz{iB94C1T7G+gPyEXfP zcL9xc_yA1gSSU*=#kOG)6h|utrUTVCb#DVC`1W!@&lLnF_q2SCuPZ;V%%p{i8bP1v zNE7`|lL@c${dYG%di_|;dk!V{hn~Zcv#E_jm(JESD<$@4rv#E zTLo@&ypb>bu?UjO2VO!KK@F^hK(^bef~bSA#|?Cjp}@rBfQAJ;a1H|%B5S%oAOBVG zi2OegJYd&m$=~R^IDymGCY+{(&UCnprgWf@5(=`L3hbP7RBfjxl`W%^ZS7+c%vte` z0`Ct4yYd1=KS&WTsz{O~xi}1bL{-@G3uh2+cB+}KsS$%g7lDBE+?NW7AqFXdr`+a; zjnxmp-lmAPvq2}uMqeAArIC+NIosNH{%P954CtmnrhJ1?IJAif(G&cf2Aw#xD}zHL z@>xOTT2lui9yGPuOraA`sigO>$I}Ip>jxTzLnD!QQkFc*Ql7O(NPQ^K(S;SL$WXMMp$t(A) zIe#|gJw6Z$4-S3dko)ZS4ghlaSGZAxB`6)(Lpd2h#7}vi=oE#f^(AmBdWX9L%Wll_ z#dqSujr-R)LW>JA`=sgj94(zX-7&F9oJe!nGB9i%r%PuAoPbsZpjA5gLGOkB^TpmV z2>DNv-G3>LuAL<91iksC^tGb#V3yI>t}ahE_Vb9y>!;r>Fo=IXL3R)yIBb)mU3y_V zs-yAx`MFOba(YDd;SSNHYX_(KfT^8&AN~$)c+;~mqNx0$!+>U1^f81)2WRj}vhHt| zT;U_!dpEta^5~}iyO!adv?i@VBuxEkZTiNCwR+Q!uMz~6827OVk@0}P{9@Hb;U^X6 zi?V z_-Doz9S)z^O8PyS_gAKVlfzlplFgZ;D zs9R-^EBtbYngLwZU}p_qnSa2^6`5z;CW0T=Ul72d>-S*XPDH$=KS+|6d8dAKzc{SG zr7`u!IR9(rg8^aOa~ zFV=Mhs0#M=s@|;WI$NDcML9(q3EudG6HpD{Xn$ioXj)Zf@H?(nY5gVSR;|6DqElYIT7=H=+z8qC&ZqqOK@)jocy+QAe;j|0xbUSi?;m59ye4hkMw&5Ky?Qg z9WzTg$9BQVa96+u0pTclNpyKhfL&u$f8h<5Mjn|!QvXANZLji1XD3Ye{vhpHfB$g2 zM)a&(YQR{%M!pUqg>-DP_|(_=z{{=%>edHw;B-_5a0%*i7{U* z;*Q)DW@y|`N=nL`)TZi9B8)Zq->JAtzL|`A-5BB%yoH*o!tuZ-Fl>%Ad^kmx@~Lc4 zbpKpmHnE#T{W%jRySe^Re|Q;Po})VRkM^AS4?Qgs%vV3nK1BdM90vi*|C1)2N2+1V zkK6p)5+xu+Fj@Feck%wcr=KP(gY*1$b8wCKww~V!qYR(g*`}Ie5oy)Lk$Jnvgm^jx zeHR-}7HB_d+FJO;dXtQ=YuY%+(u)lt2TYxZ--&q1A!~GtIY&RrHc?fY*3beWLVS0( zr(V(SePy@gUKI#u1zHp{X*z!cc9%5k$$Eo*a(k&Nz^**frK9E2D7Qk0z?dysga2E+fp5U z{W^5&TO*u+(i;QGHT^f={pZp#S?q(;K`oF0P=Vf$V|#O5h%5$dpfqZYUv(4K}?#-t;p~mZDC>@i*-+hn{p*|8eJEArg z2x@>Sqo{oJCLIFIJcuK1` zD_#Aog;?FEO@?{Jsu~XXz+7Wpv}_B|`JW5DS5;v zMs=JwJ@D|%WSDS%sv~X_nm%FvC<{w|Sv}WX>diw;x^Yb9aJ!9vroSg5!|9MB&H|-N z{b<~9>*KPv>YpNUgew;}Fvxy{XPz2rDeuJMnJ1qzuMN-W+Yvv2f`0X=kd8x5kIa`F z)=x2Ob7Tu+f?XkI+A`F>sbKj+EH!2<=h^OqfWNKqAzHSyiueK`IF#UqPmKVP^nj z)FK)^kVHiL8t9y_$~_}onfr9ksPruBoZ2`++3=71^zVCU-sc21ObYSLmJTZ3rdKj0g35bh<=8_pO^u?k_SL { override fun hasChildNodesToFill(): Boolean { return value.isDirectory() } - override fun fillChildNodes(): List = Files.walk(value, 1).filter { - it != value - }.map { - QFileNode(it) - }.toList() + override fun fillChildNodes(): List { + return Files.walk(value, 1).asSequence().filter { + it != value + }.sortedBy { + it.name + }.sortedBy { + !it.isDirectory() + }.map { + QFileNode(it) + }.toList() + } override fun toTreeNodeString(): String { - return value.name + return if (value.isDirectory()) "📁" + value.name else value.name } } - val rootDir = Paths.get("rsc-test/root-dir").toAbsolutePath() + val rootDir = Paths.get("src-split").toAbsolutePath() - val fileTree = QFileNode(rootDir).fillTree(maxDepth = 2).tree() + val fileTree = QFileNode(rootDir).fillTree(maxDepth = 3).tree() println(fileTree) -} +} \ No newline at end of file diff --git a/src-single/QTreeNode.kt b/src-single/QTreeNode.kt index fa2073a..4b8a94b 100644 --- a/src-single/QTreeNode.kt +++ b/src-single/QTreeNode.kt @@ -264,7 +264,7 @@ enum class QTreeStyle(val plus: String, val vert: String, val end: String, val h */ fun > N.tree( style: QTreeStyle = QTreeStyle.UNICODE, - color: QShColor? = QShColor.LIGHT_YELLOW, + color: QShColor? = QShColor.LightYellow, visitChecker: HashSet = HashSet(), ): String { val hyphen = style.hyphen.repeat(3) @@ -273,6 +273,7 @@ fun > N.tree( this.mark(visitChecker) + // print root node sb += this.toTreeNodeString() + "\n" for (node in depthFirst().drop(1)) { @@ -525,9 +526,9 @@ private enum class QMyException { // CallChain[size=10] = QMyException.Unreachable <-[Call]- qUnreachable() <-[Call]- QFetchRule.SINGL ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] Unreachable, - // CallChain[size=11] = QMyException.ShouldNotBeNull <-[Call]- T?.qaNotNull() <-[Call]- qSrcFileAtFr ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=11] = QMyException.ShouldNotBeNull <-[Call]- T.qaNotNull() <-[Call]- qSrcFileAtFra ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] ShouldNotBeNull, - // CallChain[size=6] = QMyException.ShouldNotBeZero <-[Call]- Int?.qaNotZero() <-[Call]- CharSequence.qMask() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=6] = QMyException.ShouldNotBeZero <-[Call]- Int.qaNotZero() <-[Call]- CharSequence.qMask() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] ShouldNotBeZero, // CallChain[size=9] = QMyException.ShouldBeEvenNumber <-[Call]- qBrackets() <-[Call]- qMySrcLinesAt ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] ShouldBeEvenNumber, @@ -540,25 +541,7 @@ private enum class QMyException { // CallChain[size=2] = QMyException.CycleDetected <-[Call]- N.depthFirst()[Root] CycleDetected; - companion object { - // Required to implement extended functions. - - // CallChain[size=4] = QMyException.STACK_FRAME_FILTER <-[Call]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] - val STACK_FRAME_FILTER: (StackWalker.StackFrame) -> Boolean = { - !it.className.startsWith("org.gradle") && - !it.className.startsWith("org.testng") && - !it.className.startsWith("worker.org.gradle") && - !it.methodName.endsWith("\$default") && it.fileName != null && -// && !it.className.startsWith(QException::class.qualifiedName!!) -// && it.methodName != "invokeSuspend" - it.declaringClass != null -// && it.declaringClass.canonicalName != null -// && !it.declaringClass.canonicalName.startsWith("kotlin.coroutines.jvm.internal.") -// && !it.declaringClass.canonicalName.startsWith("kotlinx.coroutines") - } - - - } + } // CallChain[size=8] = QMyLog <-[Ref]- QLogStyle <-[Ref]- QLogStyle.SRC_AND_STACK <-[Call]- QExcepti ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] @@ -569,14 +552,15 @@ private object QMyLog { */ val out: QOut = QOut.CONSOLE - // CallChain[size=4] = QMyLog.no_format <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=4] = QMyLog.no_format <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] var no_format: Boolean = false } // CallChain[size=4] = QMyMark <-[Ref]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +@Suppress("MayBeConstant") private object QMyMark { - // CallChain[size=4] = QMyMark.WARN <-[Call]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] - val WARN = "⚠".yellow + // CallChain[size=4] = QMyMark.warn <-[Call]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + val warn = "⚠".yellow } @@ -626,7 +610,7 @@ private object QMyPath { // -- files } -// CallChain[size=6] = QMyToString <-[Call]- qToStringRegistry <-[Call]- Any?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=6] = QMyToString <-[Call]- qToStringRegistry <-[Call]- Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private object QMyToString { } @@ -634,6 +618,20 @@ private object QMyToString { // CallChain[size=2] = QE <-[Ref]- N.depthFirst()[Root] private typealias QE = QMyException +// CallChain[size=4] = qSTACK_FRAME_FILTER <-[Call]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +private val qSTACK_FRAME_FILTER: (StackWalker.StackFrame) -> Boolean = { + !it.className.startsWith("org.gradle") && + !it.className.startsWith("org.testng") && + !it.className.startsWith("worker.org.gradle") && + !it.methodName.endsWith("\$default") && it.fileName != null && +// && !it.className.startsWith(QException::class.qualifiedName!!) +// && it.methodName != "invokeSuspend" + it.declaringClass != null +// && it.declaringClass.canonicalName != null +// && !it.declaringClass.canonicalName.startsWith("kotlin.coroutines.jvm.internal.") +// && !it.declaringClass.canonicalName.startsWith("kotlinx.coroutines") +} + // CallChain[size=12] = String.qMatches() <-[Call]- Path.qFind() <-[Call]- Collection.qFind() ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private fun String.qMatches(matcher: QM): Boolean = matcher.matches(this) @@ -711,10 +709,10 @@ private class QStartsWithMatch(val textStartsWith: String, val ignoreCase: Boole } } -// CallChain[size=7] = qAnd() <-[Call]- QMFunc.and() <-[Call]- qToStringRegistry <-[Call]- Any?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=7] = qAnd() <-[Call]- QMFunc.and() <-[Call]- qToStringRegistry <-[Call]- Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private fun qAnd(vararg matches: QMFunc): QMFunc = QMatchFuncAnd(*matches) -// CallChain[size=6] = QMFunc.and() <-[Call]- qToStringRegistry <-[Call]- Any?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=6] = QMFunc.and() <-[Call]- qToStringRegistry <-[Call]- Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private infix fun QMFunc.and(match: QMFunc): QMFunc { return if (this is QMatchFuncAnd) { QMatchFuncAnd(*matchList, match) @@ -723,91 +721,91 @@ private infix fun QMFunc.and(match: QMFunc): QMFunc { } } -// CallChain[size=8] = QMatchFuncAny <-[Call]- QMFunc.isAny() <-[Propag]- QMFunc.IncludeExtensionsIn ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=8] = QMatchFuncAny <-[Call]- QMFunc.isAny() <-[Propag]- QMFunc.IncludeExtensionsIn ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private object QMatchFuncAny : QMFuncA() { - // CallChain[size=9] = QMatchFuncAny.matches() <-[Propag]- QMatchFuncAny <-[Call]- QMFunc.isAny() <- ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=9] = QMatchFuncAny.matches() <-[Propag]- QMatchFuncAny <-[Call]- QMFunc.isAny() <- ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] override fun matches(value: KFunction<*>): Boolean { return true } } -// CallChain[size=8] = QMatchFuncNone <-[Call]- QMFunc.isNone() <-[Propag]- QMFunc.IncludeExtensions ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=8] = QMatchFuncNone <-[Call]- QMFunc.isNone() <-[Propag]- QMFunc.IncludeExtensions ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private object QMatchFuncNone : QMFuncA() { - // CallChain[size=9] = QMatchFuncNone.matches() <-[Propag]- QMatchFuncNone <-[Call]- QMFunc.isNone() ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=9] = QMatchFuncNone.matches() <-[Propag]- QMatchFuncNone <-[Call]- QMFunc.isNone() ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] override fun matches(value: KFunction<*>): Boolean { return false } } -// CallChain[size=7] = QMatchFuncDeclaredOnly <-[Call]- QMFunc.DeclaredOnly <-[Call]- qToStringRegis ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=7] = QMatchFuncDeclaredOnly <-[Call]- QMFunc.DeclaredOnly <-[Call]- qToStringRegis ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private object QMatchFuncDeclaredOnly : QMFuncA() { - // CallChain[size=8] = QMatchFuncDeclaredOnly.declaredOnly <-[Propag]- QMatchFuncDeclaredOnly <-[Cal ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=8] = QMatchFuncDeclaredOnly.declaredOnly <-[Propag]- QMatchFuncDeclaredOnly <-[Cal ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] override val declaredOnly = true - // CallChain[size=8] = QMatchFuncDeclaredOnly.matches() <-[Propag]- QMatchFuncDeclaredOnly <-[Call]- ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=8] = QMatchFuncDeclaredOnly.matches() <-[Propag]- QMatchFuncDeclaredOnly <-[Call]- ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] override fun matches(value: KFunction<*>): Boolean { return true } } -// CallChain[size=7] = QMatchFuncIncludeExtensionsInClass <-[Call]- QMFunc.IncludeExtensionsInClass ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=7] = QMatchFuncIncludeExtensionsInClass <-[Call]- QMFunc.IncludeExtensionsInClass ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private object QMatchFuncIncludeExtensionsInClass : QMFuncA() { - // CallChain[size=8] = QMatchFuncIncludeExtensionsInClass.includeExtensionsInClass <-[Propag]- QMatc ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=8] = QMatchFuncIncludeExtensionsInClass.includeExtensionsInClass <-[Propag]- QMatc ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] override val includeExtensionsInClass = true - // CallChain[size=8] = QMatchFuncIncludeExtensionsInClass.matches() <-[Propag]- QMatchFuncIncludeExt ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=8] = QMatchFuncIncludeExtensionsInClass.matches() <-[Propag]- QMatchFuncIncludeExt ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] override fun matches(value: KFunction<*>): Boolean { return true } } -// CallChain[size=7] = QMatchFuncAnd <-[Ref]- QMFunc.and() <-[Call]- qToStringRegistry <-[Call]- Any?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=7] = QMatchFuncAnd <-[Ref]- QMFunc.and() <-[Call]- qToStringRegistry <-[Call]- Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private class QMatchFuncAnd(vararg match: QMFunc) : QMFuncA() { - // CallChain[size=7] = QMatchFuncAnd.matchList <-[Call]- QMFunc.and() <-[Call]- qToStringRegistry <- ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=7] = QMatchFuncAnd.matchList <-[Call]- QMFunc.and() <-[Call]- qToStringRegistry <- ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] val matchList = match - // CallChain[size=8] = QMatchFuncAnd.declaredOnly <-[Propag]- QMatchFuncAnd.matchList <-[Call]- QMFu ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=8] = QMatchFuncAnd.declaredOnly <-[Propag]- QMatchFuncAnd.matchList <-[Call]- QMFu ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] override val declaredOnly = matchList.any { it.declaredOnly } - // CallChain[size=8] = QMatchFuncAnd.includeExtensionsInClass <-[Propag]- QMatchFuncAnd.matchList <- ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=8] = QMatchFuncAnd.includeExtensionsInClass <-[Propag]- QMatchFuncAnd.matchList <- ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] override val includeExtensionsInClass: Boolean = matchList.any { it.includeExtensionsInClass } - // CallChain[size=8] = QMatchFuncAnd.matches() <-[Propag]- QMatchFuncAnd.matchList <-[Call]- QMFunc. ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=8] = QMatchFuncAnd.matches() <-[Propag]- QMatchFuncAnd.matchList <-[Call]- QMFunc. ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] override fun matches(value: KFunction<*>): Boolean { return matchList.all { it.matches(value) } } } -// CallChain[size=9] = QMFuncA <-[Call]- QMatchFuncNone <-[Call]- QMFunc.isNone() <-[Propag]- QMFunc ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=9] = QMFuncA <-[Call]- QMatchFuncNone <-[Call]- QMFunc.isNone() <-[Propag]- QMFunc ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private abstract class QMFuncA : QMFunc { - // CallChain[size=10] = QMFuncA.declaredOnly <-[Propag]- QMFuncA <-[Call]- QMatchFuncNone <-[Call]- ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=10] = QMFuncA.declaredOnly <-[Propag]- QMFuncA <-[Call]- QMatchFuncNone <-[Call]- ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] override val declaredOnly: Boolean = false - // CallChain[size=10] = QMFuncA.includeExtensionsInClass <-[Propag]- QMFuncA <-[Call]- QMatchFuncNon ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=10] = QMFuncA.includeExtensionsInClass <-[Propag]- QMFuncA <-[Call]- QMatchFuncNon ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] override val includeExtensionsInClass: Boolean = false } -// CallChain[size=7] = QMFunc <-[Ref]- QMFunc.IncludeExtensionsInClass <-[Call]- qToStringRegistry < ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=7] = QMFunc <-[Ref]- QMFunc.IncludeExtensionsInClass <-[Call]- qToStringRegistry < ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private interface QMFunc { - // CallChain[size=7] = QMFunc.declaredOnly <-[Propag]- QMFunc.IncludeExtensionsInClass <-[Call]- qTo ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=7] = QMFunc.declaredOnly <-[Propag]- QMFunc.IncludeExtensionsInClass <-[Call]- qTo ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] val declaredOnly: Boolean - // CallChain[size=7] = QMFunc.includeExtensionsInClass <-[Propag]- QMFunc.IncludeExtensionsInClass < ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=7] = QMFunc.includeExtensionsInClass <-[Propag]- QMFunc.IncludeExtensionsInClass < ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] val includeExtensionsInClass: Boolean - // CallChain[size=7] = QMFunc.matches() <-[Propag]- QMFunc.IncludeExtensionsInClass <-[Call]- qToStr ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=7] = QMFunc.matches() <-[Propag]- QMFunc.IncludeExtensionsInClass <-[Call]- qToStr ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] fun matches(value: KFunction<*>): Boolean - // CallChain[size=7] = QMFunc.isAny() <-[Propag]- QMFunc.IncludeExtensionsInClass <-[Call]- qToStrin ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=7] = QMFunc.isAny() <-[Propag]- QMFunc.IncludeExtensionsInClass <-[Call]- qToStrin ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] fun isAny(): Boolean = this == QMatchFuncAny - // CallChain[size=7] = QMFunc.isNone() <-[Propag]- QMFunc.IncludeExtensionsInClass <-[Call]- qToStri ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=7] = QMFunc.isNone() <-[Propag]- QMFunc.IncludeExtensionsInClass <-[Call]- qToStri ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] fun isNone(): Boolean = this == QMatchFuncNone companion object { - // CallChain[size=6] = QMFunc.DeclaredOnly <-[Call]- qToStringRegistry <-[Call]- Any?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=6] = QMFunc.DeclaredOnly <-[Call]- qToStringRegistry <-[Call]- Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] val DeclaredOnly: QMFunc = QMatchFuncDeclaredOnly - // CallChain[size=6] = QMFunc.IncludeExtensionsInClass <-[Call]- qToStringRegistry <-[Call]- Any?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=6] = QMFunc.IncludeExtensionsInClass <-[Call]- qToStringRegistry <-[Call]- Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] // TODO OnlyExtensionsInClass val IncludeExtensionsInClass: QMFunc = QMatchFuncIncludeExtensionsInClass @@ -816,7 +814,7 @@ private interface QMFunc { // TODO vararg, nullability, param names, type parameter // TODO handle createType() more carefully - // CallChain[size=6] = QMFunc.nameExact() <-[Call]- qToStringRegistry <-[Call]- Any?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=6] = QMFunc.nameExact() <-[Call]- qToStringRegistry <-[Call]- Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] fun nameExact(text: String, ignoreCase: Boolean = false): QMFunc { return QMatchFuncName(QM.exact(text, ignoreCase = ignoreCase)) } @@ -825,23 +823,23 @@ private interface QMFunc { } } -// CallChain[size=7] = QMatchFuncName <-[Call]- QMFunc.nameExact() <-[Call]- qToStringRegistry <-[Ca ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=7] = QMatchFuncName <-[Call]- QMFunc.nameExact() <-[Call]- qToStringRegistry <-[Ca ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private class QMatchFuncName(val nameMatcher: QM) : QMFuncA() { - // CallChain[size=8] = QMatchFuncName.matches() <-[Propag]- QMatchFuncName <-[Call]- QMFunc.nameExac ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=8] = QMatchFuncName.matches() <-[Propag]- QMatchFuncName <-[Call]- QMFunc.nameExac ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] override fun matches(value: KFunction<*>): Boolean { return nameMatcher.matches(value.name) } - // CallChain[size=8] = QMatchFuncName.toString() <-[Propag]- QMatchFuncName <-[Call]- QMFunc.nameExa ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=8] = QMatchFuncName.toString() <-[Propag]- QMatchFuncName <-[Call]- QMFunc.nameExa ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] override fun toString(): String { return this::class.simpleName + ":" + nameMatcher.toString() } } -// CallChain[size=16] = qDEFAULT_CACHE_IT_EXPIRATION_CHECK_INTERVAL <-[Call]- QCacheMap.QCacheMap() ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=11] = qDEFAULT_CACHE_IT_EXPIRATION_CHECK_INTERVAL <-[Call]- QCacheMap.QCacheMap() ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private const val qDEFAULT_CACHE_IT_EXPIRATION_CHECK_INTERVAL = 1000L -// CallChain[size=14] = qThreadLocalCache <-[Call]- qCacheItTimedThreadLocal() <-[Call]- qCacheItOne ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=9] = qThreadLocalCache <-[Call]- qCacheItTimedThreadLocal() <-[Call]- qCacheItOneS ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private val qThreadLocalCache: ThreadLocal by lazy { ThreadLocal.withInitial { QCacheMap( @@ -860,34 +858,34 @@ private fun qCacheItOneSec(key: K, block: () -> V): V = qCac private fun qCacheItTimed(key: K, duration: Long, block: () -> V): V = qCacheThreadSafe.getOrPut(key) { QCacheEntry(block(), duration, qNow) }.value as V -// CallChain[size=12] = qCacheItOneSecThreadLocal() <-[Call]- qRe() <-[Call]- String.qReplaceFirstIf ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=7] = qCacheItOneSecThreadLocal() <-[Call]- qRe() <-[Call]- QException.mySrcAndStac ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private fun qCacheItOneSecThreadLocal(key: K, block: () -> V): V = qCacheItTimedThreadLocal(key, 1000L, block) -// CallChain[size=13] = qCacheItTimedThreadLocal() <-[Call]- qCacheItOneSecThreadLocal() <-[Call]- q ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=8] = qCacheItTimedThreadLocal() <-[Call]- qCacheItOneSecThreadLocal() <-[Call]- qR ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private fun qCacheItTimedThreadLocal(key: K, duration: Long, block: () -> V): V = qThreadLocalCache.get().getOrPut(key) { QCacheEntry(block(), duration, qNow) }.value as V -// CallChain[size=15] = QCacheMap <-[Ref]- qThreadLocalCache <-[Call]- qCacheItTimedThreadLocal() <- ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=10] = QCacheMap <-[Ref]- qThreadLocalCache <-[Call]- qCacheItTimedThreadLocal() <- ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private class QCacheMap( val expirationCheckInterval: Long = qDEFAULT_CACHE_IT_EXPIRATION_CHECK_INTERVAL, val threadSafe: Boolean = false ) { - // CallChain[size=15] = QCacheMap.lastCheck <-[Call]- QCacheMap.getOrPut() <-[Call]- qCacheItTimedTh ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=10] = QCacheMap.lastCheck <-[Call]- QCacheMap.getOrPut() <-[Call]- qCacheItTimedTh ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] var lastCheck: Long = -1 - // CallChain[size=15] = QCacheMap.lock <-[Call]- QCacheMap.getOrPut() <-[Call]- qCacheItTimedThreadL ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=10] = QCacheMap.lock <-[Call]- QCacheMap.getOrPut() <-[Call]- qCacheItTimedThreadL ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] val lock: ReentrantLock = ReentrantLock() - // CallChain[size=15] = QCacheMap.map <-[Call]- QCacheMap.getOrPut() <-[Call]- qCacheItTimedThreadLo ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=10] = QCacheMap.map <-[Call]- QCacheMap.getOrPut() <-[Call]- qCacheItTimedThreadLo ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] val map: MutableMap = mutableMapOf() - // CallChain[size=15] = QCacheMap.clearExpired() <-[Call]- QCacheMap.getOrPut() <-[Call]- qCacheItTi ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=10] = QCacheMap.clearExpired() <-[Call]- QCacheMap.getOrPut() <-[Call]- qCacheItTi ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] fun clearExpired(): Int = lock.qWithLock(threadSafe) { val toRemove = map.filterValues { it.isExpired() } toRemove.forEach { map.remove(it.key) } return toRemove.count() } - // CallChain[size=14] = QCacheMap.getOrPut() <-[Call]- qCacheItTimedThreadLocal() <-[Call]- qCacheIt ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=9] = QCacheMap.getOrPut() <-[Call]- qCacheItTimedThreadLocal() <-[Call]- qCacheItO ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] fun getOrPut(key: Any, defaultValue: () -> QCacheEntry): QCacheEntry = lock.qWithLock(threadSafe) { val now = qNow if (now - lastCheck > expirationCheckInterval) { @@ -899,13 +897,13 @@ private class QCacheMap( } } -// CallChain[size=14] = QCacheEntry <-[Call]- qCacheItTimedThreadLocal() <-[Call]- qCacheItOneSecThr ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=9] = QCacheEntry <-[Call]- qCacheItTimedThreadLocal() <-[Call]- qCacheItOneSecThre ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private data class QCacheEntry(val value: Any?, val duration: Long, val creationTime: Long = qNow) { - // CallChain[size=16] = QCacheEntry.isExpired() <-[Call]- QCacheMap.clearExpired() <-[Call]- QCacheM ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=11] = QCacheEntry.isExpired() <-[Call]- QCacheMap.clearExpired() <-[Call]- QCacheM ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] fun isExpired() = (qNow - creationTime) > duration } -// CallChain[size=15] = Lock.qWithLock() <-[Call]- QCacheMap.getOrPut() <-[Call]- qCacheItTimedThrea ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=10] = Lock.qWithLock() <-[Call]- QCacheMap.getOrPut() <-[Call]- qCacheItTimedThrea ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private inline fun Lock.qWithLock(threadSafe: Boolean, block: () -> T): T { return if (threadSafe) { withLock(block) @@ -945,11 +943,11 @@ private fun qUnreachable(msg: Any? = ""): Nothing { // CallChain[size=3] = QException <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private class QException( val type: QE = QE.Other, - msg: String = QMyMark.WARN, + msg: String = QMyMark.warn, e: Throwable? = null, val stackDepth: Int = 0, stackSize: Int = 20, - stackFilter: (StackWalker.StackFrame) -> Boolean = QE.STACK_FRAME_FILTER, + stackFilter: (StackWalker.StackFrame) -> Boolean = qSTACK_FRAME_FILTER, private val srcCut: QSrcCut = QSrcCut.MULTILINE_NOCUT, ) : RuntimeException(msg, e) { @@ -964,7 +962,7 @@ private class QException( // CallChain[size=5] = QException.mySrcAndStack <-[Call]- QException.printStackTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] val mySrcAndStack: String by lazy { qLogStackFrames(frames = stackFrames, style = QLogStyle.SRC_AND_STACK, srcCut = srcCut, quiet = true) - .qColorTarget(qRe("""\sshould[a-zA-Z]+"""), QShColor.LIGHT_YELLOW) + .qColorTarget(qRe("""\sshould[a-zA-Z]+"""), QShColor.LightYellow) } // CallChain[size=4] = QException.getStackTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] @@ -995,7 +993,7 @@ private class QException( } } -// CallChain[size=10] = T?.qaNotNull() <-[Call]- qSrcFileAtFrame() <-[Call]- qSrcFileLinesAtFrame() ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=10] = T.qaNotNull() <-[Call]- qSrcFileAtFrame() <-[Call]- qSrcFileLinesAtFrame() < ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private fun T?.qaNotNull(exceptionType: QE = QE.ShouldNotBeNull, msg: Any? = ""): T { if (this != null) { return this @@ -1004,7 +1002,7 @@ private fun T?.qaNotNull(exceptionType: QE = QE.ShouldNotBeNull, msg: } } -// CallChain[size=5] = Int?.qaNotZero() <-[Call]- CharSequence.qMask() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=5] = Int.qaNotZero() <-[Call]- CharSequence.qMask() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private fun Int?.qaNotZero(exceptionType: QE = QE.ShouldNotBeZero, msg: Any? = ""): Int { if (this == null) { QE.ShouldNotBeNull.throwIt(stackDepth = 1, msg = msg) @@ -1015,34 +1013,34 @@ private fun Int?.qaNotZero(exceptionType: QE = QE.ShouldNotBeZero, msg: Any? = " } } -// CallChain[size=3] = QExProps <-[Call]- Any.qSetExProp() <-[Call]- parent[Root] +// CallChain[size=3] = QExProps <-[Call]- Any.qSetExProp() <-[Call]- N.parent[Root] /** * Minimal Version of IdentityWeakHashMap. */ private object QExProps { - // CallChain[size=4] = QExProps.map <-[Call]- QExProps.put() <-[Call]- Any.qSetExProp() <-[Call]- parent[Root] + // CallChain[size=4] = QExProps.map <-[Call]- QExProps.put() <-[Call]- Any.qSetExProp() <-[Call]- N.parent[Root] val map: MutableMap> = HashMap() - // CallChain[size=4] = QExProps.removeGarbageCollectedEntries() <-[Call]- QExProps.put() <-[Call]- Any.qSetExProp() <-[Call]- parent[Root] + // CallChain[size=4] = QExProps.removeGarbageCollectedEntries() <-[Call]- QExProps.put() <-[Call]- Any.qSetExProp() <-[Call]- N.parent[Root] fun removeGarbageCollectedEntries() { map.keys.removeIf { it.get() == null } } - // CallChain[size=3] = QExProps.get() <-[Call]- Any.qSetExProp() <-[Call]- parent[Root] + // CallChain[size=3] = QExProps.get() <-[Call]- Any.qSetExProp() <-[Call]- N.parent[Root] fun get(key: Any): HashMap? { removeGarbageCollectedEntries() return map[WeakKey(key)] } - // CallChain[size=3] = QExProps.put() <-[Call]- Any.qSetExProp() <-[Call]- parent[Root] + // CallChain[size=3] = QExProps.put() <-[Call]- Any.qSetExProp() <-[Call]- N.parent[Root] fun put(key: Any, value: HashMap) { removeGarbageCollectedEntries() map[WeakKey(key)] = value } - // CallChain[size=4] = QExProps.WeakKey <-[Call]- QExProps.put() <-[Call]- Any.qSetExProp() <-[Call]- parent[Root] + // CallChain[size=4] = QExProps.WeakKey <-[Call]- QExProps.put() <-[Call]- Any.qSetExProp() <-[Call]- N.parent[Root] class WeakKey(key: Any) : WeakReference(key) { val hash = System.identityHashCode(key) @@ -1058,7 +1056,7 @@ private object QExProps { } } -// CallChain[size=2] = Any.qSetExProp() <-[Call]- parent[Root] +// CallChain[size=2] = Any.qSetExProp() <-[Call]- N.parent[Root] private fun Any.qSetExProp(key: String, value: Any?) = synchronized(QExProps) { var props = QExProps.get(this) if (props == null) { @@ -1068,21 +1066,21 @@ private fun Any.qSetExProp(key: String, value: Any?) = synchronized(QExProps) { props[key] = value } -// CallChain[size=2] = Any.qGetExProp() <-[Call]- children[Root] +// CallChain[size=2] = Any.qGetExProp() <-[Call]- N.children[Root] private fun Any.qGetExProp(key: String): Any? = synchronized(QExProps) { val props = QExProps.get(this) ?: return null return props[key] } -// CallChain[size=3] = Any.qGetExPropOrDefault() <-[Call]- Any.qGetExPropOrNull() <-[Call]- parent[Root] +// CallChain[size=3] = Any.qGetExPropOrDefault() <-[Call]- Any.qGetExPropOrNull() <-[Call]- N.parent[Root] private fun Any.qGetExPropOrDefault(key: String, default: T): T = synchronized(QExProps) { val props = QExProps.get(this) ?: return default return props.getOrDefault(key, default) as T } -// CallChain[size=2] = Any.qGetExPropOrNull() <-[Call]- parent[Root] +// CallChain[size=2] = Any.qGetExPropOrNull() <-[Call]- N.parent[Root] private fun Any.qGetExPropOrNull(key: String): Any? = synchronized(QExProps) { return qGetExPropOrDefault(key, null) } @@ -1756,9 +1754,9 @@ private class QLogStyle( if (!onlyIf.matches(this)) return this - return """${"SRC START ―――――――――――".qColor(QShColor.CYAN)} + return """${"SRC START ―――――――――――".qColor(QShColor.Cyan)} ${this.trim()} -${"SRC END ―――――――――――".qColor(QShColor.CYAN)}""" +${"SRC END ―――――――――――".qColor(QShColor.Cyan)}""" } // CallChain[size=8] = QLogStyle.qLogArrow() <-[Call]- QLogStyle.S <-[Call]- qLogStackFrames() <-[Ca ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] @@ -1813,7 +1811,7 @@ private fun qMySrcLinesAtFrame( src2 } catch (e: Exception) { // e.message - "${QMyMark.WARN} Couldn't cut src lines : ${qBrackets("FileName", frame.fileName, "LineNo", frame.lineNumber, "SrcRoots", srcRoots)}" + "${QMyMark.warn} Couldn't cut src lines : ${qBrackets("FileName", frame.fileName, "LineNo", frame.lineNumber, "SrcRoots", srcRoots)}" } } @@ -1855,12 +1853,12 @@ private fun qLogStackFrames( val text = style.start + output + style.end - val finalTxt = if (noColor) text.noColor else text + val finalTxt = if (noColor) text.noStyle else text if (!quiet) style.out.print(finalTxt) - return if (noColor) output.noColor else output + return if (noColor) output.noStyle else output } // CallChain[size=8] = qSrcFileLinesAtFrame() <-[Call]- qMySrcLinesAtFrame() <-[Call]- qLogStackFram ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] @@ -1960,7 +1958,7 @@ private class QConsole(override val isAcceptColoredText: Boolean) : QOut { if (isAcceptColoredText) { kotlin.io.print(msg.toString()) } else { - kotlin.io.print(msg.toString().noColor) + kotlin.io.print(msg.toString().noStyle) } } @@ -1975,7 +1973,7 @@ private class QConsole(override val isAcceptColoredText: Boolean) : QOut { } } -// CallChain[size=6] = KClass<*>.qFunctions() <-[Call]- qToStringRegistry <-[Call]- Any?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=6] = KClass<*>.qFunctions() <-[Call]- qToStringRegistry <-[Call]- Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private fun KClass<*>.qFunctions(matcher: QMFunc = QMFunc.DeclaredOnly and QMFunc.IncludeExtensionsInClass): List> { val list = mutableListOf>() @@ -2038,7 +2036,7 @@ private fun qSrcFileAtFrame(frame: StackFrame, srcRoots: List = QMyPath.sr private inline fun qStackFrames( stackDepth: Int = 0, size: Int = 1, - noinline filter: (StackFrame) -> Boolean = QE.STACK_FRAME_FILTER, + noinline filter: (StackFrame) -> Boolean = qSTACK_FRAME_FILTER, ): List { return StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE).walk { s: Stream -> s.asSequence().filter(filter).drop(stackDepth).take(size).toList() @@ -2048,12 +2046,12 @@ private inline fun qStackFrames( // CallChain[size=9] = qStackFrame() <-[Call]- qSrcFileLinesAtFrame() <-[Call]- qMySrcLinesAtFrame() ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private inline fun qStackFrame( stackDepth: Int = 0, - noinline filter: (StackFrame) -> Boolean = QE.STACK_FRAME_FILTER, + noinline filter: (StackFrame) -> Boolean = qSTACK_FRAME_FILTER, ): StackFrame { return qStackFrames(stackDepth, 1, filter)[0] } -// CallChain[size=7] = KType.qToClass() <-[Call]- KType.qIsSuperclassOf() <-[Call]- qToStringRegistr ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=7] = KType.qToClass() <-[Call]- KType.qIsSuperclassOf() <-[Call]- qToStringRegistr ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private fun KType.qToClass(): KClass<*>? { return if (this.classifier != null && this.classifier is KClass<*>) { this.classifier as KClass<*> @@ -2062,7 +2060,7 @@ private fun KType.qToClass(): KClass<*>? { } } -// CallChain[size=6] = KType.qIsSuperclassOf() <-[Call]- qToStringRegistry <-[Call]- Any?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=6] = KType.qIsSuperclassOf() <-[Call]- qToStringRegistry <-[Call]- Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private fun KType.qIsSuperclassOf(cls: KClass<*>): Boolean { return try { val thisClass = qToClass() @@ -2078,203 +2076,180 @@ private fun KType.qIsSuperclassOf(cls: KClass<*>): Boolean { } } -// CallChain[size=11] = RO <-[Ref]- String.qReplaceFirstIfNonEmptyStringGroup() <-[Call]- String.qAp ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=7] = RO <-[Ref]- qRe() <-[Call]- QException.mySrcAndStack <-[Call]- QException.pri ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private typealias RO = RegexOption -// CallChain[size=11] = qRe() <-[Call]- String.qReplaceFirstIfNonEmptyStringGroup() <-[Call]- String ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=6] = qRe() <-[Call]- QException.mySrcAndStack <-[Call]- QException.printStackTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private fun qRe(@Language("RegExp") regex: String, vararg opts: RO): Regex { return qCacheItOneSecThreadLocal(regex + opts.contentToString()) { Regex(regex, setOf(*opts)) } } -// CallChain[size=10] = re <-[Call]- String.qApplyColorNestable() <-[Call]- String.qColorLine() <-[C ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=13] = @receiver:Language("RegExp") String.re <-[Call]- String.noStyle <-[Call]- QC ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] // https://youtrack.jetbrains.com/issue/KTIJ-5643 private val @receiver:Language("RegExp") String.re: Regex get() = qRe(this) -// CallChain[size=10] = String.qReplaceFirstIfNonEmptyStringGroup() <-[Call]- String.qApplyColorNest ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] -private fun String.qReplaceFirstIfNonEmptyStringGroup(@Language("RegExp") regex: String, nonEmptyGroupIdx: Int, replace: String = "$1", vararg opts: RO): String { - val re = qRe(regex, *opts) - - return if (re.find(this)?.groups?.get(nonEmptyGroupIdx)?.value?.isNotEmpty() == true) { - re.replaceFirst(this, replace) - } else { - this - } -} - -// CallChain[size=9] = qBG_JUMP <-[Call]- QShColor.bg <-[Propag]- QShColor.YELLOW <-[Call]- yellow < ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=9] = qBG_JUMP <-[Call]- QShColor.bg <-[Propag]- QShColor.Yellow <-[Call]- String.y ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private const val qBG_JUMP = 10 -// CallChain[size=9] = qSTART <-[Call]- QShColor.bg <-[Propag]- QShColor.YELLOW <-[Call]- yellow <-[ ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=9] = qSTART <-[Call]- QShColor.bg <-[Propag]- QShColor.Yellow <-[Call]- String.yel ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private const val qSTART = "\u001B[" -// CallChain[size=9] = qEND <-[Call]- String.qColorLine() <-[Call]- String.qColor() <-[Call]- yellow ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=10] = qEND <-[Call]- String.qApplyEscapeLine() <-[Call]- String.qApplyEscapeLine() ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private const val qEND = "${qSTART}0m" -// CallChain[size=10] = qMASK_COLORED <-[Call]- String.qApplyColorNestable() <-[Call]- String.qColor ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] -private val qMASK_COLORED by lazy { - QMaskBetween( - qSTART, - qEND, - qSTART, - escapeChar = '\\', - targetNestDepth = 1, - maskIncludeStartAndEndSequence = false - ) -} +// CallChain[size=10] = String.qApplyEscapeNestable() <-[Call]- String.qApplyEscapeLine() <-[Call]- ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +private fun String.qApplyEscapeNestable(start: String): String { + val lastEnd = this.endsWith(qEND) -// CallChain[size=9] = String.qApplyColorNestable() <-[Call]- String.qColorLine() <-[Call]- String.q ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] -private fun String.qApplyColorNestable(colorStart: String): String { - val re = "(?s)(\\Q$qEND\\E)(.+?)(\\Q$qSTART\\E|$)".re - val replace = "$1$colorStart$2$qEND$3" - val re2 = "^(?s)(.*?)(\\Q$qSTART\\E)" - val replace2 = "$colorStart$1$qEND$2" - - return this.qMaskAndReplace( - qMASK_COLORED, - re, - replace - ).qReplaceFirstIfNonEmptyStringGroup(re2, 1, replace2) + return if( lastEnd ) { + start + this.substring(0, this.length - 1).replace(qEND, qEND + start) + this[this.length - 1] + } else { + start + this.replace(qEND, qEND + start) + qEND + } } -// CallChain[size=7] = String.qColor() <-[Call]- yellow <-[Call]- QException.qToString() <-[Call]- Q ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=7] = String.qColor() <-[Call]- String.yellow <-[Call]- QException.qToString() <-[C ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private fun String.qColor(fg: QShColor? = null, bg: QShColor? = null, nestable: Boolean = this.contains(qSTART)): String { return if (this.qIsSingleLine()) { - this.qColorLine(fg, bg, nestable) + this.qApplyEscapeLine(fg, bg, nestable) } else { lineSequence().map { line -> - line.qColorLine(fg, bg, nestable) + line.qApplyEscapeLine(fg, bg, nestable) }.joinToString("\n") } } -// CallChain[size=8] = String.qColorLine() <-[Call]- String.qColor() <-[Call]- yellow <-[Call]- QExc ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] -private fun String.qColorLine( - fg: QShColor? = null, - bg: QShColor? = null, - nestable: Boolean = true, +// CallChain[size=8] = String.qApplyEscapeLine() <-[Call]- String.qColor() <-[Call]- String.yellow < ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +private fun String.qApplyEscapeLine(fg: QShColor?, bg: QShColor?, nestable: Boolean): String { + return this.qApplyEscapeLine( + listOfNotNull(fg?.fg, bg?.bg).toTypedArray(), + nestable + ) +} + +// CallChain[size=9] = String.qApplyEscapeLine() <-[Call]- String.qApplyEscapeLine() <-[Call]- Strin ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +private fun String.qApplyEscapeLine( + startSequences: Array, + nestable: Boolean ): String { val nest = nestable && this.contains(qEND) - val fgApplied = if (fg != null) { - val fgStart = fg.fg + var text = this - if (nest) { - this.qApplyColorNestable(fgStart) + for (start in startSequences) { + text = if (nest) { + text.qApplyEscapeNestable(start) } else { - "$fgStart$this$qEND" + "$start$text$qEND" } - } else { - this } - val bgApplied = if (bg != null) { - val bgStart = bg.bg - - if (nest) { - fgApplied.qApplyColorNestable(bgStart) - } else { - "$bgStart$fgApplied$qEND" - } - } else { - fgApplied - } - - return bgApplied + return text } -// CallChain[size=12] = noColor <-[Call]- QConsole.print() <-[Propag]- QConsole <-[Call]- QOut.CONSO ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] -private val String.noColor: String - get() { - return this.replace("""\Q$qSTART\E\d{1,2}m""".re, "") - } - -// CallChain[size=7] = QShColor <-[Ref]- yellow <-[Call]- QException.qToString() <-[Call]- QException.toString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=7] = QShColor <-[Ref]- String.yellow <-[Call]- QException.qToString() <-[Call]- QE ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] enum class QShColor(val code: Int) { - // CallChain[size=8] = QShColor.BLACK <-[Propag]- QShColor.YELLOW <-[Call]- yellow <-[Call]- QExcept ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] - BLACK(30), - // CallChain[size=8] = QShColor.RED <-[Propag]- QShColor.YELLOW <-[Call]- yellow <-[Call]- QExceptio ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] - RED(31), - // CallChain[size=8] = QShColor.GREEN <-[Propag]- QShColor.YELLOW <-[Call]- yellow <-[Call]- QExcept ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] - GREEN(32), - // CallChain[size=7] = QShColor.YELLOW <-[Call]- yellow <-[Call]- QException.qToString() <-[Call]- Q ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] - YELLOW(33), - // CallChain[size=8] = QShColor.BLUE <-[Propag]- QShColor.YELLOW <-[Call]- yellow <-[Call]- QExcepti ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] - BLUE(34), - // CallChain[size=8] = QShColor.MAGENTA <-[Propag]- QShColor.YELLOW <-[Call]- yellow <-[Call]- QExce ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] - MAGENTA(35), - // CallChain[size=8] = QShColor.CYAN <-[Propag]- QShColor.YELLOW <-[Call]- yellow <-[Call]- QExcepti ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] - CYAN(36), - // CallChain[size=8] = QShColor.LIGHT_GRAY <-[Propag]- QShColor.YELLOW <-[Call]- yellow <-[Call]- QE ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] - LIGHT_GRAY(37), - - // CallChain[size=8] = QShColor.DARK_GRAY <-[Propag]- QShColor.YELLOW <-[Call]- yellow <-[Call]- QEx ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] - DARK_GRAY(90), - // CallChain[size=8] = QShColor.LIGHT_RED <-[Propag]- QShColor.YELLOW <-[Call]- yellow <-[Call]- QEx ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] - LIGHT_RED(91), - // CallChain[size=8] = QShColor.LIGHT_GREEN <-[Propag]- QShColor.YELLOW <-[Call]- yellow <-[Call]- Q ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] - LIGHT_GREEN(92), - // CallChain[size=8] = QShColor.LIGHT_YELLOW <-[Propag]- QShColor.YELLOW <-[Call]- yellow <-[Call]- ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] - LIGHT_YELLOW(93), - // CallChain[size=8] = QShColor.LIGHT_BLUE <-[Propag]- QShColor.YELLOW <-[Call]- yellow <-[Call]- QE ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] - LIGHT_BLUE(94), - // CallChain[size=8] = QShColor.LIGHT_MAGENTA <-[Propag]- QShColor.YELLOW <-[Call]- yellow <-[Call]- ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] - LIGHT_MAGENTA(95), - // CallChain[size=8] = QShColor.LIGHT_CYAN <-[Propag]- QShColor.YELLOW <-[Call]- yellow <-[Call]- QE ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] - LIGHT_CYAN(96), - // CallChain[size=8] = QShColor.WHITE <-[Propag]- QShColor.YELLOW <-[Call]- yellow <-[Call]- QExcept ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] - WHITE(97); - - // CallChain[size=8] = QShColor.fg <-[Propag]- QShColor.YELLOW <-[Call]- yellow <-[Call]- QException ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] - /** ANSI modifier string to apply the color to the text itself */ + // CallChain[size=8] = QShColor.Black <-[Propag]- QShColor.Yellow <-[Call]- String.yellow <-[Call]- ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + Black(30), + // CallChain[size=8] = QShColor.Red <-[Propag]- QShColor.Yellow <-[Call]- String.yellow <-[Call]- QE ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + Red(31), + // CallChain[size=8] = QShColor.Green <-[Propag]- QShColor.Yellow <-[Call]- String.yellow <-[Call]- ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + Green(32), + // CallChain[size=7] = QShColor.Yellow <-[Call]- String.yellow <-[Call]- QException.qToString() <-[C ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + Yellow(33), + // CallChain[size=8] = QShColor.Blue <-[Propag]- QShColor.Yellow <-[Call]- String.yellow <-[Call]- Q ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + Blue(34), + // CallChain[size=8] = QShColor.Purple <-[Propag]- QShColor.Yellow <-[Call]- String.yellow <-[Call]- ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + Purple(35), + // CallChain[size=8] = QShColor.Cyan <-[Propag]- QShColor.Yellow <-[Call]- String.yellow <-[Call]- Q ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + Cyan(36), + // CallChain[size=8] = QShColor.LightGray <-[Propag]- QShColor.Yellow <-[Call]- String.yellow <-[Cal ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + LightGray(37), + + // CallChain[size=8] = QShColor.DefaultFG <-[Propag]- QShColor.Yellow <-[Call]- String.yellow <-[Cal ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + DefaultFG(39), + // CallChain[size=8] = QShColor.DefaultBG <-[Propag]- QShColor.Yellow <-[Call]- String.yellow <-[Cal ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + DefaultBG(49), + + // CallChain[size=8] = QShColor.DarkGray <-[Propag]- QShColor.Yellow <-[Call]- String.yellow <-[Call ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + DarkGray(90), + // CallChain[size=8] = QShColor.LightRed <-[Propag]- QShColor.Yellow <-[Call]- String.yellow <-[Call ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + LightRed(91), + // CallChain[size=8] = QShColor.LightGreen <-[Propag]- QShColor.Yellow <-[Call]- String.yellow <-[Ca ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + LightGreen(92), + // CallChain[size=8] = QShColor.LightYellow <-[Propag]- QShColor.Yellow <-[Call]- String.yellow <-[C ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + LightYellow(93), + // CallChain[size=8] = QShColor.LightBlue <-[Propag]- QShColor.Yellow <-[Call]- String.yellow <-[Cal ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + LightBlue(94), + // CallChain[size=8] = QShColor.LightPurple <-[Propag]- QShColor.Yellow <-[Call]- String.yellow <-[C ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + LightPurple(95), + // CallChain[size=8] = QShColor.LightCyan <-[Propag]- QShColor.Yellow <-[Call]- String.yellow <-[Cal ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + LightCyan(96), + // CallChain[size=8] = QShColor.White <-[Propag]- QShColor.Yellow <-[Call]- String.yellow <-[Call]- ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + White(97); + + // CallChain[size=8] = QShColor.fg <-[Propag]- QShColor.Yellow <-[Call]- String.yellow <-[Call]- QEx ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] val fg: String = "$qSTART${code}m" - // CallChain[size=8] = QShColor.bg <-[Propag]- QShColor.YELLOW <-[Call]- yellow <-[Call]- QException ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] - /** ANSI modifier string to apply the color the text's background */ + // CallChain[size=8] = QShColor.bg <-[Propag]- QShColor.Yellow <-[Call]- String.yellow <-[Call]- QEx ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] val bg: String = "$qSTART${code + qBG_JUMP}m" companion object { - // CallChain[size=8] = QShColor.random() <-[Propag]- QShColor.YELLOW <-[Call]- yellow <-[Call]- QExc ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] - fun random(seed: String, colors: Array = arrayOf(YELLOW, GREEN, BLUE, MAGENTA, CYAN)): QShColor { + // CallChain[size=8] = QShColor.random() <-[Propag]- QShColor.Yellow <-[Call]- String.yellow <-[Call ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + fun random(seed: String, colors: Array = arrayOf(Yellow, Green, Blue, Purple, Cyan)): QShColor { val idx = seed.hashCode().rem(colors.size).absoluteValue return colors[idx] } + + // CallChain[size=8] = QShColor.get() <-[Propag]- QShColor.Yellow <-[Call]- String.yellow <-[Call]- ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + fun get(ansiEscapeCode: Int): QShColor { + return QShColor.values().find { + it.code == ansiEscapeCode + }!! + } } } // CallChain[size=6] = String.qColorTarget() <-[Call]- QException.mySrcAndStack <-[Call]- QException ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] -private fun String.qColorTarget(ptn: Regex, color: QShColor = QShColor.LIGHT_YELLOW): String { - return ptn.replace(this, "$0".qColor(color)) +private fun String.qColorTarget(ptn: Regex, fg: QShColor? = null, bg: QShColor? = null): String { + return ptn.replace(this, "$0".qColor(fg, bg)) } -// CallChain[size=6] = yellow <-[Call]- QException.qToString() <-[Call]- QException.toString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=6] = String.yellow <-[Call]- QException.qToString() <-[Call]- QException.toString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private val String?.yellow: String - get() = this?.qColor(QShColor.YELLOW) ?: "null".qColor(QShColor.YELLOW) + get() = this?.qColor(QShColor.Yellow) ?: "null".qColor(QShColor.Yellow) -// CallChain[size=15] = cyan <-[Call]- QMaskResult.toString() <-[Propag]- QMaskResult <-[Ref]- QMask ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=8] = String.cyan <-[Call]- QLogStyle <-[Ref]- QLogStyle.SRC_AND_STACK <-[Call]- QE ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private val String?.cyan: String - get() = this?.qColor(QShColor.CYAN) ?: "null".qColor(QShColor.CYAN) + get() = this?.qColor(QShColor.Cyan) ?: "null".qColor(QShColor.Cyan) -// CallChain[size=3] = light_gray <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=3] = String.light_gray <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private val String?.light_gray: String - get() = this?.qColor(QShColor.LIGHT_GRAY) ?: "null".qColor(QShColor.LIGHT_GRAY) + get() = this?.qColor(QShColor.LightGray) ?: "null".qColor(QShColor.LightGray) -// CallChain[size=9] = light_green <-[Call]- QLogStyle.qLogArrow() <-[Call]- QLogStyle.S <-[Call]- q ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=9] = String.light_green <-[Call]- QLogStyle.qLogArrow() <-[Call]- QLogStyle.S <-[C ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private val String?.light_green: String - get() = this?.qColor(QShColor.LIGHT_GREEN) ?: "null".qColor(QShColor.LIGHT_GREEN) + get() = this?.qColor(QShColor.LightGreen) ?: "null".qColor(QShColor.LightGreen) -// CallChain[size=11] = light_cyan <-[Call]- qARROW <-[Call]- qArrow() <-[Call]- QLogStyle.qLogArrow ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=11] = String.light_cyan <-[Call]- qARROW <-[Call]- qArrow() <-[Call]- QLogStyle.qL ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private val String?.light_cyan: String - get() = this?.qColor(QShColor.LIGHT_CYAN) ?: "null".qColor(QShColor.LIGHT_CYAN) + get() = this?.qColor(QShColor.LightCyan) ?: "null".qColor(QShColor.LightCyan) + +// CallChain[size=12] = String.noStyle <-[Call]- QConsole.print() <-[Propag]- QConsole <-[Call]- QOu ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +private val String.noStyle: String + get() { + return this.replace("""\Q$qSTART\E\d{1,2}m""".re, "") + } // CallChain[size=2] = StringBuilder.plusAssign() <-[Call]- N.tree()[Root] private operator fun StringBuilder.plusAssign(str: String) { this.append(str) } -// CallChain[size=8] = path <-[Call]- QMyPath.src_root <-[Call]- qLogStackFrames() <-[Call]- QExcept ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=8] = String.path <-[Call]- QMyPath.src_root <-[Call]- qLogStackFrames() <-[Call]- ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private val String.path: Path get() = Paths.get(this.trim()).toAbsolutePath().normalize() @@ -2309,7 +2284,7 @@ private fun String.qWithNewLinePrefix( return lineSeparator.value.repeat(numNewLine) + substring(nCount) } -// CallChain[size=16] = String.qWithNewLineSuffix() <-[Call]- String.qWithNewLineSurround() <-[Call] ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=11] = String.qWithNewLineSuffix() <-[Call]- String.qWithNewLineSurround() <-[Call] ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private fun String.qWithNewLineSuffix(numNewLine: Int = 1, onlyIf: QOnlyIfStr = QOnlyIfStr.Multiline): String { if (!onlyIf.matches(this)) return this @@ -2318,7 +2293,7 @@ private fun String.qWithNewLineSuffix(numNewLine: Int = 1, onlyIf: QOnlyIfStr = return substring(0, length - nCount) + "\n".repeat(numNewLine) } -// CallChain[size=15] = String.qWithNewLineSurround() <-[Call]- QMaskResult.toString() <-[Propag]- Q ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=10] = String.qWithNewLineSurround() <-[Call]- String.qBracketEnd() <-[Call]- qBrac ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private fun String.qWithNewLineSurround(numNewLine: Int = 1, onlyIf: QOnlyIfStr = QOnlyIfStr.Multiline): String { if (!onlyIf.matches(this)) return this @@ -2372,13 +2347,13 @@ private enum class QLineSeparator(val value: String) { // CallChain[size=8] = String.qCountLeftSpace() <-[Call]- QFetchRule.SMART_FETCH <-[Call]- qLogStack ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private fun String.qCountLeftSpace(): Int = takeWhile { it == ' ' }.count() -// CallChain[size=4] = qMASK_LENGTH_LIMIT <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=4] = qMASK_LENGTH_LIMIT <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private const val qMASK_LENGTH_LIMIT: Int = 100_000 -// CallChain[size=6] = QToString <-[Ref]- qToStringRegistry <-[Call]- Any?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=6] = QToString <-[Ref]- qToStringRegistry <-[Call]- Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private class QToString(val okToApply: (Any) -> Boolean, val toString: (Any) -> String) -// CallChain[size=5] = qToStringRegistry <-[Call]- Any?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=5] = qToStringRegistry <-[Call]- Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private val qToStringRegistry: MutableList by lazy { val toStrings = QMyToString::class.qFunctions( @@ -2401,7 +2376,7 @@ private val qToStringRegistry: MutableList by lazy { }.toMutableList() } -// CallChain[size=4] = Any?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=4] = Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private fun Any?.qToString(): String { if (this == null) return "null".light_gray @@ -2415,7 +2390,7 @@ private fun Any?.qToString(): String { return toString() } -// CallChain[size=3] = Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=3] = Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private fun Any?.qToLogString(maxLineLength: Int = 80): String { if (QMyLog.no_format) { return this.toString() @@ -2458,12 +2433,12 @@ private fun Any?.qToLogString(maxLineLength: Int = 80): String { }.qClarifyEmptyOrBlank() } -// CallChain[size=4] = String.qClarifyEmptyOrBlank() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=4] = String.qClarifyEmptyOrBlank() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private fun String.qClarifyEmptyOrBlank(): String { return if (this.isEmpty()) { - "(EMPTY STRING)".qColor(QShColor.LIGHT_GRAY) + "(EMPTY STRING)".qColor(QShColor.LightGray) } else if (this.isBlank()) { - "$this(BLANK STRING)".qColor(QShColor.LIGHT_GRAY) + "$this(BLANK STRING)".qColor(QShColor.LightGray) } else { this } @@ -2479,13 +2454,13 @@ private fun String.qCountOccurrence(word: String): Int { }.sum() } -// CallChain[size=12] = QMask <-[Ref]- QMaskBetween <-[Call]- qMASK_COLORED <-[Call]- String.qApplyC ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=7] = QMask <-[Ref]- QMaskBetween <-[Call]- QMask.DOUBLE_QUOTE <-[Call]- QMask.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private interface QMask { - // CallChain[size=13] = QMask.apply() <-[Propag]- QMask <-[Ref]- QMaskBetween <-[Call]- qMASK_COLORE ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=5] = QMask.apply() <-[Propag]- QMask.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] fun apply(text: String): QMaskResult companion object { - // CallChain[size=5] = QMask.THREE_DOUBLE_QUOTES <-[Call]- QMask.KOTLIN_STRING <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=5] = QMask.THREE_DOUBLE_QUOTES <-[Call]- QMask.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] val THREE_DOUBLE_QUOTES by lazy { QMaskBetween( "\"\"\"", "\"\"\"", @@ -2494,7 +2469,7 @@ private interface QMask { maskIncludeStartAndEndSequence = false, ) } - // CallChain[size=5] = QMask.DOUBLE_QUOTE <-[Call]- QMask.KOTLIN_STRING <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=5] = QMask.DOUBLE_QUOTE <-[Call]- QMask.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] val DOUBLE_QUOTE by lazy { QMaskBetween( "\"", "\"", @@ -2503,21 +2478,21 @@ private interface QMask { maskIncludeStartAndEndSequence = false, ) } - // CallChain[size=4] = QMask.KOTLIN_STRING <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=4] = QMask.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] val KOTLIN_STRING by lazy { QMultiMask( THREE_DOUBLE_QUOTES, DOUBLE_QUOTE ) } - // CallChain[size=4] = QMask.PARENS <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=4] = QMask.PARENS <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] val PARENS by lazy { QMaskBetween( "(", ")", nestStartSequence = "(", escapeChar = '\\' ) } - // CallChain[size=4] = QMask.INNER_BRACKETS <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=4] = QMask.INNER_BRACKETS <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] val INNER_BRACKETS by lazy { QMaskBetween( "[", "]", @@ -2531,17 +2506,17 @@ private interface QMask { } } -// CallChain[size=5] = QMultiMask <-[Call]- QMask.KOTLIN_STRING <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=5] = QMultiMask <-[Call]- QMask.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private class QMultiMask(vararg mask: QMaskBetween) : QMask { - // CallChain[size=7] = QMultiMask.masks <-[Call]- QMultiMask.apply() <-[Propag]- QMultiMask <-[Call] ... .KOTLIN_STRING <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=7] = QMultiMask.masks <-[Call]- QMultiMask.apply() <-[Propag]- QMultiMask <-[Call] ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] val masks: Array - // CallChain[size=6] = QMultiMask.init { <-[Propag]- QMultiMask <-[Call]- QMask.KOTLIN_STRING <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=6] = QMultiMask.init { <-[Propag]- QMultiMask <-[Call]- QMask.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] init { masks = arrayOf(*mask) } - // CallChain[size=6] = QMultiMask.apply() <-[Propag]- QMultiMask <-[Call]- QMask.KOTLIN_STRING <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=6] = QMultiMask.apply() <-[Propag]- QMultiMask <-[Call]- QMask.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] override fun apply(text: String): QMaskResult { var result: QMaskResult? = null for (mask in masks) { @@ -2552,7 +2527,7 @@ private class QMultiMask(vararg mask: QMaskBetween) : QMask { } } -// CallChain[size=11] = QMaskBetween <-[Call]- qMASK_COLORED <-[Call]- String.qApplyColorNestable() ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=6] = QMaskBetween <-[Call]- QMask.DOUBLE_QUOTE <-[Call]- QMask.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private class QMaskBetween( val startSequence: String, val endSequence: String, @@ -2571,12 +2546,12 @@ private class QMaskBetween( val maskChar: Char = '\uee31', ) : QMask { - // CallChain[size=12] = QMaskBetween.apply() <-[Propag]- QMaskBetween.QMaskBetween() <-[Ref]- qMASK_ ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=7] = QMaskBetween.apply() <-[Propag]- QMaskBetween.QMaskBetween() <-[Ref]- QMask.D ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] override fun apply(text: String): QMaskResult { return applyMore(text, null) } - // CallChain[size=13] = QMaskBetween.applyMore() <-[Call]- QMaskBetween.apply() <-[Propag]- QMaskBet ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=8] = QMaskBetween.applyMore() <-[Call]- QMaskBetween.apply() <-[Propag]- QMaskBetw ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] fun applyMore(text: String, orgText: String? = null): QMaskResult { val regions = text.qFindBetween( startSequence, @@ -2629,9 +2604,9 @@ private class QMaskBetween( } } -// CallChain[size=16] = QMutRegion <-[Ref]- QRegion.toMutRegion() <-[Propag]- QRegion.contains() <-[ ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=11] = QMutRegion <-[Ref]- QRegion.toMutRegion() <-[Propag]- QRegion.contains() <-[ ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private open class QMutRegion(override var start: Int, override var end: Int) : QRegion(start, end) { - // CallChain[size=17] = QMutRegion.intersectMut() <-[Propag]- QMutRegion <-[Ref]- QRegion.toMutRegio ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=12] = QMutRegion.intersectMut() <-[Propag]- QMutRegion <-[Ref]- QRegion.toMutRegio ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] fun intersectMut(region: QRegion) { val start = max(this.start, region.start) val end = min(this.end, region.end) @@ -2642,39 +2617,39 @@ private open class QMutRegion(override var start: Int, override var end: Int) : } } - // CallChain[size=17] = QMutRegion.addOffset() <-[Propag]- QMutRegion <-[Ref]- QRegion.toMutRegion() ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=12] = QMutRegion.addOffset() <-[Propag]- QMutRegion <-[Ref]- QRegion.toMutRegion() ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] fun addOffset(offset: Int) { start += offset end += offset } - // CallChain[size=17] = QMutRegion.shift() <-[Propag]- QMutRegion <-[Ref]- QRegion.toMutRegion() <-[ ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=12] = QMutRegion.shift() <-[Propag]- QMutRegion <-[Ref]- QRegion.toMutRegion() <-[ ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] fun shift(length: Int) { this.start += length this.end += length } } -// CallChain[size=16] = QRegion <-[Ref]- QRegion.intersect() <-[Propag]- QRegion.contains() <-[Call] ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=11] = QRegion <-[Ref]- QRegion.intersect() <-[Propag]- QRegion.contains() <-[Call] ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] /** * [start] inclusive, [end] exclusive */ private open class QRegion(open val start: Int, open val end: Int) { - // CallChain[size=15] = QRegion.toMutRegion() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween. ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=10] = QRegion.toMutRegion() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween. ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] fun toMutRegion(): QMutRegion { return QMutRegion(start, end) } - // CallChain[size=15] = QRegion.toRange() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.appl ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=10] = QRegion.toRange() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.appl ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] fun toRange(): IntRange { return IntRange(start, end + 1) } - // CallChain[size=15] = QRegion.length <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.applyMo ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=10] = QRegion.length <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.applyMo ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] val length: Int get() = end - start - // CallChain[size=15] = QRegion.intersect() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.ap ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=10] = QRegion.intersect() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.ap ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] fun intersect(region: QRegion): QRegion? { val start = max(this.start, region.start) val end = min(this.end, region.end) @@ -2686,38 +2661,38 @@ private open class QRegion(open val start: Int, open val end: Int) { } } - // CallChain[size=14] = QRegion.contains() <-[Call]- QMaskBetween.applyMore() <-[Call]- QMaskBetween ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=9] = QRegion.contains() <-[Call]- QMaskBetween.applyMore() <-[Call]- QMaskBetween. ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] fun contains(idx: Int): Boolean { return idx in start until end } - // CallChain[size=15] = QRegion.cut() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.applyMor ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=10] = QRegion.cut() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.applyMor ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] fun cut(text: String): String { return text.substring(start, end) } - // CallChain[size=15] = QRegion.remove() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.apply ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=10] = QRegion.remove() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.apply ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] fun remove(text: String): String { return text.removeRange(start, end) } - // CallChain[size=15] = QRegion.replace() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.appl ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=10] = QRegion.replace() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.appl ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] fun replace(text: String, replacement: String): String { return text.replaceRange(start, end, replacement) } - // CallChain[size=15] = QRegion.mask() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.applyMo ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=10] = QRegion.mask() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.applyMo ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] fun mask(text: String, maskChar: Char = '*'): String { return text.replaceRange(this.toRange(), maskChar.toString().repeat(end - start)) } } -// CallChain[size=12] = QReplacer <-[Ref]- String.qMaskAndReplace() <-[Call]- String.qMaskAndReplace ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=6] = QReplacer <-[Ref]- String.qMaskAndReplace() <-[Call]- QMaskResult.replaceAndUnmask() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private class QReplacer(start: Int, end: Int, val replacement: String) : QMutRegion(start, end) -// CallChain[size=13] = QMaskResult <-[Ref]- QMaskBetween.apply() <-[Propag]- QMaskBetween.QMaskBetw ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=6] = QMaskResult <-[Ref]- QMask.apply() <-[Propag]- QMask.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private class QMaskResult(val maskedStr: String, val orgText: String, val maskChar: Char) { - // CallChain[size=4] = QMaskResult.replaceAndUnmask() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=4] = QMaskResult.replaceAndUnmask() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] /** * Apply regex to masked string. * Apply replacement to original text. @@ -2726,12 +2701,12 @@ private class QMaskResult(val maskedStr: String, val orgText: String, val maskCh return orgText.qMaskAndReplace(maskedStr, ptn, replacement, findAll) } - // CallChain[size=7] = QMaskResult.applyMoreMask() <-[Call]- QMultiMask.apply() <-[Propag]- QMultiMa ... .KOTLIN_STRING <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=7] = QMaskResult.applyMoreMask() <-[Call]- QMultiMask.apply() <-[Propag]- QMultiMa ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] fun applyMoreMask(mask: QMaskBetween): QMaskResult { return mask.applyMore(maskedStr, orgText) } - // CallChain[size=14] = QMaskResult.toString() <-[Propag]- QMaskResult <-[Ref]- QMaskBetween.apply() ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=7] = QMaskResult.toString() <-[Propag]- QMaskResult <-[Ref]- QMask.apply() <-[Prop ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] override fun toString(): String { val original = orgText.qWithNewLineSurround(onlyIf = QOnlyIfStr.Multiline) val masked = maskedStr.replace(maskChar, '*').qWithNewLineSurround(onlyIf = QOnlyIfStr.Multiline) @@ -2740,7 +2715,7 @@ private class QMaskResult(val maskedStr: String, val orgText: String, val maskCh } } -// CallChain[size=4] = CharSequence.qMask() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=4] = CharSequence.qMask() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private fun CharSequence.qMask(vararg mask: QMask): QMaskResult { mask.size.qaNotZero() @@ -2760,7 +2735,7 @@ private fun CharSequence.qMask(vararg mask: QMask): QMaskResult { } } -// CallChain[size=14] = String.qFindBetween() <-[Call]- QMaskBetween.applyMore() <-[Call]- QMaskBetw ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=9] = String.qFindBetween() <-[Call]- QMaskBetween.applyMore() <-[Call]- QMaskBetwe ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private fun String.qFindBetween( startSequence: String, endSequence: String, @@ -2787,7 +2762,7 @@ private fun String.qFindBetween( return finder.find(this) } -// CallChain[size=11] = String.qMaskAndReplace() <-[Call]- String.qMaskAndReplace() <-[Call]- String ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=5] = String.qMaskAndReplace() <-[Call]- QMaskResult.replaceAndUnmask() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private fun String.qMaskAndReplace( maskedStr: String, ptn: Regex, @@ -2821,19 +2796,7 @@ private fun String.qMaskAndReplace( return qMultiReplace(replacers) } -// CallChain[size=10] = String.qMaskAndReplace() <-[Call]- String.qApplyColorNestable() <-[Call]- St ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] -private fun String.qMaskAndReplace( - mask: QMask, - ptn: Regex, - replacement: String = "$1", - replaceAll: Boolean = true, -): String { - val maskResult = mask.apply(this) - - return qMaskAndReplace(maskResult.maskedStr, ptn, replacement, replaceAll) -} - -// CallChain[size=12] = CharSequence.qMultiReplace() <-[Call]- String.qMaskAndReplace() <-[Call]- St ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=6] = CharSequence.qMultiReplace() <-[Call]- String.qMaskAndReplace() <-[Call]- QMa ... laceAndUnmask() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] /** * currently does not support region overlap */ @@ -2849,7 +2812,7 @@ private fun CharSequence.qMultiReplace(replacers: List): String { return sb.toString() } -// CallChain[size=12] = MatchResult.qResolveReplacementGroup() <-[Call]- String.qMaskAndReplace() <- ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=6] = MatchResult.qResolveReplacementGroup() <-[Call]- String.qMaskAndReplace() <-[ ... laceAndUnmask() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private fun MatchResult.qResolveReplacementGroup(replacement: String, orgText: String): String { var resolveGroup = replacement @@ -2868,20 +2831,20 @@ private fun MatchResult.qResolveReplacementGroup(replacement: String, orgText: S return resolveGroup } -// CallChain[size=13] = CharSequence.qReplace() <-[Call]- MatchResult.qResolveReplacementGroup() <-[ ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=7] = CharSequence.qReplace() <-[Call]- MatchResult.qResolveReplacementGroup() <-[C ... laceAndUnmask() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private fun CharSequence.qReplace(oldValue: String, newValue: String, escapeChar: Char): String { return replace(Regex("""(? 1 - // \n[\n] --> 2 + // [\n]abc\n --> lineNumber is 1 "First Line" + // \n[\n] --> lineNumber is 2 "Second Line" var lineBreakCount = 0 @@ -2988,7 +2953,7 @@ private open class QCharReader(val text: CharSequence) { return lineBreakCount + 1 } - // CallChain[size=18] = QCharReader.countIndentSpaces() <-[Propag]- QCharReader <-[Call]- QSequenceR ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=13] = QCharReader.countIndentSpaces() <-[Propag]- QCharReader <-[Call]- QSequenceR ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] fun countIndentSpaces(space: Char = ' '): Int { var count = 0 @@ -3025,56 +2990,74 @@ private open class QCharReader(val text: CharSequence) { return count } - // CallChain[size=18] = QCharReader.hasNextChar() <-[Propag]- QCharReader <-[Call]- QSequenceReader ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=13] = QCharReader.hasNextChar() <-[Propag]- QCharReader <-[Call]- QSequenceReader ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] inline fun hasNextChar(len: Int = 1): Boolean { return offset + len - 1 < text.length } - // CallChain[size=18] = QCharReader.isOffsetEOF() <-[Propag]- QCharReader <-[Call]- QSequenceReader ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=13] = QCharReader.isOffsetEOF() <-[Propag]- QCharReader <-[Call]- QSequenceReader ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] inline fun isOffsetEOF(): Boolean { return offset == text.length - 1 } - // CallChain[size=18] = QCharReader.isValidOffset() <-[Propag]- QCharReader <-[Call]- QSequenceReade ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=13] = QCharReader.isValidOffset() <-[Propag]- QCharReader <-[Call]- QSequenceReade ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] inline fun isValidOffset(): Boolean { return 0 <= offset && offset < text.length } - // CallChain[size=18] = QCharReader.hasPreviousChar() <-[Propag]- QCharReader <-[Call]- QSequenceRea ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=13] = QCharReader.hasPreviousChar() <-[Propag]- QCharReader <-[Call]- QSequenceRea ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] inline fun hasPreviousChar(len: Int = 1): Boolean { return 0 < offset - len + 1 } - // CallChain[size=18] = QCharReader.previousChar() <-[Propag]- QCharReader <-[Call]- QSequenceReader ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] - inline fun previousChar(len: Int = 1) { + // CallChain[size=13] = QCharReader.previousChar() <-[Propag]- QCharReader <-[Call]- QSequenceReader ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + inline fun previousChar(len: Int = 1): Char { offset -= len + return text[offset] } - // CallChain[size=18] = QCharReader.currentChar() <-[Propag]- QCharReader <-[Call]- QSequenceReader ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=13] = QCharReader.currentChar() <-[Propag]- QCharReader <-[Call]- QSequenceReader ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] inline fun currentChar(): Char { return text[offset] } - // CallChain[size=18] = QCharReader.peekNextChar() <-[Propag]- QCharReader <-[Call]- QSequenceReader ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] - fun peekNextChar(): Char { + // CallChain[size=13] = QCharReader.peekNextChar() <-[Propag]- QCharReader <-[Call]- QSequenceReader ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + inline fun peekNextChar(): Char { return text[offset] } - // CallChain[size=18] = QCharReader.moveOffset() <-[Propag]- QCharReader <-[Call]- QSequenceReader < ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=13] = QCharReader.moveOffset() <-[Propag]- QCharReader <-[Call]- QSequenceReader < ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] inline fun moveOffset(plus: Int = 1) { offset += plus } - // CallChain[size=18] = QCharReader.nextChar() <-[Propag]- QCharReader <-[Call]- QSequenceReader <-[ ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=13] = QCharReader.nextChar() <-[Propag]- QCharReader <-[Call]- QSequenceReader <-[ ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] /** * Read current offset char and add offset by 1. */ inline fun nextChar(): Char { return text[offset++] } + + // CallChain[size=13] = QCharReader.nextStringExcludingCurOffset() <-[Propag]- QCharReader <-[Call]- ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + fun nextStringExcludingCurOffset(length: Int): String { + val str = text.substring(offset + 1, (offset + 1 + length).coerceAtMost(text.length)) + offset += length + return str + } + + // CallChain[size=13] = QCharReader.peekNextStringIncludingCurOffset() <-[Propag]- QCharReader <-[Ca ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + fun peekNextStringIncludingCurOffset(length: Int): String { + return text.substring(offset, (offset + length).coerceAtMost(text.length)) + } + + // CallChain[size=13] = QCharReader.peekPreviousStringExcludingCurOffset() <-[Propag]- QCharReader < ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + fun peekPreviousStringExcludingCurOffset(length: Int): String { + return text.substring(offset - length, offset) + } } -// CallChain[size=15] = QBetween <-[Call]- String.qFindBetween() <-[Call]- QMaskBetween.applyMore() ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=10] = QBetween <-[Call]- String.qFindBetween() <-[Call]- QMaskBetween.applyMore() ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private class QBetween( val startSequence: String, val endSequence: String, @@ -3089,7 +3072,7 @@ private class QBetween( val regionIncludeStartAndEndSequence: Boolean = false, ) { - // CallChain[size=15] = QBetween.find() <-[Call]- String.qFindBetween() <-[Call]- QMaskBetween.apply ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=10] = QBetween.find() <-[Call]- String.qFindBetween() <-[Call]- QMaskBetween.apply ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] fun find(text: CharSequence): List { val reader = QSequenceReader(text) @@ -3148,7 +3131,7 @@ private class QBetween( } } -// CallChain[size=14] = qNow <-[Call]- qCacheItTimedThreadLocal() <-[Call]- qCacheItOneSecThreadLoca ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=9] = qNow <-[Call]- qCacheItTimedThreadLocal() <-[Call]- qCacheItOneSecThreadLocal ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private val qNow: Long get() = System.currentTimeMillis() diff --git a/src-split/nyab/conf/QMyException.kt b/src-split/nyab/conf/QMyException.kt index 566b274..9ddda1d 100644 --- a/src-split/nyab/conf/QMyException.kt +++ b/src-split/nyab/conf/QMyException.kt @@ -23,9 +23,9 @@ internal enum class QMyException { // CallChain[size=10] = QMyException.Unreachable <-[Call]- qUnreachable() <-[Call]- QFetchRule.SINGL ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] Unreachable, - // CallChain[size=11] = QMyException.ShouldNotBeNull <-[Call]- T?.qaNotNull() <-[Call]- qSrcFileAtFr ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=11] = QMyException.ShouldNotBeNull <-[Call]- T.qaNotNull() <-[Call]- qSrcFileAtFra ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] ShouldNotBeNull, - // CallChain[size=6] = QMyException.ShouldNotBeZero <-[Call]- Int?.qaNotZero() <-[Call]- CharSequence.qMask() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=6] = QMyException.ShouldNotBeZero <-[Call]- Int.qaNotZero() <-[Call]- CharSequence.qMask() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] ShouldNotBeZero, // CallChain[size=9] = QMyException.ShouldBeEvenNumber <-[Call]- qBrackets() <-[Call]- qMySrcLinesAt ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] ShouldBeEvenNumber, @@ -38,23 +38,19 @@ internal enum class QMyException { // CallChain[size=2] = QMyException.CycleDetected <-[Call]- N.depthFirst()[Root] CycleDetected; - companion object { - // Required to implement extended functions. + +} - // CallChain[size=4] = QMyException.STACK_FRAME_FILTER <-[Call]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] - val STACK_FRAME_FILTER: (StackWalker.StackFrame) -> Boolean = { - !it.className.startsWith("org.gradle") && - !it.className.startsWith("org.testng") && - !it.className.startsWith("worker.org.gradle") && - !it.methodName.endsWith("\$default") && it.fileName != null && +// CallChain[size=4] = qSTACK_FRAME_FILTER <-[Call]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +internal val qSTACK_FRAME_FILTER: (StackWalker.StackFrame) -> Boolean = { + !it.className.startsWith("org.gradle") && + !it.className.startsWith("org.testng") && + !it.className.startsWith("worker.org.gradle") && + !it.methodName.endsWith("\$default") && it.fileName != null && // && !it.className.startsWith(QException::class.qualifiedName!!) // && it.methodName != "invokeSuspend" - it.declaringClass != null + it.declaringClass != null // && it.declaringClass.canonicalName != null // && !it.declaringClass.canonicalName.startsWith("kotlin.coroutines.jvm.internal.") // && !it.declaringClass.canonicalName.startsWith("kotlinx.coroutines") - } - - - } } \ No newline at end of file diff --git a/src-split/nyab/conf/QMyLog.kt b/src-split/nyab/conf/QMyLog.kt index 3e6b1fc..309df29 100644 --- a/src-split/nyab/conf/QMyLog.kt +++ b/src-split/nyab/conf/QMyLog.kt @@ -23,6 +23,6 @@ internal object QMyLog { */ val out: QOut = QOut.CONSOLE - // CallChain[size=4] = QMyLog.no_format <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=4] = QMyLog.no_format <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] var no_format: Boolean = false } \ No newline at end of file diff --git a/src-split/nyab/conf/QMyMark.kt b/src-split/nyab/conf/QMyMark.kt index 92402d4..568a7c3 100644 --- a/src-split/nyab/conf/QMyMark.kt +++ b/src-split/nyab/conf/QMyMark.kt @@ -16,8 +16,9 @@ import nyab.util.yellow // This is a split-file version of the library, this file is not self-contained. // CallChain[size=4] = QMyMark <-[Ref]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +@Suppress("MayBeConstant") internal object QMyMark { - // CallChain[size=4] = QMyMark.WARN <-[Call]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] - val WARN = "⚠".yellow + // CallChain[size=4] = QMyMark.warn <-[Call]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + val warn = "⚠".yellow } \ No newline at end of file diff --git a/src-split/nyab/conf/QMyToString.kt b/src-split/nyab/conf/QMyToString.kt index ea9e397..2a76b95 100644 --- a/src-split/nyab/conf/QMyToString.kt +++ b/src-split/nyab/conf/QMyToString.kt @@ -13,7 +13,7 @@ package nyab.conf // qq-tree is a self-contained single-file library created by nyabkun. // This is a split-file version of the library, this file is not self-contained. -// CallChain[size=6] = QMyToString <-[Call]- qToStringRegistry <-[Call]- Any?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=6] = QMyToString <-[Call]- qToStringRegistry <-[Call]- Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] internal object QMyToString { } \ No newline at end of file diff --git a/src-split/nyab/match/QMFunc.kt b/src-split/nyab/match/QMFunc.kt index 6d63a58..657f081 100644 --- a/src-split/nyab/match/QMFunc.kt +++ b/src-split/nyab/match/QMFunc.kt @@ -19,10 +19,10 @@ import nyab.util.QFlagEnum // qq-tree is a self-contained single-file library created by nyabkun. // This is a split-file version of the library, this file is not self-contained. -// CallChain[size=7] = qAnd() <-[Call]- QMFunc.and() <-[Call]- qToStringRegistry <-[Call]- Any?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=7] = qAnd() <-[Call]- QMFunc.and() <-[Call]- qToStringRegistry <-[Call]- Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private fun qAnd(vararg matches: QMFunc): QMFunc = QMatchFuncAnd(*matches) -// CallChain[size=6] = QMFunc.and() <-[Call]- qToStringRegistry <-[Call]- Any?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=6] = QMFunc.and() <-[Call]- qToStringRegistry <-[Call]- Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] internal infix fun QMFunc.and(match: QMFunc): QMFunc { return if (this is QMatchFuncAnd) { QMatchFuncAnd(*matchList, match) @@ -31,91 +31,91 @@ internal infix fun QMFunc.and(match: QMFunc): QMFunc { } } -// CallChain[size=8] = QMatchFuncAny <-[Call]- QMFunc.isAny() <-[Propag]- QMFunc.IncludeExtensionsIn ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=8] = QMatchFuncAny <-[Call]- QMFunc.isAny() <-[Propag]- QMFunc.IncludeExtensionsIn ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private object QMatchFuncAny : QMFuncA() { - // CallChain[size=9] = QMatchFuncAny.matches() <-[Propag]- QMatchFuncAny <-[Call]- QMFunc.isAny() <- ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=9] = QMatchFuncAny.matches() <-[Propag]- QMatchFuncAny <-[Call]- QMFunc.isAny() <- ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] override fun matches(value: KFunction<*>): Boolean { return true } } -// CallChain[size=8] = QMatchFuncNone <-[Call]- QMFunc.isNone() <-[Propag]- QMFunc.IncludeExtensions ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=8] = QMatchFuncNone <-[Call]- QMFunc.isNone() <-[Propag]- QMFunc.IncludeExtensions ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private object QMatchFuncNone : QMFuncA() { - // CallChain[size=9] = QMatchFuncNone.matches() <-[Propag]- QMatchFuncNone <-[Call]- QMFunc.isNone() ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=9] = QMatchFuncNone.matches() <-[Propag]- QMatchFuncNone <-[Call]- QMFunc.isNone() ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] override fun matches(value: KFunction<*>): Boolean { return false } } -// CallChain[size=7] = QMatchFuncDeclaredOnly <-[Call]- QMFunc.DeclaredOnly <-[Call]- qToStringRegis ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=7] = QMatchFuncDeclaredOnly <-[Call]- QMFunc.DeclaredOnly <-[Call]- qToStringRegis ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private object QMatchFuncDeclaredOnly : QMFuncA() { - // CallChain[size=8] = QMatchFuncDeclaredOnly.declaredOnly <-[Propag]- QMatchFuncDeclaredOnly <-[Cal ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=8] = QMatchFuncDeclaredOnly.declaredOnly <-[Propag]- QMatchFuncDeclaredOnly <-[Cal ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] override val declaredOnly = true - // CallChain[size=8] = QMatchFuncDeclaredOnly.matches() <-[Propag]- QMatchFuncDeclaredOnly <-[Call]- ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=8] = QMatchFuncDeclaredOnly.matches() <-[Propag]- QMatchFuncDeclaredOnly <-[Call]- ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] override fun matches(value: KFunction<*>): Boolean { return true } } -// CallChain[size=7] = QMatchFuncIncludeExtensionsInClass <-[Call]- QMFunc.IncludeExtensionsInClass ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=7] = QMatchFuncIncludeExtensionsInClass <-[Call]- QMFunc.IncludeExtensionsInClass ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private object QMatchFuncIncludeExtensionsInClass : QMFuncA() { - // CallChain[size=8] = QMatchFuncIncludeExtensionsInClass.includeExtensionsInClass <-[Propag]- QMatc ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=8] = QMatchFuncIncludeExtensionsInClass.includeExtensionsInClass <-[Propag]- QMatc ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] override val includeExtensionsInClass = true - // CallChain[size=8] = QMatchFuncIncludeExtensionsInClass.matches() <-[Propag]- QMatchFuncIncludeExt ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=8] = QMatchFuncIncludeExtensionsInClass.matches() <-[Propag]- QMatchFuncIncludeExt ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] override fun matches(value: KFunction<*>): Boolean { return true } } -// CallChain[size=7] = QMatchFuncAnd <-[Ref]- QMFunc.and() <-[Call]- qToStringRegistry <-[Call]- Any?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=7] = QMatchFuncAnd <-[Ref]- QMFunc.and() <-[Call]- qToStringRegistry <-[Call]- Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private class QMatchFuncAnd(vararg match: QMFunc) : QMFuncA() { - // CallChain[size=7] = QMatchFuncAnd.matchList <-[Call]- QMFunc.and() <-[Call]- qToStringRegistry <- ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=7] = QMatchFuncAnd.matchList <-[Call]- QMFunc.and() <-[Call]- qToStringRegistry <- ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] val matchList = match - // CallChain[size=8] = QMatchFuncAnd.declaredOnly <-[Propag]- QMatchFuncAnd.matchList <-[Call]- QMFu ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=8] = QMatchFuncAnd.declaredOnly <-[Propag]- QMatchFuncAnd.matchList <-[Call]- QMFu ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] override val declaredOnly = matchList.any { it.declaredOnly } - // CallChain[size=8] = QMatchFuncAnd.includeExtensionsInClass <-[Propag]- QMatchFuncAnd.matchList <- ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=8] = QMatchFuncAnd.includeExtensionsInClass <-[Propag]- QMatchFuncAnd.matchList <- ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] override val includeExtensionsInClass: Boolean = matchList.any { it.includeExtensionsInClass } - // CallChain[size=8] = QMatchFuncAnd.matches() <-[Propag]- QMatchFuncAnd.matchList <-[Call]- QMFunc. ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=8] = QMatchFuncAnd.matches() <-[Propag]- QMatchFuncAnd.matchList <-[Call]- QMFunc. ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] override fun matches(value: KFunction<*>): Boolean { return matchList.all { it.matches(value) } } } -// CallChain[size=9] = QMFuncA <-[Call]- QMatchFuncNone <-[Call]- QMFunc.isNone() <-[Propag]- QMFunc ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=9] = QMFuncA <-[Call]- QMatchFuncNone <-[Call]- QMFunc.isNone() <-[Propag]- QMFunc ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private abstract class QMFuncA : QMFunc { - // CallChain[size=10] = QMFuncA.declaredOnly <-[Propag]- QMFuncA <-[Call]- QMatchFuncNone <-[Call]- ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=10] = QMFuncA.declaredOnly <-[Propag]- QMFuncA <-[Call]- QMatchFuncNone <-[Call]- ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] override val declaredOnly: Boolean = false - // CallChain[size=10] = QMFuncA.includeExtensionsInClass <-[Propag]- QMFuncA <-[Call]- QMatchFuncNon ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=10] = QMFuncA.includeExtensionsInClass <-[Propag]- QMFuncA <-[Call]- QMatchFuncNon ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] override val includeExtensionsInClass: Boolean = false } -// CallChain[size=7] = QMFunc <-[Ref]- QMFunc.IncludeExtensionsInClass <-[Call]- qToStringRegistry < ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=7] = QMFunc <-[Ref]- QMFunc.IncludeExtensionsInClass <-[Call]- qToStringRegistry < ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] internal interface QMFunc { - // CallChain[size=7] = QMFunc.declaredOnly <-[Propag]- QMFunc.IncludeExtensionsInClass <-[Call]- qTo ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=7] = QMFunc.declaredOnly <-[Propag]- QMFunc.IncludeExtensionsInClass <-[Call]- qTo ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] val declaredOnly: Boolean - // CallChain[size=7] = QMFunc.includeExtensionsInClass <-[Propag]- QMFunc.IncludeExtensionsInClass < ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=7] = QMFunc.includeExtensionsInClass <-[Propag]- QMFunc.IncludeExtensionsInClass < ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] val includeExtensionsInClass: Boolean - // CallChain[size=7] = QMFunc.matches() <-[Propag]- QMFunc.IncludeExtensionsInClass <-[Call]- qToStr ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=7] = QMFunc.matches() <-[Propag]- QMFunc.IncludeExtensionsInClass <-[Call]- qToStr ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] fun matches(value: KFunction<*>): Boolean - // CallChain[size=7] = QMFunc.isAny() <-[Propag]- QMFunc.IncludeExtensionsInClass <-[Call]- qToStrin ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=7] = QMFunc.isAny() <-[Propag]- QMFunc.IncludeExtensionsInClass <-[Call]- qToStrin ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] fun isAny(): Boolean = this == QMatchFuncAny - // CallChain[size=7] = QMFunc.isNone() <-[Propag]- QMFunc.IncludeExtensionsInClass <-[Call]- qToStri ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=7] = QMFunc.isNone() <-[Propag]- QMFunc.IncludeExtensionsInClass <-[Call]- qToStri ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] fun isNone(): Boolean = this == QMatchFuncNone companion object { - // CallChain[size=6] = QMFunc.DeclaredOnly <-[Call]- qToStringRegistry <-[Call]- Any?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=6] = QMFunc.DeclaredOnly <-[Call]- qToStringRegistry <-[Call]- Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] val DeclaredOnly: QMFunc = QMatchFuncDeclaredOnly - // CallChain[size=6] = QMFunc.IncludeExtensionsInClass <-[Call]- qToStringRegistry <-[Call]- Any?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=6] = QMFunc.IncludeExtensionsInClass <-[Call]- qToStringRegistry <-[Call]- Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] // TODO OnlyExtensionsInClass val IncludeExtensionsInClass: QMFunc = QMatchFuncIncludeExtensionsInClass @@ -124,7 +124,7 @@ internal interface QMFunc { // TODO vararg, nullability, param names, type parameter // TODO handle createType() more carefully - // CallChain[size=6] = QMFunc.nameExact() <-[Call]- qToStringRegistry <-[Call]- Any?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=6] = QMFunc.nameExact() <-[Call]- qToStringRegistry <-[Call]- Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] fun nameExact(text: String, ignoreCase: Boolean = false): QMFunc { return QMatchFuncName(QM.exact(text, ignoreCase = ignoreCase)) } @@ -133,14 +133,14 @@ internal interface QMFunc { } } -// CallChain[size=7] = QMatchFuncName <-[Call]- QMFunc.nameExact() <-[Call]- qToStringRegistry <-[Ca ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=7] = QMatchFuncName <-[Call]- QMFunc.nameExact() <-[Call]- qToStringRegistry <-[Ca ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private class QMatchFuncName(val nameMatcher: QM) : QMFuncA() { - // CallChain[size=8] = QMatchFuncName.matches() <-[Propag]- QMatchFuncName <-[Call]- QMFunc.nameExac ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=8] = QMatchFuncName.matches() <-[Propag]- QMatchFuncName <-[Call]- QMFunc.nameExac ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] override fun matches(value: KFunction<*>): Boolean { return nameMatcher.matches(value.name) } - // CallChain[size=8] = QMatchFuncName.toString() <-[Propag]- QMatchFuncName <-[Call]- QMFunc.nameExa ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=8] = QMatchFuncName.toString() <-[Propag]- QMatchFuncName <-[Call]- QMFunc.nameExa ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] override fun toString(): String { return this::class.simpleName + ":" + nameMatcher.toString() } diff --git a/src-split/nyab/util/QCache.kt b/src-split/nyab/util/QCache.kt index 53d2837..c14363e 100644 --- a/src-split/nyab/util/QCache.kt +++ b/src-split/nyab/util/QCache.kt @@ -20,10 +20,10 @@ import nyab.match.QM // qq-tree is a self-contained single-file library created by nyabkun. // This is a split-file version of the library, this file is not self-contained. -// CallChain[size=16] = qDEFAULT_CACHE_IT_EXPIRATION_CHECK_INTERVAL <-[Call]- QCacheMap.QCacheMap() ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=11] = qDEFAULT_CACHE_IT_EXPIRATION_CHECK_INTERVAL <-[Call]- QCacheMap.QCacheMap() ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] internal const val qDEFAULT_CACHE_IT_EXPIRATION_CHECK_INTERVAL = 1000L -// CallChain[size=14] = qThreadLocalCache <-[Call]- qCacheItTimedThreadLocal() <-[Call]- qCacheItOne ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=9] = qThreadLocalCache <-[Call]- qCacheItTimedThreadLocal() <-[Call]- qCacheItOneS ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private val qThreadLocalCache: ThreadLocal by lazy { ThreadLocal.withInitial { QCacheMap( @@ -42,34 +42,34 @@ internal fun qCacheItOneSec(key: K, block: () -> V): V = qCa internal fun qCacheItTimed(key: K, duration: Long, block: () -> V): V = qCacheThreadSafe.getOrPut(key) { QCacheEntry(block(), duration, qNow) }.value as V -// CallChain[size=12] = qCacheItOneSecThreadLocal() <-[Call]- qRe() <-[Call]- String.qReplaceFirstIf ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=7] = qCacheItOneSecThreadLocal() <-[Call]- qRe() <-[Call]- QException.mySrcAndStac ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] internal fun qCacheItOneSecThreadLocal(key: K, block: () -> V): V = qCacheItTimedThreadLocal(key, 1000L, block) -// CallChain[size=13] = qCacheItTimedThreadLocal() <-[Call]- qCacheItOneSecThreadLocal() <-[Call]- q ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=8] = qCacheItTimedThreadLocal() <-[Call]- qCacheItOneSecThreadLocal() <-[Call]- qR ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] internal fun qCacheItTimedThreadLocal(key: K, duration: Long, block: () -> V): V = qThreadLocalCache.get().getOrPut(key) { QCacheEntry(block(), duration, qNow) }.value as V -// CallChain[size=15] = QCacheMap <-[Ref]- qThreadLocalCache <-[Call]- qCacheItTimedThreadLocal() <- ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=10] = QCacheMap <-[Ref]- qThreadLocalCache <-[Call]- qCacheItTimedThreadLocal() <- ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] internal class QCacheMap( val expirationCheckInterval: Long = qDEFAULT_CACHE_IT_EXPIRATION_CHECK_INTERVAL, val threadSafe: Boolean = false ) { - // CallChain[size=15] = QCacheMap.lastCheck <-[Call]- QCacheMap.getOrPut() <-[Call]- qCacheItTimedTh ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=10] = QCacheMap.lastCheck <-[Call]- QCacheMap.getOrPut() <-[Call]- qCacheItTimedTh ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] var lastCheck: Long = -1 - // CallChain[size=15] = QCacheMap.lock <-[Call]- QCacheMap.getOrPut() <-[Call]- qCacheItTimedThreadL ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=10] = QCacheMap.lock <-[Call]- QCacheMap.getOrPut() <-[Call]- qCacheItTimedThreadL ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] val lock: ReentrantLock = ReentrantLock() - // CallChain[size=15] = QCacheMap.map <-[Call]- QCacheMap.getOrPut() <-[Call]- qCacheItTimedThreadLo ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=10] = QCacheMap.map <-[Call]- QCacheMap.getOrPut() <-[Call]- qCacheItTimedThreadLo ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] val map: MutableMap = mutableMapOf() - // CallChain[size=15] = QCacheMap.clearExpired() <-[Call]- QCacheMap.getOrPut() <-[Call]- qCacheItTi ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=10] = QCacheMap.clearExpired() <-[Call]- QCacheMap.getOrPut() <-[Call]- qCacheItTi ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] fun clearExpired(): Int = lock.qWithLock(threadSafe) { val toRemove = map.filterValues { it.isExpired() } toRemove.forEach { map.remove(it.key) } return toRemove.count() } - // CallChain[size=14] = QCacheMap.getOrPut() <-[Call]- qCacheItTimedThreadLocal() <-[Call]- qCacheIt ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=9] = QCacheMap.getOrPut() <-[Call]- qCacheItTimedThreadLocal() <-[Call]- qCacheItO ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] fun getOrPut(key: Any, defaultValue: () -> QCacheEntry): QCacheEntry = lock.qWithLock(threadSafe) { val now = qNow if (now - lastCheck > expirationCheckInterval) { @@ -81,8 +81,8 @@ internal class QCacheMap( } } -// CallChain[size=14] = QCacheEntry <-[Call]- qCacheItTimedThreadLocal() <-[Call]- qCacheItOneSecThr ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=9] = QCacheEntry <-[Call]- qCacheItTimedThreadLocal() <-[Call]- qCacheItOneSecThre ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] internal data class QCacheEntry(val value: Any?, val duration: Long, val creationTime: Long = qNow) { - // CallChain[size=16] = QCacheEntry.isExpired() <-[Call]- QCacheMap.clearExpired() <-[Call]- QCacheM ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=11] = QCacheEntry.isExpired() <-[Call]- QCacheMap.clearExpired() <-[Call]- QCacheM ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] fun isExpired() = (qNow - creationTime) > duration } \ No newline at end of file diff --git a/src-split/nyab/util/QConcurrent.kt b/src-split/nyab/util/QConcurrent.kt index fc32feb..973c4a3 100644 --- a/src-split/nyab/util/QConcurrent.kt +++ b/src-split/nyab/util/QConcurrent.kt @@ -16,7 +16,7 @@ import kotlin.concurrent.withLock // qq-tree is a self-contained single-file library created by nyabkun. // This is a split-file version of the library, this file is not self-contained. -// CallChain[size=15] = Lock.qWithLock() <-[Call]- QCacheMap.getOrPut() <-[Call]- qCacheItTimedThrea ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=10] = Lock.qWithLock() <-[Call]- QCacheMap.getOrPut() <-[Call]- qCacheItTimedThrea ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] internal inline fun Lock.qWithLock(threadSafe: Boolean, block: () -> T): T { return if (threadSafe) { withLock(block) diff --git a/src-split/nyab/util/QException.kt b/src-split/nyab/util/QException.kt index 8a8bfbd..3b051f8 100644 --- a/src-split/nyab/util/QException.kt +++ b/src-split/nyab/util/QException.kt @@ -14,12 +14,12 @@ package nyab.util import java.io.PrintStream import java.nio.file.Path -import java.util.* import kotlin.io.path.absolutePathString import kotlin.io.path.isDirectory import kotlin.io.path.isRegularFile import nyab.conf.QE import nyab.conf.QMyMark +import nyab.conf.qSTACK_FRAME_FILTER import nyab.match.QM // qq-tree is a self-contained single-file library created by nyabkun. @@ -56,11 +56,11 @@ internal fun qUnreachable(msg: Any? = ""): Nothing { // CallChain[size=3] = QException <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] internal class QException( val type: QE = QE.Other, - msg: String = QMyMark.WARN, + msg: String = QMyMark.warn, e: Throwable? = null, val stackDepth: Int = 0, stackSize: Int = 20, - stackFilter: (StackWalker.StackFrame) -> Boolean = QE.STACK_FRAME_FILTER, + stackFilter: (StackWalker.StackFrame) -> Boolean = qSTACK_FRAME_FILTER, private val srcCut: QSrcCut = QSrcCut.MULTILINE_NOCUT, ) : RuntimeException(msg, e) { @@ -75,7 +75,7 @@ internal class QException( // CallChain[size=5] = QException.mySrcAndStack <-[Call]- QException.printStackTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] val mySrcAndStack: String by lazy { qLogStackFrames(frames = stackFrames, style = QLogStyle.SRC_AND_STACK, srcCut = srcCut, quiet = true) - .qColorTarget(qRe("""\sshould[a-zA-Z]+"""), QShColor.LIGHT_YELLOW) + .qColorTarget(qRe("""\sshould[a-zA-Z]+"""), QShColor.LightYellow) } // CallChain[size=4] = QException.getStackTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] @@ -106,7 +106,7 @@ internal class QException( } } -// CallChain[size=10] = T?.qaNotNull() <-[Call]- qSrcFileAtFrame() <-[Call]- qSrcFileLinesAtFrame() ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=10] = T.qaNotNull() <-[Call]- qSrcFileAtFrame() <-[Call]- qSrcFileLinesAtFrame() < ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] internal fun T?.qaNotNull(exceptionType: QE = QE.ShouldNotBeNull, msg: Any? = ""): T { if (this != null) { return this @@ -115,7 +115,7 @@ internal fun T?.qaNotNull(exceptionType: QE = QE.ShouldNotBeNull, msg: } } -// CallChain[size=5] = Int?.qaNotZero() <-[Call]- CharSequence.qMask() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=5] = Int.qaNotZero() <-[Call]- CharSequence.qMask() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] internal fun Int?.qaNotZero(exceptionType: QE = QE.ShouldNotBeZero, msg: Any? = ""): Int { if (this == null) { QE.ShouldNotBeNull.throwIt(stackDepth = 1, msg = msg) diff --git a/src-split/nyab/util/QExtraProp.kt b/src-split/nyab/util/QExtraProp.kt index a4684d3..acb56ae 100644 --- a/src-split/nyab/util/QExtraProp.kt +++ b/src-split/nyab/util/QExtraProp.kt @@ -18,34 +18,34 @@ import java.nio.file.Path // qq-tree is a self-contained single-file library created by nyabkun. // This is a split-file version of the library, this file is not self-contained. -// CallChain[size=3] = QExProps <-[Call]- Any.qSetExProp() <-[Call]- parent[Root] +// CallChain[size=3] = QExProps <-[Call]- Any.qSetExProp() <-[Call]- N.parent[Root] /** * Minimal Version of IdentityWeakHashMap. */ private object QExProps { - // CallChain[size=4] = QExProps.map <-[Call]- QExProps.put() <-[Call]- Any.qSetExProp() <-[Call]- parent[Root] + // CallChain[size=4] = QExProps.map <-[Call]- QExProps.put() <-[Call]- Any.qSetExProp() <-[Call]- N.parent[Root] val map: MutableMap> = HashMap() - // CallChain[size=4] = QExProps.removeGarbageCollectedEntries() <-[Call]- QExProps.put() <-[Call]- Any.qSetExProp() <-[Call]- parent[Root] + // CallChain[size=4] = QExProps.removeGarbageCollectedEntries() <-[Call]- QExProps.put() <-[Call]- Any.qSetExProp() <-[Call]- N.parent[Root] fun removeGarbageCollectedEntries() { map.keys.removeIf { it.get() == null } } - // CallChain[size=3] = QExProps.get() <-[Call]- Any.qSetExProp() <-[Call]- parent[Root] + // CallChain[size=3] = QExProps.get() <-[Call]- Any.qSetExProp() <-[Call]- N.parent[Root] fun get(key: Any): HashMap? { removeGarbageCollectedEntries() return map[WeakKey(key)] } - // CallChain[size=3] = QExProps.put() <-[Call]- Any.qSetExProp() <-[Call]- parent[Root] + // CallChain[size=3] = QExProps.put() <-[Call]- Any.qSetExProp() <-[Call]- N.parent[Root] fun put(key: Any, value: HashMap) { removeGarbageCollectedEntries() map[WeakKey(key)] = value } - // CallChain[size=4] = QExProps.WeakKey <-[Call]- QExProps.put() <-[Call]- Any.qSetExProp() <-[Call]- parent[Root] + // CallChain[size=4] = QExProps.WeakKey <-[Call]- QExProps.put() <-[Call]- Any.qSetExProp() <-[Call]- N.parent[Root] class WeakKey(key: Any) : WeakReference(key) { val hash = System.identityHashCode(key) @@ -61,7 +61,7 @@ private object QExProps { } } -// CallChain[size=2] = Any.qSetExProp() <-[Call]- parent[Root] +// CallChain[size=2] = Any.qSetExProp() <-[Call]- N.parent[Root] internal fun Any.qSetExProp(key: String, value: Any?) = synchronized(QExProps) { var props = QExProps.get(this) if (props == null) { @@ -71,21 +71,21 @@ internal fun Any.qSetExProp(key: String, value: Any?) = synchronized(QExProps) { props[key] = value } -// CallChain[size=2] = Any.qGetExProp() <-[Call]- children[Root] +// CallChain[size=2] = Any.qGetExProp() <-[Call]- N.children[Root] internal fun Any.qGetExProp(key: String): Any? = synchronized(QExProps) { val props = QExProps.get(this) ?: return null return props[key] } -// CallChain[size=3] = Any.qGetExPropOrDefault() <-[Call]- Any.qGetExPropOrNull() <-[Call]- parent[Root] +// CallChain[size=3] = Any.qGetExPropOrDefault() <-[Call]- Any.qGetExPropOrNull() <-[Call]- N.parent[Root] internal fun Any.qGetExPropOrDefault(key: String, default: T): T = synchronized(QExProps) { val props = QExProps.get(this) ?: return default return props.getOrDefault(key, default) as T } -// CallChain[size=2] = Any.qGetExPropOrNull() <-[Call]- parent[Root] +// CallChain[size=2] = Any.qGetExPropOrNull() <-[Call]- N.parent[Root] internal fun Any.qGetExPropOrNull(key: String): Any? = synchronized(QExProps) { return qGetExPropOrDefault(key, null) } \ No newline at end of file diff --git a/src-split/nyab/util/QLog.kt b/src-split/nyab/util/QLog.kt index 21a5080..7653f40 100644 --- a/src-split/nyab/util/QLog.kt +++ b/src-split/nyab/util/QLog.kt @@ -61,9 +61,9 @@ internal class QLogStyle( if (!onlyIf.matches(this)) return this - return """${"SRC START ―――――――――――".qColor(QShColor.CYAN)} + return """${"SRC START ―――――――――――".qColor(QShColor.Cyan)} ${this.trim()} -${"SRC END ―――――――――――".qColor(QShColor.CYAN)}""" +${"SRC END ―――――――――――".qColor(QShColor.Cyan)}""" } // CallChain[size=8] = QLogStyle.qLogArrow() <-[Call]- QLogStyle.S <-[Call]- qLogStackFrames() <-[Ca ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] @@ -118,7 +118,7 @@ internal fun qMySrcLinesAtFrame( src2 } catch (e: Exception) { // e.message - "${QMyMark.WARN} Couldn't cut src lines : ${qBrackets("FileName", frame.fileName, "LineNo", frame.lineNumber, "SrcRoots", srcRoots)}" + "${QMyMark.warn} Couldn't cut src lines : ${qBrackets("FileName", frame.fileName, "LineNo", frame.lineNumber, "SrcRoots", srcRoots)}" } } @@ -160,12 +160,12 @@ internal fun qLogStackFrames( val text = style.start + output + style.end - val finalTxt = if (noColor) text.noColor else text + val finalTxt = if (noColor) text.noStyle else text if (!quiet) style.out.print(finalTxt) - return if (noColor) output.noColor else output + return if (noColor) output.noStyle else output } // CallChain[size=8] = qSrcFileLinesAtFrame() <-[Call]- qMySrcLinesAtFrame() <-[Call]- qLogStackFram ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] diff --git a/src-split/nyab/util/QOut.kt b/src-split/nyab/util/QOut.kt index a5084ae..66b7849 100644 --- a/src-split/nyab/util/QOut.kt +++ b/src-split/nyab/util/QOut.kt @@ -45,7 +45,7 @@ private class QConsole(override val isAcceptColoredText: Boolean) : QOut { if (isAcceptColoredText) { kotlin.io.print(msg.toString()) } else { - kotlin.io.print(msg.toString().noColor) + kotlin.io.print(msg.toString().noStyle) } } diff --git a/src-split/nyab/util/QReflection.kt b/src-split/nyab/util/QReflection.kt index c214530..a66b50b 100644 --- a/src-split/nyab/util/QReflection.kt +++ b/src-split/nyab/util/QReflection.kt @@ -31,6 +31,7 @@ import kotlin.reflect.jvm.isAccessible import kotlin.streams.asSequence import nyab.conf.QE import nyab.conf.QMyPath +import nyab.conf.qSTACK_FRAME_FILTER import nyab.match.QM import nyab.match.QMFunc import nyab.match.and @@ -38,7 +39,7 @@ import nyab.match.and // qq-tree is a self-contained single-file library created by nyabkun. // This is a split-file version of the library, this file is not self-contained. -// CallChain[size=6] = KClass<*>.qFunctions() <-[Call]- qToStringRegistry <-[Call]- Any?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=6] = KClass<*>.qFunctions() <-[Call]- qToStringRegistry <-[Call]- Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] internal fun KClass<*>.qFunctions(matcher: QMFunc = QMFunc.DeclaredOnly and QMFunc.IncludeExtensionsInClass): List> { val list = mutableListOf>() @@ -101,7 +102,7 @@ internal fun qSrcFileAtFrame(frame: StackFrame, srcRoots: List = QMyPath.s internal inline fun qStackFrames( stackDepth: Int = 0, size: Int = 1, - noinline filter: (StackFrame) -> Boolean = QE.STACK_FRAME_FILTER, + noinline filter: (StackFrame) -> Boolean = qSTACK_FRAME_FILTER, ): List { return StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE).walk { s: Stream -> s.asSequence().filter(filter).drop(stackDepth).take(size).toList() @@ -111,12 +112,12 @@ internal inline fun qStackFrames( // CallChain[size=9] = qStackFrame() <-[Call]- qSrcFileLinesAtFrame() <-[Call]- qMySrcLinesAtFrame() ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] internal inline fun qStackFrame( stackDepth: Int = 0, - noinline filter: (StackFrame) -> Boolean = QE.STACK_FRAME_FILTER, + noinline filter: (StackFrame) -> Boolean = qSTACK_FRAME_FILTER, ): StackFrame { return qStackFrames(stackDepth, 1, filter)[0] } -// CallChain[size=7] = KType.qToClass() <-[Call]- KType.qIsSuperclassOf() <-[Call]- qToStringRegistr ... y?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=7] = KType.qToClass() <-[Call]- KType.qIsSuperclassOf() <-[Call]- qToStringRegistr ... Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] internal fun KType.qToClass(): KClass<*>? { return if (this.classifier != null && this.classifier is KClass<*>) { this.classifier as KClass<*> @@ -125,7 +126,7 @@ internal fun KType.qToClass(): KClass<*>? { } } -// CallChain[size=6] = KType.qIsSuperclassOf() <-[Call]- qToStringRegistry <-[Call]- Any?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=6] = KType.qIsSuperclassOf() <-[Call]- qToStringRegistry <-[Call]- Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] internal fun KType.qIsSuperclassOf(cls: KClass<*>): Boolean { return try { val thisClass = qToClass() diff --git a/src-split/nyab/util/QRegex.kt b/src-split/nyab/util/QRegex.kt index 6e12088..ceaaf6e 100644 --- a/src-split/nyab/util/QRegex.kt +++ b/src-split/nyab/util/QRegex.kt @@ -15,28 +15,17 @@ import org.intellij.lang.annotations.Language // qq-tree is a self-contained single-file library created by nyabkun. // This is a split-file version of the library, this file is not self-contained. -// CallChain[size=11] = RO <-[Ref]- String.qReplaceFirstIfNonEmptyStringGroup() <-[Call]- String.qAp ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=7] = RO <-[Ref]- qRe() <-[Call]- QException.mySrcAndStack <-[Call]- QException.pri ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] internal typealias RO = RegexOption -// CallChain[size=11] = qRe() <-[Call]- String.qReplaceFirstIfNonEmptyStringGroup() <-[Call]- String ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=6] = qRe() <-[Call]- QException.mySrcAndStack <-[Call]- QException.printStackTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] internal fun qRe(@Language("RegExp") regex: String, vararg opts: RO): Regex { return qCacheItOneSecThreadLocal(regex + opts.contentToString()) { Regex(regex, setOf(*opts)) } } -// CallChain[size=10] = re <-[Call]- String.qApplyColorNestable() <-[Call]- String.qColorLine() <-[C ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=13] = @receiver:Language("RegExp") String.re <-[Call]- String.noStyle <-[Call]- QC ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] // https://youtrack.jetbrains.com/issue/KTIJ-5643 internal val @receiver:Language("RegExp") String.re: Regex - get() = qRe(this) - -// CallChain[size=10] = String.qReplaceFirstIfNonEmptyStringGroup() <-[Call]- String.qApplyColorNest ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] -internal fun String.qReplaceFirstIfNonEmptyStringGroup(@Language("RegExp") regex: String, nonEmptyGroupIdx: Int, replace: String = "$1", vararg opts: RO): String { - val re = qRe(regex, *opts) - - return if (re.find(this)?.groups?.get(nonEmptyGroupIdx)?.value?.isNotEmpty() == true) { - re.replaceFirst(this, replace) - } else { - this - } -} \ No newline at end of file + get() = qRe(this) \ No newline at end of file diff --git a/src-split/nyab/util/QShColor.kt b/src-split/nyab/util/QShColor.kt index 7ae41d7..81e946e 100644 --- a/src-split/nyab/util/QShColor.kt +++ b/src-split/nyab/util/QShColor.kt @@ -15,167 +15,155 @@ import kotlin.math.absoluteValue // qq-tree is a self-contained single-file library created by nyabkun. // This is a split-file version of the library, this file is not self-contained. -// CallChain[size=9] = qBG_JUMP <-[Call]- QShColor.bg <-[Propag]- QShColor.YELLOW <-[Call]- yellow < ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=9] = qBG_JUMP <-[Call]- QShColor.bg <-[Propag]- QShColor.Yellow <-[Call]- String.y ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private const val qBG_JUMP = 10 -// CallChain[size=9] = qSTART <-[Call]- QShColor.bg <-[Propag]- QShColor.YELLOW <-[Call]- yellow <-[ ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=9] = qSTART <-[Call]- QShColor.bg <-[Propag]- QShColor.Yellow <-[Call]- String.yel ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private const val qSTART = "\u001B[" -// CallChain[size=9] = qEND <-[Call]- String.qColorLine() <-[Call]- String.qColor() <-[Call]- yellow ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=10] = qEND <-[Call]- String.qApplyEscapeLine() <-[Call]- String.qApplyEscapeLine() ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private const val qEND = "${qSTART}0m" -// CallChain[size=10] = qMASK_COLORED <-[Call]- String.qApplyColorNestable() <-[Call]- String.qColor ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] -private val qMASK_COLORED by lazy { - QMaskBetween( - qSTART, - qEND, - qSTART, - escapeChar = '\\', - targetNestDepth = 1, - maskIncludeStartAndEndSequence = false - ) -} +// CallChain[size=10] = String.qApplyEscapeNestable() <-[Call]- String.qApplyEscapeLine() <-[Call]- ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +private fun String.qApplyEscapeNestable(start: String): String { + val lastEnd = this.endsWith(qEND) -// CallChain[size=9] = String.qApplyColorNestable() <-[Call]- String.qColorLine() <-[Call]- String.q ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] -private fun String.qApplyColorNestable(colorStart: String): String { - val re = "(?s)(\\Q$qEND\\E)(.+?)(\\Q$qSTART\\E|$)".re - val replace = "$1$colorStart$2$qEND$3" - val re2 = "^(?s)(.*?)(\\Q$qSTART\\E)" - val replace2 = "$colorStart$1$qEND$2" - - return this.qMaskAndReplace( - qMASK_COLORED, - re, - replace - ).qReplaceFirstIfNonEmptyStringGroup(re2, 1, replace2) + return if( lastEnd ) { + start + this.substring(0, this.length - 1).replace(qEND, qEND + start) + this[this.length - 1] + } else { + start + this.replace(qEND, qEND + start) + qEND + } } -// CallChain[size=7] = String.qColor() <-[Call]- yellow <-[Call]- QException.qToString() <-[Call]- Q ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=7] = String.qColor() <-[Call]- String.yellow <-[Call]- QException.qToString() <-[C ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] internal fun String.qColor(fg: QShColor? = null, bg: QShColor? = null, nestable: Boolean = this.contains(qSTART)): String { return if (this.qIsSingleLine()) { - this.qColorLine(fg, bg, nestable) + this.qApplyEscapeLine(fg, bg, nestable) } else { lineSequence().map { line -> - line.qColorLine(fg, bg, nestable) + line.qApplyEscapeLine(fg, bg, nestable) }.joinToString("\n") } } -// CallChain[size=8] = String.qColorLine() <-[Call]- String.qColor() <-[Call]- yellow <-[Call]- QExc ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] -private fun String.qColorLine( - fg: QShColor? = null, - bg: QShColor? = null, - nestable: Boolean = true, +// CallChain[size=8] = String.qApplyEscapeLine() <-[Call]- String.qColor() <-[Call]- String.yellow < ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +private fun String.qApplyEscapeLine(fg: QShColor?, bg: QShColor?, nestable: Boolean): String { + return this.qApplyEscapeLine( + listOfNotNull(fg?.fg, bg?.bg).toTypedArray(), + nestable + ) +} + +// CallChain[size=9] = String.qApplyEscapeLine() <-[Call]- String.qApplyEscapeLine() <-[Call]- Strin ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +private fun String.qApplyEscapeLine( + startSequences: Array, + nestable: Boolean ): String { val nest = nestable && this.contains(qEND) - val fgApplied = if (fg != null) { - val fgStart = fg.fg + var text = this - if (nest) { - this.qApplyColorNestable(fgStart) + for (start in startSequences) { + text = if (nest) { + text.qApplyEscapeNestable(start) } else { - "$fgStart$this$qEND" + "$start$text$qEND" } - } else { - this } - val bgApplied = if (bg != null) { - val bgStart = bg.bg - - if (nest) { - fgApplied.qApplyColorNestable(bgStart) - } else { - "$bgStart$fgApplied$qEND" - } - } else { - fgApplied - } - - return bgApplied + return text } -// CallChain[size=12] = noColor <-[Call]- QConsole.print() <-[Propag]- QConsole <-[Call]- QOut.CONSO ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] -internal val String.noColor: String - get() { - return this.replace("""\Q$qSTART\E\d{1,2}m""".re, "") - } - -// CallChain[size=7] = QShColor <-[Ref]- yellow <-[Call]- QException.qToString() <-[Call]- QException.toString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=7] = QShColor <-[Ref]- String.yellow <-[Call]- QException.qToString() <-[Call]- QE ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] enum class QShColor(val code: Int) { - // CallChain[size=8] = QShColor.BLACK <-[Propag]- QShColor.YELLOW <-[Call]- yellow <-[Call]- QExcept ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] - BLACK(30), - // CallChain[size=8] = QShColor.RED <-[Propag]- QShColor.YELLOW <-[Call]- yellow <-[Call]- QExceptio ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] - RED(31), - // CallChain[size=8] = QShColor.GREEN <-[Propag]- QShColor.YELLOW <-[Call]- yellow <-[Call]- QExcept ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] - GREEN(32), - // CallChain[size=7] = QShColor.YELLOW <-[Call]- yellow <-[Call]- QException.qToString() <-[Call]- Q ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] - YELLOW(33), - // CallChain[size=8] = QShColor.BLUE <-[Propag]- QShColor.YELLOW <-[Call]- yellow <-[Call]- QExcepti ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] - BLUE(34), - // CallChain[size=8] = QShColor.MAGENTA <-[Propag]- QShColor.YELLOW <-[Call]- yellow <-[Call]- QExce ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] - MAGENTA(35), - // CallChain[size=8] = QShColor.CYAN <-[Propag]- QShColor.YELLOW <-[Call]- yellow <-[Call]- QExcepti ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] - CYAN(36), - // CallChain[size=8] = QShColor.LIGHT_GRAY <-[Propag]- QShColor.YELLOW <-[Call]- yellow <-[Call]- QE ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] - LIGHT_GRAY(37), - - // CallChain[size=8] = QShColor.DARK_GRAY <-[Propag]- QShColor.YELLOW <-[Call]- yellow <-[Call]- QEx ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] - DARK_GRAY(90), - // CallChain[size=8] = QShColor.LIGHT_RED <-[Propag]- QShColor.YELLOW <-[Call]- yellow <-[Call]- QEx ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] - LIGHT_RED(91), - // CallChain[size=8] = QShColor.LIGHT_GREEN <-[Propag]- QShColor.YELLOW <-[Call]- yellow <-[Call]- Q ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] - LIGHT_GREEN(92), - // CallChain[size=8] = QShColor.LIGHT_YELLOW <-[Propag]- QShColor.YELLOW <-[Call]- yellow <-[Call]- ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] - LIGHT_YELLOW(93), - // CallChain[size=8] = QShColor.LIGHT_BLUE <-[Propag]- QShColor.YELLOW <-[Call]- yellow <-[Call]- QE ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] - LIGHT_BLUE(94), - // CallChain[size=8] = QShColor.LIGHT_MAGENTA <-[Propag]- QShColor.YELLOW <-[Call]- yellow <-[Call]- ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] - LIGHT_MAGENTA(95), - // CallChain[size=8] = QShColor.LIGHT_CYAN <-[Propag]- QShColor.YELLOW <-[Call]- yellow <-[Call]- QE ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] - LIGHT_CYAN(96), - // CallChain[size=8] = QShColor.WHITE <-[Propag]- QShColor.YELLOW <-[Call]- yellow <-[Call]- QExcept ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] - WHITE(97); - - // CallChain[size=8] = QShColor.fg <-[Propag]- QShColor.YELLOW <-[Call]- yellow <-[Call]- QException ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] - /** ANSI modifier string to apply the color to the text itself */ + // CallChain[size=8] = QShColor.Black <-[Propag]- QShColor.Yellow <-[Call]- String.yellow <-[Call]- ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + Black(30), + // CallChain[size=8] = QShColor.Red <-[Propag]- QShColor.Yellow <-[Call]- String.yellow <-[Call]- QE ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + Red(31), + // CallChain[size=8] = QShColor.Green <-[Propag]- QShColor.Yellow <-[Call]- String.yellow <-[Call]- ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + Green(32), + // CallChain[size=7] = QShColor.Yellow <-[Call]- String.yellow <-[Call]- QException.qToString() <-[C ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + Yellow(33), + // CallChain[size=8] = QShColor.Blue <-[Propag]- QShColor.Yellow <-[Call]- String.yellow <-[Call]- Q ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + Blue(34), + // CallChain[size=8] = QShColor.Purple <-[Propag]- QShColor.Yellow <-[Call]- String.yellow <-[Call]- ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + Purple(35), + // CallChain[size=8] = QShColor.Cyan <-[Propag]- QShColor.Yellow <-[Call]- String.yellow <-[Call]- Q ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + Cyan(36), + // CallChain[size=8] = QShColor.LightGray <-[Propag]- QShColor.Yellow <-[Call]- String.yellow <-[Cal ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + LightGray(37), + + // CallChain[size=8] = QShColor.DefaultFG <-[Propag]- QShColor.Yellow <-[Call]- String.yellow <-[Cal ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + DefaultFG(39), + // CallChain[size=8] = QShColor.DefaultBG <-[Propag]- QShColor.Yellow <-[Call]- String.yellow <-[Cal ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + DefaultBG(49), + + // CallChain[size=8] = QShColor.DarkGray <-[Propag]- QShColor.Yellow <-[Call]- String.yellow <-[Call ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + DarkGray(90), + // CallChain[size=8] = QShColor.LightRed <-[Propag]- QShColor.Yellow <-[Call]- String.yellow <-[Call ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + LightRed(91), + // CallChain[size=8] = QShColor.LightGreen <-[Propag]- QShColor.Yellow <-[Call]- String.yellow <-[Ca ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + LightGreen(92), + // CallChain[size=8] = QShColor.LightYellow <-[Propag]- QShColor.Yellow <-[Call]- String.yellow <-[C ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + LightYellow(93), + // CallChain[size=8] = QShColor.LightBlue <-[Propag]- QShColor.Yellow <-[Call]- String.yellow <-[Cal ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + LightBlue(94), + // CallChain[size=8] = QShColor.LightPurple <-[Propag]- QShColor.Yellow <-[Call]- String.yellow <-[C ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + LightPurple(95), + // CallChain[size=8] = QShColor.LightCyan <-[Propag]- QShColor.Yellow <-[Call]- String.yellow <-[Cal ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + LightCyan(96), + // CallChain[size=8] = QShColor.White <-[Propag]- QShColor.Yellow <-[Call]- String.yellow <-[Call]- ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + White(97); + + // CallChain[size=8] = QShColor.fg <-[Propag]- QShColor.Yellow <-[Call]- String.yellow <-[Call]- QEx ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] val fg: String = "$qSTART${code}m" - // CallChain[size=8] = QShColor.bg <-[Propag]- QShColor.YELLOW <-[Call]- yellow <-[Call]- QException ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] - /** ANSI modifier string to apply the color the text's background */ + // CallChain[size=8] = QShColor.bg <-[Propag]- QShColor.Yellow <-[Call]- String.yellow <-[Call]- QEx ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] val bg: String = "$qSTART${code + qBG_JUMP}m" companion object { - // CallChain[size=8] = QShColor.random() <-[Propag]- QShColor.YELLOW <-[Call]- yellow <-[Call]- QExc ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] - fun random(seed: String, colors: Array = arrayOf(YELLOW, GREEN, BLUE, MAGENTA, CYAN)): QShColor { + // CallChain[size=8] = QShColor.random() <-[Propag]- QShColor.Yellow <-[Call]- String.yellow <-[Call ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + fun random(seed: String, colors: Array = arrayOf(Yellow, Green, Blue, Purple, Cyan)): QShColor { val idx = seed.hashCode().rem(colors.size).absoluteValue return colors[idx] } + + // CallChain[size=8] = QShColor.get() <-[Propag]- QShColor.Yellow <-[Call]- String.yellow <-[Call]- ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + fun get(ansiEscapeCode: Int): QShColor { + return QShColor.values().find { + it.code == ansiEscapeCode + }!! + } } } // CallChain[size=6] = String.qColorTarget() <-[Call]- QException.mySrcAndStack <-[Call]- QException ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] -internal fun String.qColorTarget(ptn: Regex, color: QShColor = QShColor.LIGHT_YELLOW): String { - return ptn.replace(this, "$0".qColor(color)) +internal fun String.qColorTarget(ptn: Regex, fg: QShColor? = null, bg: QShColor? = null): String { + return ptn.replace(this, "$0".qColor(fg, bg)) } -// CallChain[size=6] = yellow <-[Call]- QException.qToString() <-[Call]- QException.toString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=6] = String.yellow <-[Call]- QException.qToString() <-[Call]- QException.toString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] internal val String?.yellow: String - get() = this?.qColor(QShColor.YELLOW) ?: "null".qColor(QShColor.YELLOW) + get() = this?.qColor(QShColor.Yellow) ?: "null".qColor(QShColor.Yellow) -// CallChain[size=15] = cyan <-[Call]- QMaskResult.toString() <-[Propag]- QMaskResult <-[Ref]- QMask ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=8] = String.cyan <-[Call]- QLogStyle <-[Ref]- QLogStyle.SRC_AND_STACK <-[Call]- QE ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] internal val String?.cyan: String - get() = this?.qColor(QShColor.CYAN) ?: "null".qColor(QShColor.CYAN) + get() = this?.qColor(QShColor.Cyan) ?: "null".qColor(QShColor.Cyan) -// CallChain[size=3] = light_gray <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=3] = String.light_gray <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] internal val String?.light_gray: String - get() = this?.qColor(QShColor.LIGHT_GRAY) ?: "null".qColor(QShColor.LIGHT_GRAY) + get() = this?.qColor(QShColor.LightGray) ?: "null".qColor(QShColor.LightGray) -// CallChain[size=9] = light_green <-[Call]- QLogStyle.qLogArrow() <-[Call]- QLogStyle.S <-[Call]- q ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=9] = String.light_green <-[Call]- QLogStyle.qLogArrow() <-[Call]- QLogStyle.S <-[C ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] internal val String?.light_green: String - get() = this?.qColor(QShColor.LIGHT_GREEN) ?: "null".qColor(QShColor.LIGHT_GREEN) + get() = this?.qColor(QShColor.LightGreen) ?: "null".qColor(QShColor.LightGreen) -// CallChain[size=11] = light_cyan <-[Call]- qARROW <-[Call]- qArrow() <-[Call]- QLogStyle.qLogArrow ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=11] = String.light_cyan <-[Call]- qARROW <-[Call]- qArrow() <-[Call]- QLogStyle.qL ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] internal val String?.light_cyan: String - get() = this?.qColor(QShColor.LIGHT_CYAN) ?: "null".qColor(QShColor.LIGHT_CYAN) \ No newline at end of file + get() = this?.qColor(QShColor.LightCyan) ?: "null".qColor(QShColor.LightCyan) + +// CallChain[size=12] = String.noStyle <-[Call]- QConsole.print() <-[Propag]- QConsole <-[Call]- QOu ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +internal val String.noStyle: String + get() { + return this.replace("""\Q$qSTART\E\d{1,2}m""".re, "") + } \ No newline at end of file diff --git a/src-split/nyab/util/QShortExtensions.kt b/src-split/nyab/util/QShortExtensions.kt index e3fae85..9ce4a63 100644 --- a/src-split/nyab/util/QShortExtensions.kt +++ b/src-split/nyab/util/QShortExtensions.kt @@ -22,6 +22,6 @@ internal operator fun StringBuilder.plusAssign(str: String) { this.append(str) } -// CallChain[size=8] = path <-[Call]- QMyPath.src_root <-[Call]- qLogStackFrames() <-[Call]- QExcept ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=8] = String.path <-[Call]- QMyPath.src_root <-[Call]- qLogStackFrames() <-[Call]- ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] internal val String.path: Path get() = Paths.get(this.trim()).toAbsolutePath().normalize() \ No newline at end of file diff --git a/src-split/nyab/util/QString.kt b/src-split/nyab/util/QString.kt index 41388e7..5349b34 100644 --- a/src-split/nyab/util/QString.kt +++ b/src-split/nyab/util/QString.kt @@ -11,6 +11,7 @@ package nyab.util import java.nio.charset.Charset +import java.util.* import kotlin.math.min import kotlin.reflect.full.extensionReceiverParameter import kotlin.reflect.full.isSuperclassOf @@ -54,7 +55,7 @@ internal fun String.qWithNewLinePrefix( return lineSeparator.value.repeat(numNewLine) + substring(nCount) } -// CallChain[size=16] = String.qWithNewLineSuffix() <-[Call]- String.qWithNewLineSurround() <-[Call] ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=11] = String.qWithNewLineSuffix() <-[Call]- String.qWithNewLineSurround() <-[Call] ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] internal fun String.qWithNewLineSuffix(numNewLine: Int = 1, onlyIf: QOnlyIfStr = QOnlyIfStr.Multiline): String { if (!onlyIf.matches(this)) return this @@ -63,7 +64,7 @@ internal fun String.qWithNewLineSuffix(numNewLine: Int = 1, onlyIf: QOnlyIfStr = return substring(0, length - nCount) + "\n".repeat(numNewLine) } -// CallChain[size=15] = String.qWithNewLineSurround() <-[Call]- QMaskResult.toString() <-[Propag]- Q ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=10] = String.qWithNewLineSurround() <-[Call]- String.qBracketEnd() <-[Call]- qBrac ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] internal fun String.qWithNewLineSurround(numNewLine: Int = 1, onlyIf: QOnlyIfStr = QOnlyIfStr.Multiline): String { if (!onlyIf.matches(this)) return this @@ -117,13 +118,13 @@ internal enum class QLineSeparator(val value: String) { // CallChain[size=8] = String.qCountLeftSpace() <-[Call]- QFetchRule.SMART_FETCH <-[Call]- qLogStack ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] internal fun String.qCountLeftSpace(): Int = takeWhile { it == ' ' }.count() -// CallChain[size=4] = qMASK_LENGTH_LIMIT <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=4] = qMASK_LENGTH_LIMIT <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] internal const val qMASK_LENGTH_LIMIT: Int = 100_000 -// CallChain[size=6] = QToString <-[Ref]- qToStringRegistry <-[Call]- Any?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=6] = QToString <-[Ref]- qToStringRegistry <-[Call]- Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] internal class QToString(val okToApply: (Any) -> Boolean, val toString: (Any) -> String) -// CallChain[size=5] = qToStringRegistry <-[Call]- Any?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=5] = qToStringRegistry <-[Call]- Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private val qToStringRegistry: MutableList by lazy { val toStrings = QMyToString::class.qFunctions( @@ -146,7 +147,7 @@ private val qToStringRegistry: MutableList by lazy { }.toMutableList() } -// CallChain[size=4] = Any?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=4] = Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] internal fun Any?.qToString(): String { if (this == null) return "null".light_gray @@ -160,7 +161,7 @@ internal fun Any?.qToString(): String { return toString() } -// CallChain[size=3] = Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=3] = Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] internal fun Any?.qToLogString(maxLineLength: Int = 80): String { if (QMyLog.no_format) { return this.toString() @@ -203,12 +204,12 @@ internal fun Any?.qToLogString(maxLineLength: Int = 80): String { }.qClarifyEmptyOrBlank() } -// CallChain[size=4] = String.qClarifyEmptyOrBlank() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=4] = String.qClarifyEmptyOrBlank() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] internal fun String.qClarifyEmptyOrBlank(): String { return if (this.isEmpty()) { - "(EMPTY STRING)".qColor(QShColor.LIGHT_GRAY) + "(EMPTY STRING)".qColor(QShColor.LightGray) } else if (this.isBlank()) { - "$this(BLANK STRING)".qColor(QShColor.LIGHT_GRAY) + "$this(BLANK STRING)".qColor(QShColor.LightGray) } else { this } diff --git a/src-split/nyab/util/QStringMask.kt b/src-split/nyab/util/QStringMask.kt index 4c7f070..b9ed6fd 100644 --- a/src-split/nyab/util/QStringMask.kt +++ b/src-split/nyab/util/QStringMask.kt @@ -28,13 +28,13 @@ internal fun String.qCountOccurrence(word: String): Int { }.sum() } -// CallChain[size=12] = QMask <-[Ref]- QMaskBetween <-[Call]- qMASK_COLORED <-[Call]- String.qApplyC ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=7] = QMask <-[Ref]- QMaskBetween <-[Call]- QMask.DOUBLE_QUOTE <-[Call]- QMask.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] internal interface QMask { - // CallChain[size=13] = QMask.apply() <-[Propag]- QMask <-[Ref]- QMaskBetween <-[Call]- qMASK_COLORE ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=5] = QMask.apply() <-[Propag]- QMask.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] fun apply(text: String): QMaskResult companion object { - // CallChain[size=5] = QMask.THREE_DOUBLE_QUOTES <-[Call]- QMask.KOTLIN_STRING <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=5] = QMask.THREE_DOUBLE_QUOTES <-[Call]- QMask.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] val THREE_DOUBLE_QUOTES by lazy { QMaskBetween( "\"\"\"", "\"\"\"", @@ -43,7 +43,7 @@ internal interface QMask { maskIncludeStartAndEndSequence = false, ) } - // CallChain[size=5] = QMask.DOUBLE_QUOTE <-[Call]- QMask.KOTLIN_STRING <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=5] = QMask.DOUBLE_QUOTE <-[Call]- QMask.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] val DOUBLE_QUOTE by lazy { QMaskBetween( "\"", "\"", @@ -52,21 +52,21 @@ internal interface QMask { maskIncludeStartAndEndSequence = false, ) } - // CallChain[size=4] = QMask.KOTLIN_STRING <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=4] = QMask.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] val KOTLIN_STRING by lazy { QMultiMask( THREE_DOUBLE_QUOTES, DOUBLE_QUOTE ) } - // CallChain[size=4] = QMask.PARENS <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=4] = QMask.PARENS <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] val PARENS by lazy { QMaskBetween( "(", ")", nestStartSequence = "(", escapeChar = '\\' ) } - // CallChain[size=4] = QMask.INNER_BRACKETS <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=4] = QMask.INNER_BRACKETS <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] val INNER_BRACKETS by lazy { QMaskBetween( "[", "]", @@ -80,17 +80,17 @@ internal interface QMask { } } -// CallChain[size=5] = QMultiMask <-[Call]- QMask.KOTLIN_STRING <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=5] = QMultiMask <-[Call]- QMask.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] internal class QMultiMask(vararg mask: QMaskBetween) : QMask { - // CallChain[size=7] = QMultiMask.masks <-[Call]- QMultiMask.apply() <-[Propag]- QMultiMask <-[Call] ... .KOTLIN_STRING <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=7] = QMultiMask.masks <-[Call]- QMultiMask.apply() <-[Propag]- QMultiMask <-[Call] ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] val masks: Array - // CallChain[size=6] = QMultiMask.init { <-[Propag]- QMultiMask <-[Call]- QMask.KOTLIN_STRING <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=6] = QMultiMask.init { <-[Propag]- QMultiMask <-[Call]- QMask.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] init { masks = arrayOf(*mask) } - // CallChain[size=6] = QMultiMask.apply() <-[Propag]- QMultiMask <-[Call]- QMask.KOTLIN_STRING <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=6] = QMultiMask.apply() <-[Propag]- QMultiMask <-[Call]- QMask.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] override fun apply(text: String): QMaskResult { var result: QMaskResult? = null for (mask in masks) { @@ -101,7 +101,7 @@ internal class QMultiMask(vararg mask: QMaskBetween) : QMask { } } -// CallChain[size=11] = QMaskBetween <-[Call]- qMASK_COLORED <-[Call]- String.qApplyColorNestable() ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=6] = QMaskBetween <-[Call]- QMask.DOUBLE_QUOTE <-[Call]- QMask.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] internal class QMaskBetween( val startSequence: String, val endSequence: String, @@ -120,12 +120,12 @@ internal class QMaskBetween( val maskChar: Char = '\uee31', ) : QMask { - // CallChain[size=12] = QMaskBetween.apply() <-[Propag]- QMaskBetween.QMaskBetween() <-[Ref]- qMASK_ ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=7] = QMaskBetween.apply() <-[Propag]- QMaskBetween.QMaskBetween() <-[Ref]- QMask.D ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] override fun apply(text: String): QMaskResult { return applyMore(text, null) } - // CallChain[size=13] = QMaskBetween.applyMore() <-[Call]- QMaskBetween.apply() <-[Propag]- QMaskBet ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=8] = QMaskBetween.applyMore() <-[Call]- QMaskBetween.apply() <-[Propag]- QMaskBetw ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] fun applyMore(text: String, orgText: String? = null): QMaskResult { val regions = text.qFindBetween( startSequence, @@ -178,9 +178,9 @@ internal class QMaskBetween( } } -// CallChain[size=16] = QMutRegion <-[Ref]- QRegion.toMutRegion() <-[Propag]- QRegion.contains() <-[ ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=11] = QMutRegion <-[Ref]- QRegion.toMutRegion() <-[Propag]- QRegion.contains() <-[ ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] internal open class QMutRegion(override var start: Int, override var end: Int) : QRegion(start, end) { - // CallChain[size=17] = QMutRegion.intersectMut() <-[Propag]- QMutRegion <-[Ref]- QRegion.toMutRegio ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=12] = QMutRegion.intersectMut() <-[Propag]- QMutRegion <-[Ref]- QRegion.toMutRegio ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] fun intersectMut(region: QRegion) { val start = max(this.start, region.start) val end = min(this.end, region.end) @@ -191,39 +191,39 @@ internal open class QMutRegion(override var start: Int, override var end: Int) : } } - // CallChain[size=17] = QMutRegion.addOffset() <-[Propag]- QMutRegion <-[Ref]- QRegion.toMutRegion() ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=12] = QMutRegion.addOffset() <-[Propag]- QMutRegion <-[Ref]- QRegion.toMutRegion() ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] fun addOffset(offset: Int) { start += offset end += offset } - // CallChain[size=17] = QMutRegion.shift() <-[Propag]- QMutRegion <-[Ref]- QRegion.toMutRegion() <-[ ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=12] = QMutRegion.shift() <-[Propag]- QMutRegion <-[Ref]- QRegion.toMutRegion() <-[ ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] fun shift(length: Int) { this.start += length this.end += length } } -// CallChain[size=16] = QRegion <-[Ref]- QRegion.intersect() <-[Propag]- QRegion.contains() <-[Call] ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=11] = QRegion <-[Ref]- QRegion.intersect() <-[Propag]- QRegion.contains() <-[Call] ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] /** * [start] inclusive, [end] exclusive */ internal open class QRegion(open val start: Int, open val end: Int) { - // CallChain[size=15] = QRegion.toMutRegion() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween. ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=10] = QRegion.toMutRegion() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween. ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] fun toMutRegion(): QMutRegion { return QMutRegion(start, end) } - // CallChain[size=15] = QRegion.toRange() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.appl ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=10] = QRegion.toRange() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.appl ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] fun toRange(): IntRange { return IntRange(start, end + 1) } - // CallChain[size=15] = QRegion.length <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.applyMo ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=10] = QRegion.length <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.applyMo ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] val length: Int get() = end - start - // CallChain[size=15] = QRegion.intersect() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.ap ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=10] = QRegion.intersect() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.ap ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] fun intersect(region: QRegion): QRegion? { val start = max(this.start, region.start) val end = min(this.end, region.end) @@ -235,38 +235,38 @@ internal open class QRegion(open val start: Int, open val end: Int) { } } - // CallChain[size=14] = QRegion.contains() <-[Call]- QMaskBetween.applyMore() <-[Call]- QMaskBetween ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=9] = QRegion.contains() <-[Call]- QMaskBetween.applyMore() <-[Call]- QMaskBetween. ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] fun contains(idx: Int): Boolean { return idx in start until end } - // CallChain[size=15] = QRegion.cut() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.applyMor ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=10] = QRegion.cut() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.applyMor ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] fun cut(text: String): String { return text.substring(start, end) } - // CallChain[size=15] = QRegion.remove() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.apply ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=10] = QRegion.remove() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.apply ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] fun remove(text: String): String { return text.removeRange(start, end) } - // CallChain[size=15] = QRegion.replace() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.appl ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=10] = QRegion.replace() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.appl ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] fun replace(text: String, replacement: String): String { return text.replaceRange(start, end, replacement) } - // CallChain[size=15] = QRegion.mask() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.applyMo ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=10] = QRegion.mask() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.applyMo ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] fun mask(text: String, maskChar: Char = '*'): String { return text.replaceRange(this.toRange(), maskChar.toString().repeat(end - start)) } } -// CallChain[size=12] = QReplacer <-[Ref]- String.qMaskAndReplace() <-[Call]- String.qMaskAndReplace ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=6] = QReplacer <-[Ref]- String.qMaskAndReplace() <-[Call]- QMaskResult.replaceAndUnmask() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] internal class QReplacer(start: Int, end: Int, val replacement: String) : QMutRegion(start, end) -// CallChain[size=13] = QMaskResult <-[Ref]- QMaskBetween.apply() <-[Propag]- QMaskBetween.QMaskBetw ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=6] = QMaskResult <-[Ref]- QMask.apply() <-[Propag]- QMask.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] internal class QMaskResult(val maskedStr: String, val orgText: String, val maskChar: Char) { - // CallChain[size=4] = QMaskResult.replaceAndUnmask() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=4] = QMaskResult.replaceAndUnmask() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] /** * Apply regex to masked string. * Apply replacement to original text. @@ -275,12 +275,12 @@ internal class QMaskResult(val maskedStr: String, val orgText: String, val maskC return orgText.qMaskAndReplace(maskedStr, ptn, replacement, findAll) } - // CallChain[size=7] = QMaskResult.applyMoreMask() <-[Call]- QMultiMask.apply() <-[Propag]- QMultiMa ... .KOTLIN_STRING <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=7] = QMaskResult.applyMoreMask() <-[Call]- QMultiMask.apply() <-[Propag]- QMultiMa ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] fun applyMoreMask(mask: QMaskBetween): QMaskResult { return mask.applyMore(maskedStr, orgText) } - // CallChain[size=14] = QMaskResult.toString() <-[Propag]- QMaskResult <-[Ref]- QMaskBetween.apply() ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=7] = QMaskResult.toString() <-[Propag]- QMaskResult <-[Ref]- QMask.apply() <-[Prop ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] override fun toString(): String { val original = orgText.qWithNewLineSurround(onlyIf = QOnlyIfStr.Multiline) val masked = maskedStr.replace(maskChar, '*').qWithNewLineSurround(onlyIf = QOnlyIfStr.Multiline) @@ -289,7 +289,7 @@ internal class QMaskResult(val maskedStr: String, val orgText: String, val maskC } } -// CallChain[size=4] = CharSequence.qMask() <-[Call]- Any?.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=4] = CharSequence.qMask() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] internal fun CharSequence.qMask(vararg mask: QMask): QMaskResult { mask.size.qaNotZero() @@ -309,7 +309,7 @@ internal fun CharSequence.qMask(vararg mask: QMask): QMaskResult { } } -// CallChain[size=14] = String.qFindBetween() <-[Call]- QMaskBetween.applyMore() <-[Call]- QMaskBetw ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=9] = String.qFindBetween() <-[Call]- QMaskBetween.applyMore() <-[Call]- QMaskBetwe ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] internal fun String.qFindBetween( startSequence: String, endSequence: String, @@ -336,7 +336,7 @@ internal fun String.qFindBetween( return finder.find(this) } -// CallChain[size=11] = String.qMaskAndReplace() <-[Call]- String.qMaskAndReplace() <-[Call]- String ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=5] = String.qMaskAndReplace() <-[Call]- QMaskResult.replaceAndUnmask() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private fun String.qMaskAndReplace( maskedStr: String, ptn: Regex, @@ -370,19 +370,7 @@ private fun String.qMaskAndReplace( return qMultiReplace(replacers) } -// CallChain[size=10] = String.qMaskAndReplace() <-[Call]- String.qApplyColorNestable() <-[Call]- St ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] -internal fun String.qMaskAndReplace( - mask: QMask, - ptn: Regex, - replacement: String = "$1", - replaceAll: Boolean = true, -): String { - val maskResult = mask.apply(this) - - return qMaskAndReplace(maskResult.maskedStr, ptn, replacement, replaceAll) -} - -// CallChain[size=12] = CharSequence.qMultiReplace() <-[Call]- String.qMaskAndReplace() <-[Call]- St ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=6] = CharSequence.qMultiReplace() <-[Call]- String.qMaskAndReplace() <-[Call]- QMa ... laceAndUnmask() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] /** * currently does not support region overlap */ @@ -398,7 +386,7 @@ internal fun CharSequence.qMultiReplace(replacers: List): String { return sb.toString() } -// CallChain[size=12] = MatchResult.qResolveReplacementGroup() <-[Call]- String.qMaskAndReplace() <- ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=6] = MatchResult.qResolveReplacementGroup() <-[Call]- String.qMaskAndReplace() <-[ ... laceAndUnmask() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] internal fun MatchResult.qResolveReplacementGroup(replacement: String, orgText: String): String { var resolveGroup = replacement @@ -417,20 +405,20 @@ internal fun MatchResult.qResolveReplacementGroup(replacement: String, orgText: return resolveGroup } -// CallChain[size=13] = CharSequence.qReplace() <-[Call]- MatchResult.qResolveReplacementGroup() <-[ ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=7] = CharSequence.qReplace() <-[Call]- MatchResult.qResolveReplacementGroup() <-[C ... laceAndUnmask() <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] internal fun CharSequence.qReplace(oldValue: String, newValue: String, escapeChar: Char): String { return replace(Regex("""(? 1 - // \n[\n] --> 2 + // [\n]abc\n --> lineNumber is 1 "First Line" + // \n[\n] --> lineNumber is 2 "Second Line" var lineBreakCount = 0 @@ -537,7 +527,7 @@ internal open class QCharReader(val text: CharSequence) { return lineBreakCount + 1 } - // CallChain[size=18] = QCharReader.countIndentSpaces() <-[Propag]- QCharReader <-[Call]- QSequenceR ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=13] = QCharReader.countIndentSpaces() <-[Propag]- QCharReader <-[Call]- QSequenceR ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] fun countIndentSpaces(space: Char = ' '): Int { var count = 0 @@ -574,56 +564,74 @@ internal open class QCharReader(val text: CharSequence) { return count } - // CallChain[size=18] = QCharReader.hasNextChar() <-[Propag]- QCharReader <-[Call]- QSequenceReader ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=13] = QCharReader.hasNextChar() <-[Propag]- QCharReader <-[Call]- QSequenceReader ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] inline fun hasNextChar(len: Int = 1): Boolean { return offset + len - 1 < text.length } - // CallChain[size=18] = QCharReader.isOffsetEOF() <-[Propag]- QCharReader <-[Call]- QSequenceReader ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=13] = QCharReader.isOffsetEOF() <-[Propag]- QCharReader <-[Call]- QSequenceReader ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] inline fun isOffsetEOF(): Boolean { return offset == text.length - 1 } - // CallChain[size=18] = QCharReader.isValidOffset() <-[Propag]- QCharReader <-[Call]- QSequenceReade ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=13] = QCharReader.isValidOffset() <-[Propag]- QCharReader <-[Call]- QSequenceReade ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] inline fun isValidOffset(): Boolean { return 0 <= offset && offset < text.length } - // CallChain[size=18] = QCharReader.hasPreviousChar() <-[Propag]- QCharReader <-[Call]- QSequenceRea ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=13] = QCharReader.hasPreviousChar() <-[Propag]- QCharReader <-[Call]- QSequenceRea ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] inline fun hasPreviousChar(len: Int = 1): Boolean { return 0 < offset - len + 1 } - // CallChain[size=18] = QCharReader.previousChar() <-[Propag]- QCharReader <-[Call]- QSequenceReader ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] - inline fun previousChar(len: Int = 1) { + // CallChain[size=13] = QCharReader.previousChar() <-[Propag]- QCharReader <-[Call]- QSequenceReader ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + inline fun previousChar(len: Int = 1): Char { offset -= len + return text[offset] } - // CallChain[size=18] = QCharReader.currentChar() <-[Propag]- QCharReader <-[Call]- QSequenceReader ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=13] = QCharReader.currentChar() <-[Propag]- QCharReader <-[Call]- QSequenceReader ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] inline fun currentChar(): Char { return text[offset] } - // CallChain[size=18] = QCharReader.peekNextChar() <-[Propag]- QCharReader <-[Call]- QSequenceReader ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] - fun peekNextChar(): Char { + // CallChain[size=13] = QCharReader.peekNextChar() <-[Propag]- QCharReader <-[Call]- QSequenceReader ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + inline fun peekNextChar(): Char { return text[offset] } - // CallChain[size=18] = QCharReader.moveOffset() <-[Propag]- QCharReader <-[Call]- QSequenceReader < ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=13] = QCharReader.moveOffset() <-[Propag]- QCharReader <-[Call]- QSequenceReader < ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] inline fun moveOffset(plus: Int = 1) { offset += plus } - // CallChain[size=18] = QCharReader.nextChar() <-[Propag]- QCharReader <-[Call]- QSequenceReader <-[ ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=13] = QCharReader.nextChar() <-[Propag]- QCharReader <-[Call]- QSequenceReader <-[ ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] /** * Read current offset char and add offset by 1. */ inline fun nextChar(): Char { return text[offset++] } + + // CallChain[size=13] = QCharReader.nextStringExcludingCurOffset() <-[Propag]- QCharReader <-[Call]- ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + fun nextStringExcludingCurOffset(length: Int): String { + val str = text.substring(offset + 1, (offset + 1 + length).coerceAtMost(text.length)) + offset += length + return str + } + + // CallChain[size=13] = QCharReader.peekNextStringIncludingCurOffset() <-[Propag]- QCharReader <-[Ca ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + fun peekNextStringIncludingCurOffset(length: Int): String { + return text.substring(offset, (offset + length).coerceAtMost(text.length)) + } + + // CallChain[size=13] = QCharReader.peekPreviousStringExcludingCurOffset() <-[Propag]- QCharReader < ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + fun peekPreviousStringExcludingCurOffset(length: Int): String { + return text.substring(offset - length, offset) + } } -// CallChain[size=15] = QBetween <-[Call]- String.qFindBetween() <-[Call]- QMaskBetween.applyMore() ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=10] = QBetween <-[Call]- String.qFindBetween() <-[Call]- QMaskBetween.applyMore() ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] private class QBetween( val startSequence: String, val endSequence: String, @@ -638,7 +646,7 @@ private class QBetween( val regionIncludeStartAndEndSequence: Boolean = false, ) { - // CallChain[size=15] = QBetween.find() <-[Call]- String.qFindBetween() <-[Call]- QMaskBetween.apply ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] + // CallChain[size=10] = QBetween.find() <-[Call]- String.qFindBetween() <-[Call]- QMaskBetween.apply ... k.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- QE.throwIt() <-[Call]- N.depthFirst()[Root] fun find(text: CharSequence): List { val reader = QSequenceReader(text) diff --git a/src-split/nyab/util/QTime.kt b/src-split/nyab/util/QTime.kt index 46a7b64..3d551f8 100644 --- a/src-split/nyab/util/QTime.kt +++ b/src-split/nyab/util/QTime.kt @@ -15,6 +15,6 @@ package nyab.util // qq-tree is a self-contained single-file library created by nyabkun. // This is a split-file version of the library, this file is not self-contained. -// CallChain[size=14] = qNow <-[Call]- qCacheItTimedThreadLocal() <-[Call]- qCacheItOneSecThreadLoca ... oString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] +// CallChain[size=9] = qNow <-[Call]- qCacheItTimedThreadLocal() <-[Call]- qCacheItOneSecThreadLocal ... ckTrace() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt() <-[Call]- N.depthFirst()[Root] internal val qNow: Long get() = System.currentTimeMillis() \ No newline at end of file diff --git a/src-split/nyab/util/QTreeNode.kt b/src-split/nyab/util/QTreeNode.kt index 773bc58..a618abd 100644 --- a/src-split/nyab/util/QTreeNode.kt +++ b/src-split/nyab/util/QTreeNode.kt @@ -225,7 +225,7 @@ enum class QTreeStyle(val plus: String, val vert: String, val end: String, val h */ fun > N.tree( style: QTreeStyle = QTreeStyle.UNICODE, - color: QShColor? = QShColor.LIGHT_YELLOW, + color: QShColor? = QShColor.LightYellow, visitChecker: HashSet = HashSet(), ): String { val hyphen = style.hyphen.repeat(3) @@ -234,6 +234,7 @@ fun > N.tree( this.mark(visitChecker) + // print root node sb += this.toTreeNodeString() + "\n" for (node in depthFirst().drop(1)) { diff --git a/src-test-single/QTreeNodeTest.kt b/src-test-single/QTreeNodeTest.kt index f3eb439..6850b6e 100644 --- a/src-test-single/QTreeNodeTest.kt +++ b/src-test-single/QTreeNodeTest.kt @@ -215,30 +215,30 @@ class QTreeNodeTest { // ================================================================================ -// CallChain[size=4] = QMyException <-[Ref]- QE <-[Ref]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=4] = QMyException <-[Ref]- QE <-[Ref]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private enum class QMyException { - // CallChain[size=6] = QMyException.Other <-[Call]- QException.QException() <-[Ref]- QE.throwItBrack ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=6] = QMyException.Other <-[Call]- QException.QException() <-[Ref]- QE.throwItBrack ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] Other, - // CallChain[size=12] = QMyException.Unreachable <-[Call]- qUnreachable() <-[Call]- QFetchRule.SINGL ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=12] = QMyException.Unreachable <-[Call]- qUnreachable() <-[Call]- QFetchRule.SINGL ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] Unreachable, - // CallChain[size=3] = QMyException.ShouldBeTrue <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=3] = QMyException.ShouldBeTrue <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] ShouldBeTrue, - // CallChain[size=3] = QMyException.ShouldBeFalse <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=3] = QMyException.ShouldBeFalse <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] ShouldBeFalse, - // CallChain[size=13] = QMyException.ShouldNotBeNull <-[Call]- T?.qaNotNull() <-[Call]- qSrcFileAtFr ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=13] = QMyException.ShouldNotBeNull <-[Call]- T.qaNotNull() <-[Call]- qSrcFileAtFra ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] ShouldNotBeNull, - // CallChain[size=6] = QMyException.ShouldNotBeZero <-[Call]- Int?.qaNotZero() <-[Call]- CharSequenc ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=6] = QMyException.ShouldNotBeZero <-[Call]- Int.qaNotZero() <-[Call]- CharSequence ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] ShouldNotBeZero, - // CallChain[size=3] = QMyException.ShouldBeEqual <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=3] = QMyException.ShouldBeEqual <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] ShouldBeEqual, - // CallChain[size=4] = QMyException.ShouldBeEvenNumber <-[Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=4] = QMyException.ShouldBeEvenNumber <-[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] ShouldBeEvenNumber, - // CallChain[size=12] = QMyException.FileNotFound <-[Call]- qSrcFileAtFrame() <-[Call]- qSrcFileLine ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=12] = QMyException.FileNotFound <-[Call]- qSrcFileAtFrame() <-[Call]- qSrcFileLine ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] FileNotFound, - // CallChain[size=12] = QMyException.FetchLinesFail <-[Call]- Path.qFetchLinesAround() <-[Call]- qSr ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=12] = QMyException.FetchLinesFail <-[Call]- Path.qFetchLinesAround() <-[Call]- qSr ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] FetchLinesFail, - // CallChain[size=13] = QMyException.LineNumberExceedsMaximum <-[Call]- Path.qLineAt() <-[Call]- Pat ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=13] = QMyException.LineNumberExceedsMaximum <-[Call]- Path.qLineAt() <-[Call]- Pat ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] LineNumberExceedsMaximum, // CallChain[size=5] = QMyException.TrySetAccessibleFail <-[Call]- AccessibleObject.qTrySetAccessible() <-[Call]- qTestMethods() <-[Call]- qTest() <-[Call]- main()[Root] TrySetAccessibleFail, @@ -250,73 +250,55 @@ private enum class QMyException { CycleDetected, // CallChain[size=3] = QMyException.TestFail <-[Call]- qTest() <-[Call]- main()[Root] - TestFail - ; + TestFail; - companion object { - // Required to implement extended functions. - - // CallChain[size=6] = QMyException.STACK_FRAME_FILTER <-[Call]- QException.QException() <-[Ref]- QE ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] - val STACK_FRAME_FILTER: (StackWalker.StackFrame) -> Boolean = { - !it.className.startsWith("org.gradle") && - !it.className.startsWith("org.testng") && - !it.className.startsWith("worker.org.gradle") && - !it.methodName.endsWith("\$default") && it.fileName != null && -// && !it.className.startsWith(QException::class.qualifiedName!!) -// && it.methodName != "invokeSuspend" - it.declaringClass != null -// && it.declaringClass.canonicalName != null -// && !it.declaringClass.canonicalName.startsWith("kotlin.coroutines.jvm.internal.") -// && !it.declaringClass.canonicalName.startsWith("kotlinx.coroutines") - } - - - } + } -// CallChain[size=10] = QMyLog <-[Ref]- QLogStyle <-[Ref]- QLogStyle.SRC_AND_STACK <-[Call]- QExcept ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=10] = QMyLog <-[Ref]- QLogStyle <-[Ref]- QLogStyle.SRC_AND_STACK <-[Call]- QExcept ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private object QMyLog { - // CallChain[size=10] = QMyLog.out <-[Call]- QLogStyle <-[Ref]- QLogStyle.SRC_AND_STACK <-[Call]- QE ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=10] = QMyLog.out <-[Call]- QLogStyle <-[Ref]- QLogStyle.SRC_AND_STACK <-[Call]- QE ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] /** * Default output stream */ val out: QOut = QOut.CONSOLE - // CallChain[size=4] = QMyLog.no_format <-[Call]- Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=4] = QMyLog.no_format <-[Call]- Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] var no_format: Boolean = false } -// CallChain[size=6] = QMyMark <-[Ref]- QException.QException() <-[Ref]- QE.throwItBrackets() <-[Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=6] = QMyMark <-[Ref]- QException.QException() <-[Ref]- QE.throwItBrackets() <-[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +@Suppress("MayBeConstant") private object QMyMark { - // CallChain[size=4] = QMyMark.TEST_METHOD <-[Call]- qTestMethods() <-[Call]- qTest() <-[Call]- main()[Root] - val TEST_METHOD = "☕".yellow - // CallChain[size=6] = QMyMark.WARN <-[Call]- QException.QException() <-[Ref]- QE.throwItBrackets() <-[Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] - val WARN = "⚠".yellow - // CallChain[size=3] = QMyMark.TEST_START <-[Call]- qTest() <-[Call]- main()[Root] - val TEST_START = "☘".yellow + // CallChain[size=4] = QMyMark.test_method <-[Call]- qTestMethods() <-[Call]- qTest() <-[Call]- main()[Root] + val test_method = "☕".yellow + // CallChain[size=6] = QMyMark.warn <-[Call]- QException.QException() <-[Ref]- QE.throwItBrackets() <-[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + val warn = "⚠".yellow + // CallChain[size=3] = QMyMark.test_start <-[Call]- qTest() <-[Call]- main()[Root] + val test_start = "☘".yellow } -// CallChain[size=9] = QMyPath <-[Ref]- qLogStackFrames() <-[Call]- QException.mySrcAndStack <-[Call ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=9] = QMyPath <-[Ref]- qLogStackFrames() <-[Call]- QException.mySrcAndStack <-[Call ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private object QMyPath { // -- dirs - // CallChain[size=10] = QMyPath.src <-[Call]- QMyPath.src_root <-[Call]- qLogStackFrames() <-[Call]- ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=10] = QMyPath.src <-[Call]- QMyPath.src_root <-[Call]- qLogStackFrames() <-[Call]- ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val src = "src".path - // CallChain[size=10] = QMyPath.src_java <-[Call]- QMyPath.src_root <-[Call]- qLogStackFrames() <-[C ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=10] = QMyPath.src_java <-[Call]- QMyPath.src_root <-[Call]- qLogStackFrames() <-[C ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val src_java = "src-java".path - // CallChain[size=10] = QMyPath.src_build <-[Call]- QMyPath.src_root <-[Call]- qLogStackFrames() <-[ ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=10] = QMyPath.src_build <-[Call]- QMyPath.src_root <-[Call]- qLogStackFrames() <-[ ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val src_build = "src-build".path - // CallChain[size=10] = QMyPath.src_experiment <-[Call]- QMyPath.src_root <-[Call]- qLogStackFrames( ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=10] = QMyPath.src_experiment <-[Call]- QMyPath.src_root <-[Call]- qLogStackFrames( ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val src_experiment = "src-experiment".path - // CallChain[size=10] = QMyPath.src_plugin <-[Call]- QMyPath.src_root <-[Call]- qLogStackFrames() <- ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=10] = QMyPath.src_plugin <-[Call]- QMyPath.src_root <-[Call]- qLogStackFrames() <- ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val src_plugin = "src-plugin".path - // CallChain[size=10] = QMyPath.src_config <-[Call]- QMyPath.src_root <-[Call]- qLogStackFrames() <- ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=10] = QMyPath.src_config <-[Call]- QMyPath.src_root <-[Call]- qLogStackFrames() <- ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val src_config = "src-config".path - // CallChain[size=10] = QMyPath.src_test <-[Call]- QMyPath.src_root <-[Call]- qLogStackFrames() <-[C ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=10] = QMyPath.src_test <-[Call]- QMyPath.src_root <-[Call]- qLogStackFrames() <-[C ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val src_test = "src-test".path // --- dir list - // CallChain[size=9] = QMyPath.src_root <-[Call]- qLogStackFrames() <-[Call]- QException.mySrcAndSta ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=9] = QMyPath.src_root <-[Call]- qLogStackFrames() <-[Call]- QException.mySrcAndSta ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val src_root: List by lazy { val base = listOf( src, @@ -343,120 +325,134 @@ private object QMyPath { // -- files } -// CallChain[size=4] = QMyTest <-[Ref]- qOkToTest() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=4] = QMyTest <-[Ref]- qOkToTest() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private object QMyTest { - // CallChain[size=4] = QMyTest.forceTestMode <-[Call]- qOkToTest() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=4] = QMyTest.forceTestMode <-[Call]- qOkToTest() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] const val forceTestMode = true } -// CallChain[size=6] = QMyToString <-[Call]- qToStringRegistry <-[Call]- Any?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=6] = QMyToString <-[Call]- qToStringRegistry <-[Call]- Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private object QMyToString { } -// CallChain[size=3] = QE <-[Ref]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=3] = QE <-[Ref]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private typealias QE = QMyException -// CallChain[size=14] = String.qMatches() <-[Call]- Path.qFind() <-[Call]- Collection.qFind() ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=6] = qSTACK_FRAME_FILTER <-[Call]- QException.QException() <-[Ref]- QE.throwItBrac ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +private val qSTACK_FRAME_FILTER: (StackWalker.StackFrame) -> Boolean = { + !it.className.startsWith("org.gradle") && + !it.className.startsWith("org.testng") && + !it.className.startsWith("worker.org.gradle") && + !it.methodName.endsWith("\$default") && it.fileName != null && +// && !it.className.startsWith(QException::class.qualifiedName!!) +// && it.methodName != "invokeSuspend" + it.declaringClass != null +// && it.declaringClass.canonicalName != null +// && !it.declaringClass.canonicalName.startsWith("kotlin.coroutines.jvm.internal.") +// && !it.declaringClass.canonicalName.startsWith("kotlinx.coroutines") +} + +// CallChain[size=14] = String.qMatches() <-[Call]- Path.qFind() <-[Call]- Collection.qFind() ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun String.qMatches(matcher: QM): Boolean = matcher.matches(this) -// CallChain[size=5] = not <-[Call]- QM.notExact() <-[Call]- QMMethod.nameNotExact() <-[Call]- qTest() <-[Call]- main()[Root] +// CallChain[size=5] = QM.not <-[Call]- QM.notExact() <-[Call]- QMMethod.nameNotExact() <-[Call]- qTest() <-[Call]- main()[Root] private val QM.not: QM get() = QMatchNot(this) -// CallChain[size=6] = QMatchNot <-[Call]- not <-[Call]- QM.notExact() <-[Call]- QMMethod.nameNotExact() <-[Call]- qTest() <-[Call]- main()[Root] +// CallChain[size=6] = QMatchNot <-[Call]- QM.not <-[Call]- QM.notExact() <-[Call]- QMMethod.nameNotExact() <-[Call]- qTest() <-[Call]- main()[Root] private class QMatchNot(val matcher: QM) : QM { - // CallChain[size=7] = QMatchNot.matches() <-[Propag]- QMatchNot <-[Call]- not <-[Call]- QM.notExact() <-[Call]- QMMethod.nameNotExact() <-[Call]- qTest() <-[Call]- main()[Root] + // CallChain[size=7] = QMatchNot.matches() <-[Propag]- QMatchNot <-[Call]- QM.not <-[Call]- QM.notExact() <-[Call]- QMMethod.nameNotExact() <-[Call]- qTest() <-[Call]- main()[Root] override fun matches(text: String): Boolean = !matcher.matches(text) - // CallChain[size=7] = QMatchNot.toString() <-[Propag]- QMatchNot <-[Call]- not <-[Call]- QM.notExact() <-[Call]- QMMethod.nameNotExact() <-[Call]- qTest() <-[Call]- main()[Root] + // CallChain[size=7] = QMatchNot.toString() <-[Propag]- QMatchNot <-[Call]- QM.not <-[Call]- QM.notExact() <-[Call]- QMMethod.nameNotExact() <-[Call]- qTest() <-[Call]- main()[Root] override fun toString(): String { return this::class.simpleName.toString() + "(matcher=$matcher)" } } -// CallChain[size=14] = QMatchAny <-[Call]- QM.isAny() <-[Propag]- QM.exact() <-[Call]- qSrcFileAtFr ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=14] = QMatchAny <-[Call]- QM.isAny() <-[Propag]- QM.exact() <-[Call]- qSrcFileAtFr ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private object QMatchAny : QM { - // CallChain[size=15] = QMatchAny.matches() <-[Propag]- QMatchAny <-[Call]- QM.isAny() <-[Propag]- Q ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=15] = QMatchAny.matches() <-[Propag]- QMatchAny <-[Call]- QM.isAny() <-[Propag]- Q ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun matches(text: String): Boolean { return true } - // CallChain[size=15] = QMatchAny.toString() <-[Propag]- QMatchAny <-[Call]- QM.isAny() <-[Propag]- ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=15] = QMatchAny.toString() <-[Propag]- QMatchAny <-[Call]- QM.isAny() <-[Propag]- ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun toString(): String { return this::class.simpleName.toString() } } -// CallChain[size=14] = QMatchNone <-[Call]- QM.isNone() <-[Propag]- QM.exact() <-[Call]- qSrcFileAt ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=14] = QMatchNone <-[Call]- QM.isNone() <-[Propag]- QM.exact() <-[Call]- qSrcFileAt ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private object QMatchNone : QM { - // CallChain[size=15] = QMatchNone.matches() <-[Propag]- QMatchNone <-[Call]- QM.isNone() <-[Propag] ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=15] = QMatchNone.matches() <-[Propag]- QMatchNone <-[Call]- QM.isNone() <-[Propag] ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun matches(text: String): Boolean { return false } - // CallChain[size=15] = QMatchNone.toString() <-[Propag]- QMatchNone <-[Call]- QM.isNone() <-[Propag ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=15] = QMatchNone.toString() <-[Propag]- QMatchNone <-[Call]- QM.isNone() <-[Propag ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun toString(): String { return this::class.simpleName.toString() } } -// CallChain[size=13] = QM <-[Ref]- QM.exact() <-[Call]- qSrcFileAtFrame() <-[Call]- qSrcFileLinesAt ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=13] = QM <-[Ref]- QM.exact() <-[Call]- qSrcFileAtFrame() <-[Call]- qSrcFileLinesAt ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private interface QM { - // CallChain[size=13] = QM.matches() <-[Propag]- QM.exact() <-[Call]- qSrcFileAtFrame() <-[Call]- qS ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=13] = QM.matches() <-[Propag]- QM.exact() <-[Call]- qSrcFileAtFrame() <-[Call]- qS ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun matches(text: String): Boolean - // CallChain[size=13] = QM.isAny() <-[Propag]- QM.exact() <-[Call]- qSrcFileAtFrame() <-[Call]- qSrc ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=13] = QM.isAny() <-[Propag]- QM.exact() <-[Call]- qSrcFileAtFrame() <-[Call]- qSrc ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun isAny(): Boolean = this == QMatchAny - // CallChain[size=13] = QM.isNone() <-[Propag]- QM.exact() <-[Call]- qSrcFileAtFrame() <-[Call]- qSr ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=13] = QM.isNone() <-[Propag]- QM.exact() <-[Call]- qSrcFileAtFrame() <-[Call]- qSr ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun isNone(): Boolean = this == QMatchNone companion object { - // CallChain[size=12] = QM.exact() <-[Call]- qSrcFileAtFrame() <-[Call]- qSrcFileLinesAtFrame() <-[C ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=12] = QM.exact() <-[Call]- qSrcFileAtFrame() <-[Call]- qSrcFileLinesAtFrame() <-[C ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun exact(text: String, ignoreCase: Boolean = false): QM = QExactMatch(text, ignoreCase) // CallChain[size=4] = QM.notExact() <-[Call]- QMMethod.nameNotExact() <-[Call]- qTest() <-[Call]- main()[Root] fun notExact(text: String, ignoreCase: Boolean = false): QM = QExactMatch(text, ignoreCase).not - // CallChain[size=10] = QM.startsWith() <-[Call]- QMyPath.src_root <-[Call]- qLogStackFrames() <-[Ca ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=10] = QM.startsWith() <-[Call]- QMyPath.src_root <-[Call]- qLogStackFrames() <-[Ca ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun startsWith(text: String, ignoreCase: Boolean = false): QM = QStartsWithMatch(text, ignoreCase) } } -// CallChain[size=13] = QExactMatch <-[Call]- QM.exact() <-[Call]- qSrcFileAtFrame() <-[Call]- qSrcF ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=13] = QExactMatch <-[Call]- QM.exact() <-[Call]- qSrcFileAtFrame() <-[Call]- qSrcF ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private class QExactMatch(val textExact: String, val ignoreCase: Boolean = false) : QM { - // CallChain[size=14] = QExactMatch.matches() <-[Propag]- QExactMatch <-[Call]- QM.exact() <-[Call]- ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=14] = QExactMatch.matches() <-[Propag]- QExactMatch <-[Call]- QM.exact() <-[Call]- ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun matches(text: String): Boolean { return text.equals(textExact, ignoreCase) } - // CallChain[size=14] = QExactMatch.toString() <-[Propag]- QExactMatch <-[Call]- QM.exact() <-[Call] ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=14] = QExactMatch.toString() <-[Propag]- QExactMatch <-[Call]- QM.exact() <-[Call] ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun toString(): String { return this::class.simpleName + "(textExact=$textExact, ignoreCase=$ignoreCase)" } } -// CallChain[size=11] = QStartsWithMatch <-[Call]- QM.startsWith() <-[Call]- QMyPath.src_root <-[Cal ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=11] = QStartsWithMatch <-[Call]- QM.startsWith() <-[Call]- QMyPath.src_root <-[Cal ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private class QStartsWithMatch(val textStartsWith: String, val ignoreCase: Boolean = false) : QM { - // CallChain[size=12] = QStartsWithMatch.matches() <-[Propag]- QStartsWithMatch <-[Call]- QM.startsW ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=12] = QStartsWithMatch.matches() <-[Propag]- QStartsWithMatch <-[Call]- QM.startsW ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun matches(text: String): Boolean { return text.startsWith(textStartsWith, ignoreCase) } - // CallChain[size=12] = QStartsWithMatch.toString() <-[Propag]- QStartsWithMatch <-[Call]- QM.starts ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=12] = QStartsWithMatch.toString() <-[Propag]- QStartsWithMatch <-[Call]- QM.starts ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun toString(): String { return this::class.simpleName + "(textStartsWith=$textStartsWith, ignoreCase=$ignoreCase)" } } -// CallChain[size=7] = qAnd() <-[Call]- QMFunc.and() <-[Call]- qToStringRegistry <-[Call]- Any?.qToS ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=7] = qAnd() <-[Call]- QMFunc.and() <-[Call]- qToStringRegistry <-[Call]- Any.qToSt ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun qAnd(vararg matches: QMFunc): QMFunc = QMatchFuncAnd(*matches) -// CallChain[size=6] = QMFunc.and() <-[Call]- qToStringRegistry <-[Call]- Any?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=6] = QMFunc.and() <-[Call]- qToStringRegistry <-[Call]- Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private infix fun QMFunc.and(match: QMFunc): QMFunc { return if (this is QMatchFuncAnd) { QMatchFuncAnd(*matchList, match) @@ -465,91 +461,91 @@ private infix fun QMFunc.and(match: QMFunc): QMFunc { } } -// CallChain[size=8] = QMatchFuncAny <-[Call]- QMFunc.isAny() <-[Propag]- QMFunc.IncludeExtensionsIn ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=8] = QMatchFuncAny <-[Call]- QMFunc.isAny() <-[Propag]- QMFunc.IncludeExtensionsIn ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private object QMatchFuncAny : QMFuncA() { - // CallChain[size=9] = QMatchFuncAny.matches() <-[Propag]- QMatchFuncAny <-[Call]- QMFunc.isAny() <- ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=9] = QMatchFuncAny.matches() <-[Propag]- QMatchFuncAny <-[Call]- QMFunc.isAny() <- ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun matches(value: KFunction<*>): Boolean { return true } } -// CallChain[size=8] = QMatchFuncNone <-[Call]- QMFunc.isNone() <-[Propag]- QMFunc.IncludeExtensions ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=8] = QMatchFuncNone <-[Call]- QMFunc.isNone() <-[Propag]- QMFunc.IncludeExtensions ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private object QMatchFuncNone : QMFuncA() { - // CallChain[size=9] = QMatchFuncNone.matches() <-[Propag]- QMatchFuncNone <-[Call]- QMFunc.isNone() ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=9] = QMatchFuncNone.matches() <-[Propag]- QMatchFuncNone <-[Call]- QMFunc.isNone() ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun matches(value: KFunction<*>): Boolean { return false } } -// CallChain[size=7] = QMatchFuncDeclaredOnly <-[Call]- QMFunc.DeclaredOnly <-[Call]- qToStringRegis ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=7] = QMatchFuncDeclaredOnly <-[Call]- QMFunc.DeclaredOnly <-[Call]- qToStringRegis ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private object QMatchFuncDeclaredOnly : QMFuncA() { - // CallChain[size=8] = QMatchFuncDeclaredOnly.declaredOnly <-[Propag]- QMatchFuncDeclaredOnly <-[Cal ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=8] = QMatchFuncDeclaredOnly.declaredOnly <-[Propag]- QMatchFuncDeclaredOnly <-[Cal ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override val declaredOnly = true - // CallChain[size=8] = QMatchFuncDeclaredOnly.matches() <-[Propag]- QMatchFuncDeclaredOnly <-[Call]- ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=8] = QMatchFuncDeclaredOnly.matches() <-[Propag]- QMatchFuncDeclaredOnly <-[Call]- ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun matches(value: KFunction<*>): Boolean { return true } } -// CallChain[size=7] = QMatchFuncIncludeExtensionsInClass <-[Call]- QMFunc.IncludeExtensionsInClass ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=7] = QMatchFuncIncludeExtensionsInClass <-[Call]- QMFunc.IncludeExtensionsInClass ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private object QMatchFuncIncludeExtensionsInClass : QMFuncA() { - // CallChain[size=8] = QMatchFuncIncludeExtensionsInClass.includeExtensionsInClass <-[Propag]- QMatc ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=8] = QMatchFuncIncludeExtensionsInClass.includeExtensionsInClass <-[Propag]- QMatc ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override val includeExtensionsInClass = true - // CallChain[size=8] = QMatchFuncIncludeExtensionsInClass.matches() <-[Propag]- QMatchFuncIncludeExt ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=8] = QMatchFuncIncludeExtensionsInClass.matches() <-[Propag]- QMatchFuncIncludeExt ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun matches(value: KFunction<*>): Boolean { return true } } -// CallChain[size=7] = QMatchFuncAnd <-[Ref]- QMFunc.and() <-[Call]- qToStringRegistry <-[Call]- Any ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=7] = QMatchFuncAnd <-[Ref]- QMFunc.and() <-[Call]- qToStringRegistry <-[Call]- Any ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private class QMatchFuncAnd(vararg match: QMFunc) : QMFuncA() { - // CallChain[size=7] = QMatchFuncAnd.matchList <-[Call]- QMFunc.and() <-[Call]- qToStringRegistry <- ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=7] = QMatchFuncAnd.matchList <-[Call]- QMFunc.and() <-[Call]- qToStringRegistry <- ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val matchList = match - // CallChain[size=8] = QMatchFuncAnd.declaredOnly <-[Propag]- QMatchFuncAnd.matchList <-[Call]- QMFu ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=8] = QMatchFuncAnd.declaredOnly <-[Propag]- QMatchFuncAnd.matchList <-[Call]- QMFu ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override val declaredOnly = matchList.any { it.declaredOnly } - // CallChain[size=8] = QMatchFuncAnd.includeExtensionsInClass <-[Propag]- QMatchFuncAnd.matchList <- ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=8] = QMatchFuncAnd.includeExtensionsInClass <-[Propag]- QMatchFuncAnd.matchList <- ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override val includeExtensionsInClass: Boolean = matchList.any { it.includeExtensionsInClass } - // CallChain[size=8] = QMatchFuncAnd.matches() <-[Propag]- QMatchFuncAnd.matchList <-[Call]- QMFunc. ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=8] = QMatchFuncAnd.matches() <-[Propag]- QMatchFuncAnd.matchList <-[Call]- QMFunc. ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun matches(value: KFunction<*>): Boolean { return matchList.all { it.matches(value) } } } -// CallChain[size=9] = QMFuncA <-[Call]- QMatchFuncNone <-[Call]- QMFunc.isNone() <-[Propag]- QMFunc ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=9] = QMFuncA <-[Call]- QMatchFuncNone <-[Call]- QMFunc.isNone() <-[Propag]- QMFunc ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private abstract class QMFuncA : QMFunc { - // CallChain[size=10] = QMFuncA.declaredOnly <-[Propag]- QMFuncA <-[Call]- QMatchFuncNone <-[Call]- ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=10] = QMFuncA.declaredOnly <-[Propag]- QMFuncA <-[Call]- QMatchFuncNone <-[Call]- ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override val declaredOnly: Boolean = false - // CallChain[size=10] = QMFuncA.includeExtensionsInClass <-[Propag]- QMFuncA <-[Call]- QMatchFuncNon ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=10] = QMFuncA.includeExtensionsInClass <-[Propag]- QMFuncA <-[Call]- QMatchFuncNon ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override val includeExtensionsInClass: Boolean = false } -// CallChain[size=7] = QMFunc <-[Ref]- QMFunc.IncludeExtensionsInClass <-[Call]- qToStringRegistry < ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=7] = QMFunc <-[Ref]- QMFunc.IncludeExtensionsInClass <-[Call]- qToStringRegistry < ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private interface QMFunc { - // CallChain[size=7] = QMFunc.declaredOnly <-[Propag]- QMFunc.IncludeExtensionsInClass <-[Call]- qTo ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=7] = QMFunc.declaredOnly <-[Propag]- QMFunc.IncludeExtensionsInClass <-[Call]- qTo ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val declaredOnly: Boolean - // CallChain[size=7] = QMFunc.includeExtensionsInClass <-[Propag]- QMFunc.IncludeExtensionsInClass < ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=7] = QMFunc.includeExtensionsInClass <-[Propag]- QMFunc.IncludeExtensionsInClass < ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val includeExtensionsInClass: Boolean - // CallChain[size=7] = QMFunc.matches() <-[Propag]- QMFunc.IncludeExtensionsInClass <-[Call]- qToStr ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=7] = QMFunc.matches() <-[Propag]- QMFunc.IncludeExtensionsInClass <-[Call]- qToStr ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun matches(value: KFunction<*>): Boolean - // CallChain[size=7] = QMFunc.isAny() <-[Propag]- QMFunc.IncludeExtensionsInClass <-[Call]- qToStrin ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=7] = QMFunc.isAny() <-[Propag]- QMFunc.IncludeExtensionsInClass <-[Call]- qToStrin ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun isAny(): Boolean = this == QMatchFuncAny - // CallChain[size=7] = QMFunc.isNone() <-[Propag]- QMFunc.IncludeExtensionsInClass <-[Call]- qToStri ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=7] = QMFunc.isNone() <-[Propag]- QMFunc.IncludeExtensionsInClass <-[Call]- qToStri ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun isNone(): Boolean = this == QMatchFuncNone companion object { - // CallChain[size=6] = QMFunc.DeclaredOnly <-[Call]- qToStringRegistry <-[Call]- Any?.qToString() <- ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=6] = QMFunc.DeclaredOnly <-[Call]- qToStringRegistry <-[Call]- Any.qToString() <-[ ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val DeclaredOnly: QMFunc = QMatchFuncDeclaredOnly - // CallChain[size=6] = QMFunc.IncludeExtensionsInClass <-[Call]- qToStringRegistry <-[Call]- Any?.qT ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=6] = QMFunc.IncludeExtensionsInClass <-[Call]- qToStringRegistry <-[Call]- Any.qTo ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] // TODO OnlyExtensionsInClass val IncludeExtensionsInClass: QMFunc = QMatchFuncIncludeExtensionsInClass @@ -558,7 +554,7 @@ private interface QMFunc { // TODO vararg, nullability, param names, type parameter // TODO handle createType() more carefully - // CallChain[size=6] = QMFunc.nameExact() <-[Call]- qToStringRegistry <-[Call]- Any?.qToString() <-[ ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=6] = QMFunc.nameExact() <-[Call]- qToStringRegistry <-[Call]- Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun nameExact(text: String, ignoreCase: Boolean = false): QMFunc { return QMatchFuncName(QM.exact(text, ignoreCase = ignoreCase)) } @@ -567,20 +563,20 @@ private interface QMFunc { } } -// CallChain[size=7] = QMatchFuncName <-[Call]- QMFunc.nameExact() <-[Call]- qToStringRegistry <-[Ca ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=7] = QMatchFuncName <-[Call]- QMFunc.nameExact() <-[Call]- qToStringRegistry <-[Ca ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private class QMatchFuncName(val nameMatcher: QM) : QMFuncA() { - // CallChain[size=8] = QMatchFuncName.matches() <-[Propag]- QMatchFuncName <-[Call]- QMFunc.nameExac ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=8] = QMatchFuncName.matches() <-[Propag]- QMatchFuncName <-[Call]- QMFunc.nameExac ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun matches(value: KFunction<*>): Boolean { return nameMatcher.matches(value.name) } - // CallChain[size=8] = QMatchFuncName.toString() <-[Propag]- QMatchFuncName <-[Call]- QMFunc.nameExa ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=8] = QMatchFuncName.toString() <-[Propag]- QMatchFuncName <-[Call]- QMFunc.nameExa ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun toString(): String { return this::class.simpleName + ":" + nameMatcher.toString() } } -// CallChain[size=4] = not <-[Call]- QMMethod.notAnnotation() <-[Call]- qTest() <-[Call]- main()[Root] +// CallChain[size=4] = QMMethod.not <-[Call]- QMMethod.notAnnotation() <-[Call]- qTest() <-[Call]- main()[Root] private val QMMethod.not: QMMethod get() = QMatchMethodNot(this) @@ -608,9 +604,9 @@ private infix fun QMMethod.or(match: QMMethod): QMMethod { } } -// CallChain[size=5] = QMatchMethodNot <-[Call]- not <-[Call]- QMMethod.notAnnotation() <-[Call]- qTest() <-[Call]- main()[Root] +// CallChain[size=5] = QMatchMethodNot <-[Call]- QMMethod.not <-[Call]- QMMethod.notAnnotation() <-[Call]- qTest() <-[Call]- main()[Root] private class QMatchMethodNot(val matcher: QMMethod) : QMMethodA() { - // CallChain[size=6] = QMatchMethodNot.matches() <-[Propag]- QMatchMethodNot <-[Call]- not <-[Call]- QMMethod.notAnnotation() <-[Call]- qTest() <-[Call]- main()[Root] + // CallChain[size=6] = QMatchMethodNot.matches() <-[Propag]- QMatchMethodNot <-[Call]- QMMethod.not <-[Call]- QMMethod.notAnnotation() <-[Call]- qTest() <-[Call]- main()[Root] override fun matches(value: Method): Boolean = !matcher.matches(value) } @@ -805,7 +801,7 @@ private data class QTestResultElement(val method: Method, val cause: Throwable?) get() = cause == null } -// CallChain[size=5] = allTestedMethods <-[Call]- QTestResult.printIt() <-[Call]- qTestMethods() <-[Call]- qTest() <-[Call]- main()[Root] +// CallChain[size=5] = List.allTestedMethods <-[Call]- QTestResult.printIt() <-[Call]- qTestMethods() <-[Call]- qTest() <-[Call]- main()[Root] private val List.allTestedMethods: String get() = "\n[${"Tested".light_blue}]\n" + @@ -865,7 +861,7 @@ private class QTestResult(val elements: List, val time: Long """(.*($ta|${ta}Kt).*?)\(""" }.re - val stackStr = stackColoringRegex.replace(cause.mySrcAndStack, "$1".qColor(QShColor.BLUE) + "(") + val stackStr = stackColoringRegex.replace(cause.mySrcAndStack, "$1".qColor(QShColor.Blue) + "(") cause.message + "\n\n" + stackStr } else { @@ -901,7 +897,7 @@ private fun qTestMethods( val timeItResult = qTimeIt(quiet = true) { for (method in methodsToTest) { // "⭐" - out.println(qSeparatorWithLabel("${QMyMark.TEST_METHOD} " + method.qName(true))) + out.println(qSeparatorWithLabel("${QMyMark.test_method} " + method.qName(true))) method.qTrySetAccessible() @@ -1017,7 +1013,7 @@ private fun qTest( qLogStackFrames( // "🚀" - msg = "${QMyMark.TEST_START} Test Start ${QMyMark.TEST_START}\n$targets".light_blue, + msg = "${QMyMark.test_start} Test Start ${QMyMark.test_start}\n$targets".light_blue, style = QLogStyle.MSG_AND_STACK, frames = listOf( qStackFrameEntryMethod { frame -> @@ -1047,32 +1043,32 @@ private fun qTest( } } -// CallChain[size=3] = qFailMsg() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=3] = qFailMsg() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun qFailMsg(msg: String = "it is null"): String { val cMsg = "[$msg]".colorIt - return "${QMyMark.WARN} $cMsg" + return "${QMyMark.warn} $cMsg" } -// CallChain[size=3] = qFailMsg() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=3] = qFailMsg() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun qFailMsg(actual: Any?, msg: String = "is not equals to", expected: Any?): String { val cMsg = "[$msg]".colorIt val actualStr = actual.qToLogString() + " " + "(actual)".light_green val expectedStr = expected.qToLogString() + " " + "(expected)".blue - return "${QMyMark.WARN} ${actualStr.qWithNewLineSurround(onlyIf = QOnlyIfStr.Always)}$cMsg${ + return "${QMyMark.warn} ${actualStr.qWithNewLineSurround(onlyIf = QOnlyIfStr.Always)}$cMsg${ expectedStr.qWithNewLinePrefix(onlyIf = QOnlyIfStr.Always) }" } -// CallChain[size=4] = colorIt <-[Call]- qFailMsg() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=4] = String.colorIt <-[Call]- qFailMsg() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private val String.colorIt: String get() = this.light_yellow -// CallChain[size=3] = qThrowIt() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=3] = qThrowIt() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun qThrowIt(msg: String, exception: QE) { throw QException(exception, msg, null, stackDepth = 2, srcCut = QSrcCut.MULTILINE_INFIX_NOCUT) } -// CallChain[size=2] = Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=2] = Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private infix fun Any?.shouldBe(expected: Any?) { if (!qOkToTest()) return @@ -1091,7 +1087,7 @@ private infix fun Any?.shouldBe(expected: Any?) { val thisStr = this.qToLogString() val expectedStr = expected.qToLogString() - if (thisStr.trim().noColor != expectedStr.trim().noColor) { + if (thisStr.trim().noStyle != expectedStr.trim().noStyle) { val msg = qFailMsg(thisStr, "is not equals to", expectedStr) val diffIdx = @@ -1132,18 +1128,18 @@ private infix fun Any?.shouldBe(expected: Any?) { } } -// CallChain[size=3] = qOkToTest() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=3] = qOkToTest() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private inline fun qOkToTest(): Boolean { return QMyTest.forceTestMode || qIsTesting || qIsDebugging } -// CallChain[size=3] = Char.qToHex() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=3] = Char.qToHex() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun Char.qToHex(): String = String.format("%02X", code) -// CallChain[size=13] = qDEFAULT_CACHE_IT_EXPIRATION_CHECK_INTERVAL <-[Call]- QCacheMap.QCacheMap() ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=13] = qDEFAULT_CACHE_IT_EXPIRATION_CHECK_INTERVAL <-[Call]- QCacheMap.QCacheMap() ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private const val qDEFAULT_CACHE_IT_EXPIRATION_CHECK_INTERVAL = 1000L -// CallChain[size=11] = qThreadLocalCache <-[Call]- qCacheItTimedThreadLocal() <-[Call]- qCacheItOne ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=11] = qThreadLocalCache <-[Call]- qCacheItTimedThreadLocal() <-[Call]- qCacheItOne ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private val qThreadLocalCache: ThreadLocal by lazy { ThreadLocal.withInitial { QCacheMap( @@ -1152,44 +1148,44 @@ private val qThreadLocalCache: ThreadLocal by lazy { } } -// CallChain[size=12] = qCacheThreadSafe <-[Call]- qCacheItTimed() <-[Call]- qCacheItOneSec() <-[Cal ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=12] = qCacheThreadSafe <-[Call]- qCacheItTimed() <-[Call]- qCacheItOneSec() <-[Cal ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private val qCacheThreadSafe: QCacheMap by lazy { QCacheMap(qDEFAULT_CACHE_IT_EXPIRATION_CHECK_INTERVAL, true) } -// CallChain[size=10] = qCacheItOneSec() <-[Call]- qMySrcLinesAtFrame() <-[Call]- qLogStackFrames() ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=10] = qCacheItOneSec() <-[Call]- qMySrcLinesAtFrame() <-[Call]- qLogStackFrames() ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun qCacheItOneSec(key: K, block: () -> V): V = qCacheItTimed(key, 1000L, block) -// CallChain[size=11] = qCacheItTimed() <-[Call]- qCacheItOneSec() <-[Call]- qMySrcLinesAtFrame() <- ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=11] = qCacheItTimed() <-[Call]- qCacheItOneSec() <-[Call]- qMySrcLinesAtFrame() <- ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun qCacheItTimed(key: K, duration: Long, block: () -> V): V = qCacheThreadSafe.getOrPut(key) { QCacheEntry(block(), duration, qNow) }.value as V -// CallChain[size=9] = qCacheItOneSecThreadLocal() <-[Call]- qRe() <-[Call]- String.qReplaceFirstIfN ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=9] = qCacheItOneSecThreadLocal() <-[Call]- qRe() <-[Call]- QException.mySrcAndStac ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun qCacheItOneSecThreadLocal(key: K, block: () -> V): V = qCacheItTimedThreadLocal(key, 1000L, block) -// CallChain[size=10] = qCacheItTimedThreadLocal() <-[Call]- qCacheItOneSecThreadLocal() <-[Call]- q ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=10] = qCacheItTimedThreadLocal() <-[Call]- qCacheItOneSecThreadLocal() <-[Call]- q ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun qCacheItTimedThreadLocal(key: K, duration: Long, block: () -> V): V = qThreadLocalCache.get().getOrPut(key) { QCacheEntry(block(), duration, qNow) }.value as V -// CallChain[size=12] = QCacheMap <-[Ref]- qThreadLocalCache <-[Call]- qCacheItTimedThreadLocal() <- ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=12] = QCacheMap <-[Ref]- qThreadLocalCache <-[Call]- qCacheItTimedThreadLocal() <- ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private class QCacheMap( val expirationCheckInterval: Long = qDEFAULT_CACHE_IT_EXPIRATION_CHECK_INTERVAL, val threadSafe: Boolean = false ) { - // CallChain[size=12] = QCacheMap.lastCheck <-[Call]- QCacheMap.getOrPut() <-[Call]- qCacheItTimedTh ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=12] = QCacheMap.lastCheck <-[Call]- QCacheMap.getOrPut() <-[Call]- qCacheItTimedTh ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] var lastCheck: Long = -1 - // CallChain[size=12] = QCacheMap.lock <-[Call]- QCacheMap.getOrPut() <-[Call]- qCacheItTimedThreadL ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=12] = QCacheMap.lock <-[Call]- QCacheMap.getOrPut() <-[Call]- qCacheItTimedThreadL ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val lock: ReentrantLock = ReentrantLock() - // CallChain[size=12] = QCacheMap.map <-[Call]- QCacheMap.getOrPut() <-[Call]- qCacheItTimedThreadLo ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=12] = QCacheMap.map <-[Call]- QCacheMap.getOrPut() <-[Call]- qCacheItTimedThreadLo ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val map: MutableMap = mutableMapOf() - // CallChain[size=12] = QCacheMap.clearExpired() <-[Call]- QCacheMap.getOrPut() <-[Call]- qCacheItTi ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=12] = QCacheMap.clearExpired() <-[Call]- QCacheMap.getOrPut() <-[Call]- qCacheItTi ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun clearExpired(): Int = lock.qWithLock(threadSafe) { val toRemove = map.filterValues { it.isExpired() } toRemove.forEach { map.remove(it.key) } return toRemove.count() } - // CallChain[size=11] = QCacheMap.getOrPut() <-[Call]- qCacheItTimedThreadLocal() <-[Call]- qCacheIt ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=11] = QCacheMap.getOrPut() <-[Call]- qCacheItTimedThreadLocal() <-[Call]- qCacheIt ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun getOrPut(key: Any, defaultValue: () -> QCacheEntry): QCacheEntry = lock.qWithLock(threadSafe) { val now = qNow if (now - lastCheck > expirationCheckInterval) { @@ -1201,13 +1197,13 @@ private class QCacheMap( } } -// CallChain[size=11] = QCacheEntry <-[Call]- qCacheItTimedThreadLocal() <-[Call]- qCacheItOneSecThr ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=11] = QCacheEntry <-[Call]- qCacheItTimedThreadLocal() <-[Call]- qCacheItOneSecThr ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private data class QCacheEntry(val value: Any?, val duration: Long, val creationTime: Long = qNow) { - // CallChain[size=13] = QCacheEntry.isExpired() <-[Call]- QCacheMap.clearExpired() <-[Call]- QCacheM ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=13] = QCacheEntry.isExpired() <-[Call]- QCacheMap.clearExpired() <-[Call]- QCacheM ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun isExpired() = (qNow - creationTime) > duration } -// CallChain[size=12] = Lock.qWithLock() <-[Call]- QCacheMap.getOrPut() <-[Call]- qCacheItTimedThrea ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=12] = Lock.qWithLock() <-[Call]- QCacheMap.getOrPut() <-[Call]- qCacheItTimedThrea ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private inline fun Lock.qWithLock(threadSafe: Boolean, block: () -> T): T { return if (threadSafe) { withLock(block) @@ -1216,7 +1212,7 @@ private inline fun Lock.qWithLock(threadSafe: Boolean, block: () -> T): T { } } -// CallChain[size=12] = QE.throwIt() <-[Call]- qUnreachable() <-[Call]- QFetchRule.SINGLE_LINE <-[Ca ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=12] = QE.throwIt() <-[Call]- qUnreachable() <-[Call]- QFetchRule.SINGLE_LINE <-[Ca ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun QE.throwIt(msg: Any? = "", e: Throwable? = null, stackDepth: Int = 0): Nothing { throw QException( this, @@ -1229,54 +1225,54 @@ private fun QE.throwIt(msg: Any? = "", e: Throwable? = null, stackDepth: Int = 0 ) } -// CallChain[size=13] = QE.throwItFile() <-[Call]- LineNumberReader.qFetchLinesAround() <-[Call]- Pa ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=13] = QE.throwItFile() <-[Call]- LineNumberReader.qFetchLinesAround() <-[Call]- Pa ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun QE.throwItFile(path: Path, e: Throwable? = null, stackDepth: Int = 0): Nothing { throw QException(this, qBrackets("File", path.absolutePathString()), e, stackDepth = stackDepth + 1) } -// CallChain[size=4] = QE.throwItBrackets() <-[Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=4] = QE.throwItBrackets() <-[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun QE.throwItBrackets(vararg keysAndValues: Any?, e: Throwable? = null, stackDepth: Int = 0): Nothing { throw QException(this, qBrackets(*keysAndValues), e, stackDepth = stackDepth + 1) } -// CallChain[size=11] = qUnreachable() <-[Call]- QFetchRule.SINGLE_LINE <-[Call]- QSrcCut.QSrcCut() ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=11] = qUnreachable() <-[Call]- QFetchRule.SINGLE_LINE <-[Call]- QSrcCut.QSrcCut() ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun qUnreachable(msg: Any? = ""): Nothing { QE.Unreachable.throwIt(msg) } -// CallChain[size=5] = QException <-[Call]- QE.throwItBrackets() <-[Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=5] = QException <-[Call]- QE.throwItBrackets() <-[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private class QException( val type: QE = QE.Other, - msg: String = QMyMark.WARN, + msg: String = QMyMark.warn, e: Throwable? = null, val stackDepth: Int = 0, stackSize: Int = 20, - stackFilter: (StackWalker.StackFrame) -> Boolean = QE.STACK_FRAME_FILTER, + stackFilter: (StackWalker.StackFrame) -> Boolean = qSTACK_FRAME_FILTER, private val srcCut: QSrcCut = QSrcCut.MULTILINE_NOCUT, ) : RuntimeException(msg, e) { - // CallChain[size=6] = QException.printStackTrace() <-[Propag]- QException.QException() <-[Ref]- QE. ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=6] = QException.printStackTrace() <-[Propag]- QException.QException() <-[Ref]- QE. ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun printStackTrace(s: PrintStream) { s.println("\n" + qToString() + "\n" + mySrcAndStack) } - // CallChain[size=7] = QException.stackFrames <-[Call]- QException.getStackTrace() <-[Propag]- QExce ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=7] = QException.stackFrames <-[Call]- QException.getStackTrace() <-[Propag]- QExce ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val stackFrames = qStackFrames(stackDepth + 2, size = stackSize, filter = stackFilter) - // CallChain[size=7] = QException.mySrcAndStack <-[Call]- QException.printStackTrace() <-[Propag]- Q ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=7] = QException.mySrcAndStack <-[Call]- QException.printStackTrace() <-[Propag]- Q ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val mySrcAndStack: String by lazy { qLogStackFrames(frames = stackFrames, style = QLogStyle.SRC_AND_STACK, srcCut = srcCut, quiet = true) - .qColorTarget(qRe("""\sshould[a-zA-Z]+"""), QShColor.LIGHT_YELLOW) + .qColorTarget(qRe("""\sshould[a-zA-Z]+"""), QShColor.LightYellow) } - // CallChain[size=6] = QException.getStackTrace() <-[Propag]- QException.QException() <-[Ref]- QE.th ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=6] = QException.getStackTrace() <-[Propag]- QException.QException() <-[Ref]- QE.th ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun getStackTrace(): Array { return stackFrames.map { it.toStackTraceElement() }.toTypedArray() } - // CallChain[size=7] = QException.qToString() <-[Call]- QException.toString() <-[Propag]- QException ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=7] = QException.qToString() <-[Call]- QException.toString() <-[Propag]- QException ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun qToString(): String { val msg = message @@ -1289,7 +1285,7 @@ private class QException( } } - // CallChain[size=6] = QException.toString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=6] = QException.toString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun toString(): String { return qToString() // used by @Test @@ -1304,7 +1300,7 @@ private fun Boolean.qaTrue(exceptionType: QE = QE.ShouldBeTrue, msg: Any? = "") } } -// CallChain[size=12] = T?.qaNotNull() <-[Call]- qSrcFileAtFrame() <-[Call]- qSrcFileLinesAtFrame() ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=12] = T.qaNotNull() <-[Call]- qSrcFileAtFrame() <-[Call]- qSrcFileLinesAtFrame() < ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun T?.qaNotNull(exceptionType: QE = QE.ShouldNotBeNull, msg: Any? = ""): T { if (this != null) { return this @@ -1313,7 +1309,7 @@ private fun T?.qaNotNull(exceptionType: QE = QE.ShouldNotBeNull, msg: } } -// CallChain[size=5] = Int?.qaNotZero() <-[Call]- CharSequence.qMask() <-[Call]- Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=5] = Int.qaNotZero() <-[Call]- CharSequence.qMask() <-[Call]- Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun Int?.qaNotZero(exceptionType: QE = QE.ShouldNotBeZero, msg: Any? = ""): Int { if (this == null) { QE.ShouldNotBeNull.throwIt(stackDepth = 1, msg = msg) @@ -1324,12 +1320,12 @@ private fun Int?.qaNotZero(exceptionType: QE = QE.ShouldNotBeZero, msg: Any? = " } } -// CallChain[size=7] = QExProps <-[Call]- Any.qGetExProp() <-[Call]- children <-[Call]- N.depthFirst ... N.descendants() <-[Call]- N.descendantsList() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=7] = QExProps <-[Call]- Any.qGetExProp() <-[Call]- N.children <-[Call]- N.depthFir ... N.descendants() <-[Call]- N.descendantsList() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] /** * Minimal Version of IdentityWeakHashMap. */ private object QExProps { - // CallChain[size=8] = QExProps.map <-[Call]- QExProps.get() <-[Call]- Any.qGetExProp() <-[Call]- ch ... N.descendants() <-[Call]- N.descendantsList() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=8] = QExProps.map <-[Call]- QExProps.get() <-[Call]- Any.qGetExProp() <-[Call]- N. ... N.descendants() <-[Call]- N.descendantsList() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val map: MutableMap> = HashMap() // CallChain[size=8] = QExProps.removeGarbageCollectedEntries() <-[Call]- QExProps.get() <-[Call]- A ... N.descendants() <-[Call]- N.descendantsList() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] @@ -1337,14 +1333,14 @@ private object QExProps { map.keys.removeIf { it.get() == null } } - // CallChain[size=7] = QExProps.get() <-[Call]- Any.qGetExProp() <-[Call]- children <-[Call]- N.dept ... N.descendants() <-[Call]- N.descendantsList() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=7] = QExProps.get() <-[Call]- Any.qGetExProp() <-[Call]- N.children <-[Call]- N.de ... N.descendants() <-[Call]- N.descendantsList() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun get(key: Any): HashMap? { removeGarbageCollectedEntries() return map[WeakKey(key)] } - // CallChain[size=7] = QExProps.put() <-[Call]- Any.qSetExProp() <-[Call]- children <-[Call]- N.dept ... N.descendants() <-[Call]- N.descendantsList() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=7] = QExProps.put() <-[Call]- Any.qSetExProp() <-[Call]- N.children <-[Call]- N.de ... N.descendants() <-[Call]- N.descendantsList() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun put(key: Any, value: HashMap) { removeGarbageCollectedEntries() @@ -1367,7 +1363,7 @@ private object QExProps { } } -// CallChain[size=6] = Any.qSetExProp() <-[Call]- children <-[Call]- N.depthFirstRecursive() <-[Call]- N.descendants() <-[Call]- N.descendantsList() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=6] = Any.qSetExProp() <-[Call]- N.children <-[Call]- N.depthFirstRecursive() <-[Ca ... N.descendants() <-[Call]- N.descendantsList() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun Any.qSetExProp(key: String, value: Any?) = synchronized(QExProps) { var props = QExProps.get(this) if (props == null) { @@ -1377,60 +1373,60 @@ private fun Any.qSetExProp(key: String, value: Any?) = synchronized(QExProps) { props[key] = value } -// CallChain[size=6] = Any.qGetExProp() <-[Call]- children <-[Call]- N.depthFirstRecursive() <-[Call]- N.descendants() <-[Call]- N.descendantsList() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=6] = Any.qGetExProp() <-[Call]- N.children <-[Call]- N.depthFirstRecursive() <-[Ca ... N.descendants() <-[Call]- N.descendantsList() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun Any.qGetExProp(key: String): Any? = synchronized(QExProps) { val props = QExProps.get(this) ?: return null return props[key] } -// CallChain[size=7] = Any.qGetExPropOrDefault() <-[Call]- Any.qGetExPropOrNull() <-[Call]- children ... N.descendants() <-[Call]- N.descendantsList() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=7] = Any.qGetExPropOrDefault() <-[Call]- Any.qGetExPropOrNull() <-[Call]- N.childr ... N.descendants() <-[Call]- N.descendantsList() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun Any.qGetExPropOrDefault(key: String, default: T): T = synchronized(QExProps) { val props = QExProps.get(this) ?: return default return props.getOrDefault(key, default) as T } -// CallChain[size=6] = Any.qGetExPropOrNull() <-[Call]- children <-[Call]- N.depthFirstRecursive() < ... N.descendants() <-[Call]- N.descendantsList() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=6] = Any.qGetExPropOrNull() <-[Call]- N.children <-[Call]- N.depthFirstRecursive() ... N.descendants() <-[Call]- N.descendantsList() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun Any.qGetExPropOrNull(key: String): Any? = synchronized(QExProps) { return qGetExPropOrDefault(key, null) } -// CallChain[size=13] = qBUFFER_SIZE <-[Call]- Path.qReader() <-[Call]- Path.qFetchLinesAround() <-[ ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=13] = qBUFFER_SIZE <-[Call]- Path.qReader() <-[Call]- Path.qFetchLinesAround() <-[ ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private const val qBUFFER_SIZE = DEFAULT_BUFFER_SIZE -// CallChain[size=13] = QOpenOpt <-[Ref]- Path.qReader() <-[Call]- Path.qFetchLinesAround() <-[Call] ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=13] = QOpenOpt <-[Ref]- Path.qReader() <-[Call]- Path.qFetchLinesAround() <-[Call] ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] // @formatter:off private enum class QOpenOpt(val opt: OpenOption) : QFlagEnum { - // CallChain[size=15] = QOpenOpt.TRUNCATE_EXISTING <-[Propag]- QOpenOpt.QOpenOpt() <-[Call]- QFlag.to ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=15] = QOpenOpt.CREATE <-[Propag]- QOpenOpt.QOpenOpt() <-[Call]- QFlag.to ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] CREATE(StandardOpenOption.CREATE), - // CallChain[size=15] = QOpenOpt.CREATE_NEW <-[Propag]- QOpenOpt.QOpenOpt() <-[Call]- QFlag.toO ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=15] = QOpenOpt.WRITE <-[Propag]- QOpenOpt.QOpenOpt() <-[Call]- QFlag.toO ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] WRITE(StandardOpenOption.WRITE), - // CallChain[size=15] = QOpenOpt.READ <-[Propag]- QOpenOpt.QOpenOpt() <-[Call]- QFlag.toOp ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=15] = QOpenOpt.READ <-[Propag]- QOpenOpt.QOpenOpt() <-[Call]- QFlag.toOp ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] READ(StandardOpenOption.READ), - // CallChain[size=15] = QOpenOpt.APPEND <-[Propag]- QOpenOpt.QOpenOpt() <-[Call]- QFlag.to ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=15] = QOpenOpt.APPEND <-[Propag]- QOpenOpt.QOpenOpt() <-[Call]- QFlag.to ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] APPEND(StandardOpenOption.APPEND), - // CallChain[size=15] = QOpenOpt.DELETE_ON_CLOSE <-[Propag]- QOpenOpt.QOpenOpt() <-[Call]- QFlag.toO ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=15] = QOpenOpt.DSYNC <-[Propag]- QOpenOpt.QOpenOpt() <-[Call]- QFlag.toO ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] DSYNC(StandardOpenOption.DSYNC), - // CallChain[size=15] = QOpenOpt.SYNC <-[Propag]- QOpenOpt.QOpenOpt() <-[Call]- QFlag.toOp ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=15] = QOpenOpt.SYNC <-[Propag]- QOpenOpt.QOpenOpt() <-[Call]- QFlag.toOp ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] SYNC(StandardOpenOption.SYNC), - // CallChain[size=15] = QOpenOpt.SPARSE <-[Propag]- QOpenOpt.QOpenOpt() <-[Call]- QFlag.to ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=15] = QOpenOpt.SPARSE <-[Propag]- QOpenOpt.QOpenOpt() <-[Call]- QFlag.to ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] SPARSE(StandardOpenOption.SPARSE), - // CallChain[size=15] = QOpenOpt.EX_DIRECT <-[Propag]- QOpenOpt.QOpenOpt() <-[Call]- QFlag ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=15] = QOpenOpt.EX_DIRECT <-[Propag]- QOpenOpt.QOpenOpt() <-[Call]- QFlag ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] EX_DIRECT(ExtendedOpenOption.DIRECT), - // CallChain[size=15] = QOpenOpt.EX_NOSHARE_DELETE <-[Propag]- QOpenOpt.QOpenOpt() <-[Call]- QFlag { } } -// CallChain[size=13] = QFlag.toOptEnums() <-[Call]- Path.qReader() <-[Call]- Path.qFetchL ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=13] = QFlag.toOptEnums() <-[Call]- Path.qReader() <-[Call]- Path.qFetchL ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun QFlag.toOptEnums(): Array { return toEnumValues().map { it.opt }.toTypedArray() } -// CallChain[size=12] = Path.qLineSeparator() <-[Call]- Path.qFetchLinesAround() <-[Call]- qSrcFileL ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=12] = Path.qLineSeparator() <-[Call]- Path.qFetchLinesAround() <-[Call]- qSrcFileL ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun Path.qLineSeparator(charset: Charset = Charsets.UTF_8): QLineSeparator { this.bufferedReader(charset).use { reader -> var ch: Char @@ -1467,44 +1463,44 @@ private fun Path.qLineSeparator(charset: Charset = Charsets.UTF_8): QLineSeparat } } -// CallChain[size=11] = QFetchEnd <-[Ref]- QFetchRule.SINGLE_LINE <-[Call]- QSrcCut.QSrcCut() <-[Cal ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=11] = QFetchEnd <-[Ref]- QFetchRule.SINGLE_LINE <-[Call]- QSrcCut.QSrcCut() <-[Cal ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private enum class QFetchEnd { - // CallChain[size=12] = QFetchEnd.FETCH_THIS_LINE_AND_GO_TO_NEXT_LINE <-[Propag]- QFetchEnd.END_WITH ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=12] = QFetchEnd.FETCH_THIS_LINE_AND_GO_TO_NEXT_LINE <-[Propag]- QFetchEnd.END_WITH ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] FETCH_THIS_LINE_AND_GO_TO_NEXT_LINE, - // CallChain[size=11] = QFetchEnd.END_WITH_THIS_LINE <-[Call]- QFetchRule.SINGLE_LINE <-[Call]- QSrc ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=11] = QFetchEnd.END_WITH_THIS_LINE <-[Call]- QFetchRule.SINGLE_LINE <-[Call]- QSrc ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] END_WITH_THIS_LINE, - // CallChain[size=12] = QFetchEnd.END_WITH_NEXT_LINE <-[Propag]- QFetchEnd.END_WITH_THIS_LINE <-[Cal ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=12] = QFetchEnd.END_WITH_NEXT_LINE <-[Propag]- QFetchEnd.END_WITH_THIS_LINE <-[Cal ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] END_WITH_NEXT_LINE, - // CallChain[size=12] = QFetchEnd.END_WITH_PREVIOUS_LINE <-[Propag]- QFetchEnd.END_WITH_THIS_LINE <- ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=12] = QFetchEnd.END_WITH_PREVIOUS_LINE <-[Propag]- QFetchEnd.END_WITH_THIS_LINE <- ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] END_WITH_PREVIOUS_LINE } -// CallChain[size=11] = QFetchStart <-[Ref]- QFetchRule.SINGLE_LINE <-[Call]- QSrcCut.QSrcCut() <-[C ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=11] = QFetchStart <-[Ref]- QFetchRule.SINGLE_LINE <-[Call]- QSrcCut.QSrcCut() <-[C ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private enum class QFetchStart { - // CallChain[size=11] = QFetchStart.FETCH_THIS_LINE_AND_GO_TO_PREVIOUS_LINE <-[Call]- QFetchRule.SIN ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=11] = QFetchStart.FETCH_THIS_LINE_AND_GO_TO_PREVIOUS_LINE <-[Call]- QFetchRule.SIN ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] FETCH_THIS_LINE_AND_GO_TO_PREVIOUS_LINE, - // CallChain[size=11] = QFetchStart.START_FROM_THIS_LINE <-[Call]- QFetchRule.SINGLE_LINE <-[Call]- ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=11] = QFetchStart.START_FROM_THIS_LINE <-[Call]- QFetchRule.SINGLE_LINE <-[Call]- ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] START_FROM_THIS_LINE, - // CallChain[size=12] = QFetchStart.START_FROM_NEXT_LINE <-[Propag]- QFetchStart.FETCH_THIS_LINE_AND ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=12] = QFetchStart.START_FROM_NEXT_LINE <-[Propag]- QFetchStart.FETCH_THIS_LINE_AND ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] START_FROM_NEXT_LINE, - // CallChain[size=12] = QFetchStart.START_FROM_PREVIOUS_LINE <-[Propag]- QFetchStart.FETCH_THIS_LINE ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=12] = QFetchStart.START_FROM_PREVIOUS_LINE <-[Propag]- QFetchStart.FETCH_THIS_LINE ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] START_FROM_PREVIOUS_LINE } -// CallChain[size=11] = QFetchRuleA <-[Call]- QFetchRule.SINGLE_LINE <-[Call]- QSrcCut.QSrcCut() <-[ ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=11] = QFetchRuleA <-[Call]- QFetchRule.SINGLE_LINE <-[Call]- QSrcCut.QSrcCut() <-[ ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private abstract class QFetchRuleA( override val numLinesBeforeTargetLine: Int = 10, override val numLinesAfterTargetLine: Int = 10, ) : QFetchRule -// CallChain[size=10] = QFetchRule <-[Ref]- QSrcCut.QSrcCut() <-[Call]- qLogStackFrames() <-[Call]- ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=10] = QFetchRule <-[Ref]- QSrcCut.QSrcCut() <-[Call]- qLogStackFrames() <-[Call]- ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private interface QFetchRule { - // CallChain[size=11] = QFetchRule.numLinesBeforeTargetLine <-[Propag]- QFetchRule.SINGLE_LINE <-[Ca ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=11] = QFetchRule.numLinesBeforeTargetLine <-[Propag]- QFetchRule.SINGLE_LINE <-[Ca ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val numLinesBeforeTargetLine: Int - // CallChain[size=11] = QFetchRule.numLinesAfterTargetLine <-[Propag]- QFetchRule.SINGLE_LINE <-[Cal ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=11] = QFetchRule.numLinesAfterTargetLine <-[Propag]- QFetchRule.SINGLE_LINE <-[Cal ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val numLinesAfterTargetLine: Int - // CallChain[size=11] = QFetchRule.fetchStartCheck() <-[Propag]- QFetchRule.SINGLE_LINE <-[Call]- QS ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=11] = QFetchRule.fetchStartCheck() <-[Propag]- QFetchRule.SINGLE_LINE <-[Call]- QS ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun fetchStartCheck( line: String, currentLineNumber: Int, @@ -1513,7 +1509,7 @@ private interface QFetchRule { context: MutableSet, ): QFetchStart - // CallChain[size=11] = QFetchRule.fetchEndCheck() <-[Propag]- QFetchRule.SINGLE_LINE <-[Call]- QSrc ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=11] = QFetchRule.fetchEndCheck() <-[Propag]- QFetchRule.SINGLE_LINE <-[Call]- QSrc ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun fetchEndCheck( line: String, currentLineNumber: Int, @@ -1523,7 +1519,7 @@ private interface QFetchRule { ): QFetchEnd companion object { - // CallChain[size=10] = QFetchRule.SINGLE_LINE <-[Call]- QSrcCut.QSrcCut() <-[Call]- qLogStackFrames ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=10] = QFetchRule.SINGLE_LINE <-[Call]- QSrcCut.QSrcCut() <-[Call]- qLogStackFrames ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val SINGLE_LINE = object : QFetchRuleA(0, 0) { override fun fetchStartCheck( line: String, @@ -1550,7 +1546,7 @@ private interface QFetchRule { } } - // CallChain[size=5] = QFetchRule.SMART_FETCH_INFIX <-[Call]- QSrcCut.MULTILINE_INFIX_NOCUT <-[Call]- qThrowIt() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=5] = QFetchRule.SMART_FETCH_INFIX <-[Call]- QSrcCut.MULTILINE_INFIX_NOCUT <-[Call]- qThrowIt() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val SMART_FETCH_INFIX = object : QFetchRuleA(10, 10) { // """ <<< targetLine // some text @@ -1599,7 +1595,7 @@ private interface QFetchRule { } } - // CallChain[size=9] = QFetchRule.SMART_FETCH <-[Call]- qLogStackFrames() <-[Call]- QException.mySrc ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=9] = QFetchRule.SMART_FETCH <-[Call]- qLogStackFrames() <-[Call]- QException.mySrc ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val SMART_FETCH = object : QFetchRuleA(10, 10) { override fun fetchStartCheck( line: String, @@ -1671,7 +1667,7 @@ private interface QFetchRule { } } -// CallChain[size=14] = LineNumberReader.qFetchLinesBetween() <-[Call]- LineNumberReader.qFetchTarge ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=14] = LineNumberReader.qFetchLinesBetween() <-[Call]- LineNumberReader.qFetchTarge ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun LineNumberReader.qFetchLinesBetween( lineNumberStartInclusive: Int, lineNumberEndInclusive: Int, @@ -1698,7 +1694,7 @@ private fun LineNumberReader.qFetchLinesBetween( return lines } -// CallChain[size=14] = TargetSurroundingLines <-[Ref]- LineNumberReader.qFetchTargetSurroundingLine ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=14] = TargetSurroundingLines <-[Ref]- LineNumberReader.qFetchTargetSurroundingLine ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private class TargetSurroundingLines( val targetLineNumber: Int, val startLineNumber: Int, @@ -1707,7 +1703,7 @@ private class TargetSurroundingLines( val linesBeforeTargetLine: List, val linesAfterTargetLine: List, ) { - // CallChain[size=13] = TargetSurroundingLines.linesBetween() <-[Call]- LineNumberReader.qFetchLines ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=13] = TargetSurroundingLines.linesBetween() <-[Call]- LineNumberReader.qFetchLines ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun linesBetween(lineNumberStartInclusive: Int, lineNumberEndInclusive: Int): List { val lines = mutableListOf() @@ -1722,7 +1718,7 @@ private class TargetSurroundingLines( } } -// CallChain[size=13] = LineNumberReader.qFetchTargetSurroundingLines() <-[Call]- LineNumberReader.q ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=13] = LineNumberReader.qFetchTargetSurroundingLines() <-[Call]- LineNumberReader.q ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun LineNumberReader.qFetchTargetSurroundingLines( targetLineNumber: Int, numLinesBeforeTargetLine: Int = 10, @@ -1743,7 +1739,7 @@ private fun LineNumberReader.qFetchTargetSurroundingLines( ) } -// CallChain[size=12] = LineNumberReader.qFetchLinesAround() <-[Call]- Path.qFetchLinesAround() <-[C ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=12] = LineNumberReader.qFetchLinesAround() <-[Call]- Path.qFetchLinesAround() <-[C ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun LineNumberReader.qFetchLinesAround( file: Path, targetLineNumber: Int, @@ -1848,7 +1844,7 @@ private fun LineNumberReader.qFetchLinesAround( } } -// CallChain[size=12] = Path.qReader() <-[Call]- Path.qFetchLinesAround() <-[Call]- qSrcFileLinesAtF ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=12] = Path.qReader() <-[Call]- Path.qFetchLinesAround() <-[Call]- qSrcFileLinesAtF ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun Path.qReader( charset: Charset = Charsets.UTF_8, buffSize: Int = qBUFFER_SIZE, @@ -1857,7 +1853,7 @@ private fun Path.qReader( return LineNumberReader(reader(charset, *opts.toOptEnums()), buffSize) } -// CallChain[size=11] = Path.qFetchLinesAround() <-[Call]- qSrcFileLinesAtFrame() <-[Call]- qMySrcLi ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=11] = Path.qFetchLinesAround() <-[Call]- qSrcFileLinesAtFrame() <-[Call]- qMySrcLi ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun Path.qFetchLinesAround( lineNumber: Int, fetchRule: QFetchRule = QFetchRule.SMART_FETCH, @@ -1882,7 +1878,7 @@ private fun Path.qFetchLinesAround( } } -// CallChain[size=12] = Path.qLineAt() <-[Call]- Path.qFetchLinesAround() <-[Call]- qSrcFileLinesAtF ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=12] = Path.qLineAt() <-[Call]- Path.qFetchLinesAround() <-[Call]- qSrcFileLinesAtF ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun Path.qLineAt( lineNumber: Int, charset: Charset = Charsets.UTF_8, @@ -1905,20 +1901,20 @@ private fun Path.qLineAt( } } -// CallChain[size=13] = QFType <-[Ref]- Collection.qFind() <-[Call]- qSrcFileAtFrame() <-[Call ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=13] = QFType <-[Ref]- Collection.qFind() <-[Call]- qSrcFileAtFrame() <-[Call ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private enum class QFType { - // CallChain[size=17] = QFType.Any <-[Call]- QFType.matches() <-[Call]- Path.qSeq() <-[Call]- Path.q ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=17] = QFType.Any <-[Call]- QFType.matches() <-[Call]- Path.qSeq() <-[Call]- Path.q ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] Any, - // CallChain[size=13] = QFType.File <-[Call]- Collection.qFind() <-[Call]- qSrcFileAtFrame() < ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=13] = QFType.File <-[Call]- Collection.qFind() <-[Call]- qSrcFileAtFrame() < ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] File, - // CallChain[size=17] = QFType.Dir <-[Call]- QFType.matches() <-[Call]- Path.qSeq() <-[Call]- Path.q ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=17] = QFType.Dir <-[Call]- QFType.matches() <-[Call]- Path.qSeq() <-[Call]- Path.q ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] Dir, - // CallChain[size=17] = QFType.SymLink <-[Call]- QFType.matches() <-[Call]- Path.qSeq() <-[Call]- Pa ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=17] = QFType.SymLink <-[Call]- QFType.matches() <-[Call]- Path.qSeq() <-[Call]- Pa ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] SymLink, - // CallChain[size=17] = QFType.FileOrDir <-[Call]- QFType.matches() <-[Call]- Path.qSeq() <-[Call]- ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=17] = QFType.FileOrDir <-[Call]- QFType.matches() <-[Call]- Path.qSeq() <-[Call]- ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] FileOrDir; - // CallChain[size=16] = QFType.matches() <-[Call]- Path.qSeq() <-[Call]- Path.qList() <-[Call]- Path ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=16] = QFType.matches() <-[Call]- Path.qSeq() <-[Call]- Path.qList() <-[Call]- Path ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun matches(path: Path?, followSymLink: Boolean = true): Boolean { if (path == null) return false @@ -1937,7 +1933,7 @@ private enum class QFType { } } -// CallChain[size=12] = Collection.qFind() <-[Call]- qSrcFileAtFrame() <-[Call]- qSrcFileLines ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=12] = Collection.qFind() <-[Call]- qSrcFileAtFrame() <-[Call]- qSrcFileLines ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun Collection.qFind(nameMatcher: QM, type: QFType = QFType.File, maxDepth: Int = 1): Path? { for (path in this) { val found = path.qFind(nameMatcher, type, maxDepth) @@ -1947,7 +1943,7 @@ private fun Collection.qFind(nameMatcher: QM, type: QFType = QFType.File, return null } -// CallChain[size=13] = Path.qFind() <-[Call]- Collection.qFind() <-[Call]- qSrcFileAtFrame() ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=13] = Path.qFind() <-[Call]- Collection.qFind() <-[Call]- qSrcFileAtFrame() ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun Path.qFind(nameMatcher: QM, type: QFType = QFType.File, maxDepth: Int = 1): Path? { return try { qList(type, maxDepth = maxDepth) { @@ -1958,7 +1954,7 @@ private fun Path.qFind(nameMatcher: QM, type: QFType = QFType.File, maxDepth: In } } -// CallChain[size=10] = Path.qListByMatch() <-[Call]- QMyPath.src_root <-[Call]- qLogStackFrames() < ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=10] = Path.qListByMatch() <-[Call]- QMyPath.src_root <-[Call]- qLogStackFrames() < ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun Path.qListByMatch( nameMatch: QM, type: QFType = QFType.File, @@ -1972,7 +1968,7 @@ private fun Path.qListByMatch( } } -// CallChain[size=14] = Path.qList() <-[Call]- Path.qFind() <-[Call]- Collection.qFind() <-[Ca ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=14] = Path.qList() <-[Call]- Path.qFind() <-[Call]- Collection.qFind() <-[Ca ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun Path.qList( type: QFType = QFType.File, maxDepth: Int = 1, @@ -1991,7 +1987,7 @@ private fun Path.qList( ).toList() } -// CallChain[size=15] = Path.qSeq() <-[Call]- Path.qList() <-[Call]- Path.qFind() <-[Call]- Collecti ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=15] = Path.qSeq() <-[Call]- Path.qList() <-[Call]- Path.qFind() <-[Call]- Collecti ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun Path.qSeq( type: QFType = QFType.File, maxDepth: Int = 1, @@ -2019,23 +2015,23 @@ private fun Path.qSeq( } } -// CallChain[size=13] = QFlag <-[Ref]- Path.qReader() <-[Call]- Path.qFetchLinesAround() <-[Call]- q ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=13] = QFlag <-[Ref]- Path.qReader() <-[Call]- Path.qFetchLinesAround() <-[Call]- q ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] /** * Only Enum or QFlag can implement this interface. */ private sealed interface QFlag where T : QFlag, T : Enum { - // CallChain[size=15] = QFlag.bits <-[Propag]- QFlag.toEnumValues() <-[Call]- QFlag.toOptE ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=15] = QFlag.bits <-[Propag]- QFlag.toEnumValues() <-[Call]- QFlag.toOptE ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val bits: Int - // CallChain[size=15] = QFlag.contains() <-[Propag]- QFlag.toEnumValues() <-[Call]- QFlag. ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=15] = QFlag.contains() <-[Propag]- QFlag.toEnumValues() <-[Call]- QFlag. ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun contains(flags: QFlag): Boolean { return (bits and flags.bits) == flags.bits } - // CallChain[size=14] = QFlag.toEnumValues() <-[Call]- QFlag.toOptEnums() <-[Call]- Path.q ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=14] = QFlag.toEnumValues() <-[Call]- QFlag.toOptEnums() <-[Call]- Path.q ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun toEnumValues(): List - // CallChain[size=15] = QFlag.str() <-[Propag]- QFlag.toEnumValues() <-[Call]- QFlag.toOpt ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=15] = QFlag.str() <-[Propag]- QFlag.toEnumValues() <-[Call]- QFlag.toOpt ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun str(): String { return toEnumValues().joinToString(", ") { it.name } } @@ -2044,7 +2040,7 @@ private sealed interface QFlag where T : QFlag, T : Enum { // https://discuss.kotlinlang.org/t/reified-generics-on-class-level/16711/2 // But, can't make constructor private ... - // CallChain[size=13] = QFlag.none() <-[Call]- Path.qReader() <-[Call]- Path.qFetchLinesAround() <-[ ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=13] = QFlag.none() <-[Call]- Path.qReader() <-[Call]- Path.qFetchLinesAround() <-[ ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] inline fun none(): QFlag where T : QFlag, T : Enum { return QFlagSet(T::class, 0) @@ -2052,24 +2048,24 @@ private sealed interface QFlag where T : QFlag, T : Enum { } } -// CallChain[size=14] = QFlagEnum <-[Ref]- QOpenOpt <-[Ref]- Path.qReader() <-[Call]- Path.qFetchLin ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=14] = QFlagEnum <-[Ref]- QOpenOpt <-[Ref]- Path.qReader() <-[Call]- Path.qFetchLin ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private interface QFlagEnum : QFlag where T : QFlag, T : Enum { - // CallChain[size=15] = QFlagEnum.bits <-[Propag]- QFlagEnum <-[Ref]- QOpenOpt <-[Ref]- Path.qReader ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=15] = QFlagEnum.bits <-[Propag]- QFlagEnum <-[Ref]- QOpenOpt <-[Ref]- Path.qReader ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override val bits: Int get() = 1 shl (this as T).ordinal - // CallChain[size=15] = QFlagEnum.toEnumValues() <-[Propag]- QFlagEnum <-[Ref]- QOpenOpt <-[Ref]- Pa ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=15] = QFlagEnum.toEnumValues() <-[Propag]- QFlagEnum <-[Ref]- QOpenOpt <-[Ref]- Pa ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun toEnumValues(): List = listOf(this) as List } -// CallChain[size=14] = QFlagSet <-[Call]- QFlag.none() <-[Call]- Path.qReader() <-[Call]- Path.qFet ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=14] = QFlagSet <-[Call]- QFlag.none() <-[Call]- Path.qReader() <-[Call]- Path.qFet ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] /** * Mutable bit flag */ private class QFlagSet(val enumClass: KClass, override var bits: Int) : QFlag where T : QFlag, T : Enum { - // CallChain[size=16] = QFlagSet.enumValues <-[Call]- QFlagSet.toEnumValues() <-[Propag]- QFlagSet < ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=16] = QFlagSet.enumValues <-[Call]- QFlagSet.toEnumValues() <-[Propag]- QFlagSet < ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val enumValues: Array by lazy { enumClass.qEnumValues() } - // CallChain[size=15] = QFlagSet.toEnumValues() <-[Propag]- QFlagSet <-[Call]- QFlag.none() <-[Call] ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=15] = QFlagSet.toEnumValues() <-[Propag]- QFlagSet <-[Call]- QFlag.none() <-[Call] ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun toEnumValues(): List = enumValues.filter { contains(it) } } @@ -2098,7 +2094,7 @@ private fun Long.qFormatDuration(unit: QUnit = QUnit.Nano): String { QUnit.Milli -> Duration.ofMillis(this).qFormat() QUnit.Micro -> - Duration.ofNanos(this).qFormat() + Duration.ofNanos(this * 1000).qFormat() QUnit.Nano -> Duration.ofNanos(this).qFormat() QUnit.Second -> @@ -2124,6 +2120,10 @@ private fun Duration.qToNanoOnlyPart(): Int { // CallChain[size=7] = Duration.qFormat() <-[Call]- Long.qFormatDuration() <-[Call]- QTestResult.str <-[Call]- QTestResult.printIt() <-[Call]- qTestMethods() <-[Call]- qTest() <-[Call]- main()[Root] private fun Duration.qFormat(detail: Boolean = false): String { + if(this.isZero) { + return "0" + } + val du = abs() val maxUnit: QUnit = du.let { @@ -2199,16 +2199,16 @@ private fun Duration.qFormat(detail: Boolean = false): String { return parts.joinToString(" ") } -// CallChain[size=12] = qARROW <-[Call]- qArrow() <-[Call]- QLogStyle.qLogArrow() <-[Call]- QLogStyl ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=12] = qARROW <-[Call]- qArrow() <-[Call]- QLogStyle.qLogArrow() <-[Call]- QLogStyl ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private val qARROW = "===>".light_cyan -// CallChain[size=4] = qIsDebugging <-[Call]- qOkToTest() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=4] = qIsDebugging <-[Call]- qOkToTest() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] // https://stackoverflow.com/a/28754689/5570400 private val qIsDebugging by lazy { java.lang.management.ManagementFactory.getRuntimeMXBean().inputArguments.toString().indexOf("jdwp") >= 0 } -// CallChain[size=4] = qIsTesting <-[Call]- qOkToTest() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=4] = qIsTesting <-[Call]- qOkToTest() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] // https://stackoverflow.com/a/12717377/5570400 private val qIsTesting by lazy { qStackFrames(size = Int.MAX_VALUE).any { @@ -2217,30 +2217,30 @@ private val qIsTesting by lazy { } } -// CallChain[size=6] = QSrcCut <-[Ref]- QException.QException() <-[Ref]- QE.throwItBrackets() <-[Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=6] = QSrcCut <-[Ref]- QException.QException() <-[Ref]- QE.throwItBrackets() <-[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private class QSrcCut( val fetchRule: QFetchRule = QFetchRule.SINGLE_LINE, val cut: (srcLines: String) -> String, ) { companion object { - // CallChain[size=10] = QSrcCut.CUT_PARAM_qLog <-[Call]- QSrcCut.SINGLE_qLog_PARAM <-[Call]- qLogSta ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=10] = QSrcCut.CUT_PARAM_qLog <-[Call]- QSrcCut.SINGLE_qLog_PARAM <-[Call]- qLogSta ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private val CUT_PARAM_qLog = { mySrc: String -> mySrc.replaceFirst("""(?s)^\s*(\S.+)\.qLog[a-zA-Z]{0,10}.*$""".re, "$1") } - // CallChain[size=9] = QSrcCut.SINGLE_qLog_PARAM <-[Call]- qLogStackFrames() <-[Call]- QException.my ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=9] = QSrcCut.SINGLE_qLog_PARAM <-[Call]- qLogStackFrames() <-[Call]- QException.my ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val SINGLE_qLog_PARAM = QSrcCut(QFetchRule.SINGLE_LINE, CUT_PARAM_qLog) - // CallChain[size=6] = QSrcCut.MULTILINE_NOCUT <-[Call]- QException.QException() <-[Ref]- QE.throwIt ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=6] = QSrcCut.MULTILINE_NOCUT <-[Call]- QException.QException() <-[Ref]- QE.throwIt ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val MULTILINE_NOCUT = QSrcCut(QFetchRule.SMART_FETCH) { it } - // CallChain[size=4] = QSrcCut.MULTILINE_INFIX_NOCUT <-[Call]- qThrowIt() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=4] = QSrcCut.MULTILINE_INFIX_NOCUT <-[Call]- qThrowIt() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val MULTILINE_INFIX_NOCUT = QSrcCut(QFetchRule.SMART_FETCH_INFIX) { it } - // CallChain[size=10] = QSrcCut.NOCUT_JUST_SINGLE_LINE <-[Call]- qMySrcLinesAtFrame() <-[Call]- qLog ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=10] = QSrcCut.NOCUT_JUST_SINGLE_LINE <-[Call]- qMySrcLinesAtFrame() <-[Call]- qLog ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val NOCUT_JUST_SINGLE_LINE = QSrcCut(QFetchRule.SINGLE_LINE) { it } } } -// CallChain[size=9] = QLogStyle <-[Ref]- QLogStyle.SRC_AND_STACK <-[Call]- QException.mySrcAndStack ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=9] = QLogStyle <-[Ref]- QLogStyle.SRC_AND_STACK <-[Call]- QException.mySrcAndStack ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private class QLogStyle( val stackSize: Int, val out: QOut = QMyLog.out, @@ -2251,17 +2251,17 @@ private class QLogStyle( ) { @Suppress("UNUSED_PARAMETER") companion object { - // CallChain[size=9] = QLogStyle.String.clarifySrcRegion() <-[Call]- QLogStyle.SRC_AND_STACK <-[Call ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=9] = QLogStyle.String.clarifySrcRegion() <-[Call]- QLogStyle.SRC_AND_STACK <-[Call ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun String.clarifySrcRegion(onlyIf: QOnlyIfStr = QOnlyIfStr.Multiline): String { if (!onlyIf.matches(this)) return this - return """${"SRC START ―――――――――――".qColor(QShColor.CYAN)} + return """${"SRC START ―――――――――――".qColor(QShColor.Cyan)} ${this.trim()} -${"SRC END ―――――――――――".qColor(QShColor.CYAN)}""" +${"SRC END ―――――――――――".qColor(QShColor.Cyan)}""" } - // CallChain[size=10] = QLogStyle.qLogArrow() <-[Call]- QLogStyle.S <-[Call]- qLogStackFrames() <-[C ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=10] = QLogStyle.qLogArrow() <-[Call]- QLogStyle.S <-[Call]- qLogStackFrames() <-[C ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun qLogArrow(mySrc: String, msg: String): String { return if (mySrc.startsWith("\"") && mySrc.endsWith("\"") && mySrc.substring(1, mySrc.length - 1) .matches("""[\w\s]+""".re) @@ -2274,7 +2274,7 @@ ${"SRC END ―――――――――――".qColor(QShColor.CYAN)}""" } } - // CallChain[size=8] = QLogStyle.SRC_AND_STACK <-[Call]- QException.mySrcAndStack <-[Call]- QExcepti ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=8] = QLogStyle.SRC_AND_STACK <-[Call]- QException.mySrcAndStack <-[Call]- QExcepti ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val SRC_AND_STACK: QLogStyle get() = QLogStyle(1) { _, mySrc, _, stackTrace -> """ @@ -2291,7 +2291,7 @@ $stackTrace """.trim() } - // CallChain[size=9] = QLogStyle.S <-[Call]- qLogStackFrames() <-[Call]- QException.mySrcAndStack <- ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=9] = QLogStyle.S <-[Call]- qLogStackFrames() <-[Call]- QException.mySrcAndStack <- ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val S: QLogStyle get() = QLogStyle(1) { msg, mySrc, _, stackTrace -> """ @@ -2304,7 +2304,7 @@ $stackTrace } } -// CallChain[size=9] = qMySrcLinesAtFrame() <-[Call]- qLogStackFrames() <-[Call]- QException.mySrcAn ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=9] = qMySrcLinesAtFrame() <-[Call]- qLogStackFrames() <-[Call]- QException.mySrcAn ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun qMySrcLinesAtFrame( frame: StackFrame, srcCut: QSrcCut = QSrcCut.NOCUT_JUST_SINGLE_LINE, @@ -2322,11 +2322,11 @@ private fun qMySrcLinesAtFrame( src2 } catch (e: Exception) { // e.message - "${QMyMark.WARN} Couldn't cut src lines : ${qBrackets("FileName", frame.fileName, "LineNo", frame.lineNumber, "SrcRoots", srcRoots)}" + "${QMyMark.warn} Couldn't cut src lines : ${qBrackets("FileName", frame.fileName, "LineNo", frame.lineNumber, "SrcRoots", srcRoots)}" } } -// CallChain[size=8] = qLogStackFrames() <-[Call]- QException.mySrcAndStack <-[Call]- QException.pri ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=8] = qLogStackFrames() <-[Call]- QException.mySrcAndStack <-[Call]- QException.pri ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun qLogStackFrames( frames: List, msg: Any? = "", @@ -2364,15 +2364,15 @@ private fun qLogStackFrames( val text = style.start + output + style.end - val finalTxt = if (noColor) text.noColor else text + val finalTxt = if (noColor) text.noStyle else text if (!quiet) style.out.print(finalTxt) - return if (noColor) output.noColor else output + return if (noColor) output.noStyle else output } -// CallChain[size=10] = qSrcFileLinesAtFrame() <-[Call]- qMySrcLinesAtFrame() <-[Call]- qLogStackFra ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=10] = qSrcFileLinesAtFrame() <-[Call]- qMySrcLinesAtFrame() <-[Call]- qLogStackFra ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun qSrcFileLinesAtFrame( srcRoots: List = QMyPath.src_root, pkgDirHint: String? = null, @@ -2386,7 +2386,7 @@ private fun qSrcFileLinesAtFrame( return srcFile.qFetchLinesAround(frame.lineNumber, fetchRule, charset, lineSeparator) } -// CallChain[size=11] = qArrow() <-[Call]- QLogStyle.qLogArrow() <-[Call]- QLogStyle.S <-[Call]- qLo ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=11] = qArrow() <-[Call]- QLogStyle.qLogArrow() <-[Call]- QLogStyle.S <-[Call]- qLo ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun qArrow(key: Any?, value: Any?): String { val keyStr = key.qToLogString() .qWithNewLinePrefix(onlyIf = QOnlyIfStr.Multiline) @@ -2398,7 +2398,7 @@ private fun qArrow(key: Any?, value: Any?): String { return "$keyStr$qARROW$valStr" } -// CallChain[size=4] = String.qBracketEnd() <-[Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=4] = String.qBracketEnd() <-[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] /** * ``` * [key1] value1 [key2] value2 @@ -2412,7 +2412,7 @@ private fun String.qBracketEnd(value: Any?): String { return "[$this]$valStr" } -// CallChain[size=4] = String.qBracketStartOrMiddle() <-[Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=4] = String.qBracketStartOrMiddle() <-[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] /** * ``` * [key1] value1 [key2] value2 @@ -2425,7 +2425,7 @@ private fun String.qBracketStartOrMiddle(value: Any?): String { return "[$this]$valStr" } -// CallChain[size=3] = qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=3] = qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun qBrackets(vararg keysAndValues: Any?): String { if (keysAndValues.size % 2 != 0) { QE.ShouldBeEvenNumber.throwItBrackets("KeysAndValues.size", keysAndValues.size) @@ -2440,22 +2440,22 @@ private fun qBrackets(vararg keysAndValues: Any?): String { }.joinToString("") } -// CallChain[size=10] = QOut <-[Ref]- QLogStyle <-[Ref]- QLogStyle.SRC_AND_STACK <-[Call]- QExceptio ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=10] = QOut <-[Ref]- QLogStyle <-[Ref]- QLogStyle.SRC_AND_STACK <-[Call]- QExceptio ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private interface QOut { - // CallChain[size=12] = QOut.isAcceptColoredText <-[Propag]- QOut.CONSOLE <-[Call]- QMyLog.out <-[Ca ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=12] = QOut.isAcceptColoredText <-[Propag]- QOut.CONSOLE <-[Call]- QMyLog.out <-[Ca ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val isAcceptColoredText: Boolean - // CallChain[size=12] = QOut.print() <-[Propag]- QOut.CONSOLE <-[Call]- QMyLog.out <-[Call]- QLogSty ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=12] = QOut.print() <-[Propag]- QOut.CONSOLE <-[Call]- QMyLog.out <-[Call]- QLogSty ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun print(msg: Any? = "") - // CallChain[size=12] = QOut.println() <-[Propag]- QOut.CONSOLE <-[Call]- QMyLog.out <-[Call]- QLogS ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=12] = QOut.println() <-[Propag]- QOut.CONSOLE <-[Call]- QMyLog.out <-[Call]- QLogS ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun println(msg: Any? = "") - // CallChain[size=12] = QOut.close() <-[Propag]- QOut.CONSOLE <-[Call]- QMyLog.out <-[Call]- QLogSty ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=12] = QOut.close() <-[Propag]- QOut.CONSOLE <-[Call]- QMyLog.out <-[Call]- QLogSty ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun close() companion object { - // CallChain[size=11] = QOut.CONSOLE <-[Call]- QMyLog.out <-[Call]- QLogStyle <-[Ref]- QLogStyle.SRC ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=11] = QOut.CONSOLE <-[Call]- QMyLog.out <-[Call]- QLogStyle <-[Ref]- QLogStyle.SRC ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val CONSOLE: QOut = QConsole(true) @@ -2467,23 +2467,23 @@ private fun QOut.separator(start: String = "\n", end: String = "\n") { this.println(qSeparator(start = start, end = end)) } -// CallChain[size=12] = QConsole <-[Call]- QOut.CONSOLE <-[Call]- QMyLog.out <-[Call]- QLogStyle <-[ ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=12] = QConsole <-[Call]- QOut.CONSOLE <-[Call]- QMyLog.out <-[Call]- QLogStyle <-[ ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private class QConsole(override val isAcceptColoredText: Boolean) : QOut { - // CallChain[size=13] = QConsole.print() <-[Propag]- QConsole <-[Call]- QOut.CONSOLE <-[Call]- QMyLo ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=13] = QConsole.print() <-[Propag]- QConsole <-[Call]- QOut.CONSOLE <-[Call]- QMyLo ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun print(msg: Any?) { if (isAcceptColoredText) { kotlin.io.print(msg.toString()) } else { - kotlin.io.print(msg.toString().noColor) + kotlin.io.print(msg.toString().noStyle) } } - // CallChain[size=13] = QConsole.println() <-[Propag]- QConsole <-[Call]- QOut.CONSOLE <-[Call]- QMy ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=13] = QConsole.println() <-[Propag]- QConsole <-[Call]- QOut.CONSOLE <-[Call]- QMy ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun println(msg: Any?) { kotlin.io.println(msg.toString()) } - // CallChain[size=13] = QConsole.close() <-[Propag]- QConsole <-[Call]- QOut.CONSOLE <-[Call]- QMyLo ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=13] = QConsole.close() <-[Propag]- QConsole <-[Call]- QOut.CONSOLE <-[Call]- QMyLo ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun close() { // Do nothing } @@ -2506,7 +2506,7 @@ private fun Method.qName(withParenthesis: Boolean = false): String { } } -// CallChain[size=6] = KClass<*>.qFunctions() <-[Call]- qToStringRegistry <-[Call]- Any?.qToString() ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=6] = KClass<*>.qFunctions() <-[Call]- qToStringRegistry <-[Call]- Any.qToString() ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun KClass<*>.qFunctions(matcher: QMFunc = QMFunc.DeclaredOnly and QMFunc.IncludeExtensionsInClass): List> { val list = mutableListOf>() @@ -2531,7 +2531,7 @@ private fun KClass<*>.qFunctions(matcher: QMFunc = QMFunc.DeclaredOnly and QMFun return list } -// CallChain[size=17] = KClass.qEnumValues() <-[Call]- QFlagSet.enumValues <-[Call]- QFlagSet.toE ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=17] = KClass.qEnumValues() <-[Call]- QFlagSet.enumValues <-[Call]- QFlagSet.toE ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun > KClass.qEnumValues(): Array { return java.enumConstants as Array } @@ -2540,7 +2540,7 @@ private fun > KClass.qEnumValues(): Array { private val qThisSrcLineSignature: String get() = qCallerSrcLineSignature() -// CallChain[size=11] = qSrcFileAtFrame() <-[Call]- qSrcFileLinesAtFrame() <-[Call]- qMySrcLinesAtFr ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=11] = qSrcFileAtFrame() <-[Call]- qSrcFileLinesAtFrame() <-[Call]- qMySrcLinesAtFr ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun qSrcFileAtFrame(frame: StackFrame, srcRoots: List = QMyPath.src_root, pkgDirHint: String? = null): Path = qCacheItOneSec( frame.fileName + frame.lineNumber + srcRoots.map { it }.joinToString() + pkgDirHint ) { @@ -2593,21 +2593,21 @@ private fun qCallerSrcLineSignature(stackDepth: Int = 0): String { } } -// CallChain[size=8] = qStackFrames() <-[Call]- QException.stackFrames <-[Call]- QException.getStack ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=8] = qStackFrames() <-[Call]- QException.stackFrames <-[Call]- QException.getStack ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private inline fun qStackFrames( stackDepth: Int = 0, size: Int = 1, - noinline filter: (StackFrame) -> Boolean = QE.STACK_FRAME_FILTER, + noinline filter: (StackFrame) -> Boolean = qSTACK_FRAME_FILTER, ): List { return StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE).walk { s: Stream -> s.asSequence().filter(filter).drop(stackDepth).take(size).toList() } } -// CallChain[size=11] = qStackFrame() <-[Call]- qSrcFileLinesAtFrame() <-[Call]- qMySrcLinesAtFrame( ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=11] = qStackFrame() <-[Call]- qSrcFileLinesAtFrame() <-[Call]- qMySrcLinesAtFrame( ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private inline fun qStackFrame( stackDepth: Int = 0, - noinline filter: (StackFrame) -> Boolean = QE.STACK_FRAME_FILTER, + noinline filter: (StackFrame) -> Boolean = qSTACK_FRAME_FILTER, ): StackFrame { return qStackFrames(stackDepth, 1, filter)[0] } @@ -2621,7 +2621,7 @@ private fun qStackFrameEntryMethod(filter: (StackFrame) -> Boolean): StackFrame }.qaNotNull() } -// CallChain[size=7] = KType.qToClass() <-[Call]- KType.qIsSuperclassOf() <-[Call]- qToStringRegistr ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=7] = KType.qToClass() <-[Call]- KType.qIsSuperclassOf() <-[Call]- qToStringRegistr ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun KType.qToClass(): KClass<*>? { return if (this.classifier != null && this.classifier is KClass<*>) { this.classifier as KClass<*> @@ -2630,7 +2630,7 @@ private fun KType.qToClass(): KClass<*>? { } } -// CallChain[size=6] = KType.qIsSuperclassOf() <-[Call]- qToStringRegistry <-[Call]- Any?.qToString( ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=6] = KType.qIsSuperclassOf() <-[Call]- qToStringRegistry <-[Call]- Any.qToString() ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun KType.qIsSuperclassOf(cls: KClass<*>): Boolean { return try { val thisClass = qToClass() @@ -2737,227 +2737,204 @@ private fun qCallerFileMainClass(stackDepth: Int = 0): Class<*> { return Class.forName(clsName) } -// CallChain[size=8] = RO <-[Ref]- String.qReplaceFirstIfNonEmptyStringGroup() <-[Call]- String.qApp ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=9] = RO <-[Ref]- qRe() <-[Call]- QException.mySrcAndStack <-[Call]- QException.pri ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private typealias RO = RegexOption -// CallChain[size=8] = qRe() <-[Call]- String.qReplaceFirstIfNonEmptyStringGroup() <-[Call]- String. ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=8] = qRe() <-[Call]- QException.mySrcAndStack <-[Call]- QException.printStackTrace ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun qRe(@Language("RegExp") regex: String, vararg opts: RO): Regex { return qCacheItOneSecThreadLocal(regex + opts.contentToString()) { Regex(regex, setOf(*opts)) } } -// CallChain[size=7] = re <-[Call]- String.qApplyColorNestable() <-[Call]- String.qColorLine() <-[Ca ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=10] = @receiver:Language("RegExp") String.re <-[Call]- QFetchRule.SMART_FETCH <-[C ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] // https://youtrack.jetbrains.com/issue/KTIJ-5643 private val @receiver:Language("RegExp") String.re: Regex get() = qRe(this) -// CallChain[size=7] = String.qReplaceFirstIfNonEmptyStringGroup() <-[Call]- String.qApplyColorNesta ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] -private fun String.qReplaceFirstIfNonEmptyStringGroup(@Language("RegExp") regex: String, nonEmptyGroupIdx: Int, replace: String = "$1", vararg opts: RO): String { - val re = qRe(regex, *opts) - - return if (re.find(this)?.groups?.get(nonEmptyGroupIdx)?.value?.isNotEmpty() == true) { - re.replaceFirst(this, replace) - } else { - this - } -} - -// CallChain[size=6] = qBG_JUMP <-[Call]- QShColor.bg <-[Propag]- QShColor.LIGHT_GREEN <-[Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=6] = qBG_JUMP <-[Call]- QShColor.bg <-[Propag]- QShColor.LightGreen <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private const val qBG_JUMP = 10 -// CallChain[size=6] = qSTART <-[Call]- QShColor.bg <-[Propag]- QShColor.LIGHT_GREEN <-[Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=6] = qSTART <-[Call]- QShColor.bg <-[Propag]- QShColor.LightGreen <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private const val qSTART = "\u001B[" -// CallChain[size=6] = qEND <-[Call]- String.qColorLine() <-[Call]- String.qColor() <-[Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=7] = qEND <-[Call]- String.qApplyEscapeLine() <-[Call]- String.qApplyEscapeLine() ... - String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private const val qEND = "${qSTART}0m" -// CallChain[size=7] = qMASK_COLORED <-[Call]- String.qApplyColorNestable() <-[Call]- String.qColorL ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] -private val qMASK_COLORED by lazy { - QMaskBetween( - qSTART, - qEND, - qSTART, - escapeChar = '\\', - targetNestDepth = 1, - maskIncludeStartAndEndSequence = false - ) -} +// CallChain[size=7] = String.qApplyEscapeNestable() <-[Call]- String.qApplyEscapeLine() <-[Call]- S ... - String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +private fun String.qApplyEscapeNestable(start: String): String { + val lastEnd = this.endsWith(qEND) -// CallChain[size=6] = String.qApplyColorNestable() <-[Call]- String.qColorLine() <-[Call]- String.q ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] -private fun String.qApplyColorNestable(colorStart: String): String { - val re = "(?s)(\\Q$qEND\\E)(.+?)(\\Q$qSTART\\E|$)".re - val replace = "$1$colorStart$2$qEND$3" - val re2 = "^(?s)(.*?)(\\Q$qSTART\\E)" - val replace2 = "$colorStart$1$qEND$2" - - return this.qMaskAndReplace( - qMASK_COLORED, - re, - replace - ).qReplaceFirstIfNonEmptyStringGroup(re2, 1, replace2) + return if( lastEnd ) { + start + this.substring(0, this.length - 1).replace(qEND, qEND + start) + this[this.length - 1] + } else { + start + this.replace(qEND, qEND + start) + qEND + } } -// CallChain[size=4] = String.qColor() <-[Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=4] = String.qColor() <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun String.qColor(fg: QShColor? = null, bg: QShColor? = null, nestable: Boolean = this.contains(qSTART)): String { return if (this.qIsSingleLine()) { - this.qColorLine(fg, bg, nestable) + this.qApplyEscapeLine(fg, bg, nestable) } else { lineSequence().map { line -> - line.qColorLine(fg, bg, nestable) + line.qApplyEscapeLine(fg, bg, nestable) }.joinToString("\n") } } -// CallChain[size=5] = String.qColorLine() <-[Call]- String.qColor() <-[Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] -private fun String.qColorLine( - fg: QShColor? = null, - bg: QShColor? = null, - nestable: Boolean = true, +// CallChain[size=5] = String.qApplyEscapeLine() <-[Call]- String.qColor() <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +private fun String.qApplyEscapeLine(fg: QShColor?, bg: QShColor?, nestable: Boolean): String { + return this.qApplyEscapeLine( + listOfNotNull(fg?.fg, bg?.bg).toTypedArray(), + nestable + ) +} + +// CallChain[size=6] = String.qApplyEscapeLine() <-[Call]- String.qApplyEscapeLine() <-[Call]- Strin ... - String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +private fun String.qApplyEscapeLine( + startSequences: Array, + nestable: Boolean ): String { val nest = nestable && this.contains(qEND) - val fgApplied = if (fg != null) { - val fgStart = fg.fg - - if (nest) { - this.qApplyColorNestable(fgStart) - } else { - "$fgStart$this$qEND" - } - } else { - this - } - - val bgApplied = if (bg != null) { - val bgStart = bg.bg + var text = this - if (nest) { - fgApplied.qApplyColorNestable(bgStart) + for (start in startSequences) { + text = if (nest) { + text.qApplyEscapeNestable(start) } else { - "$bgStart$fgApplied$qEND" + "$start$text$qEND" } - } else { - fgApplied } - return bgApplied + return text } -// CallChain[size=3] = noColor <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] -private val String.noColor: String - get() { - return this.replace("""\Q$qSTART\E\d{1,2}m""".re, "") - } - -// CallChain[size=4] = QShColor <-[Ref]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=4] = QShColor <-[Ref]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] enum class QShColor(val code: Int) { - // CallChain[size=5] = QShColor.BLACK <-[Propag]- QShColor.LIGHT_GREEN <-[Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] - BLACK(30), - // CallChain[size=5] = QShColor.RED <-[Propag]- QShColor.LIGHT_GREEN <-[Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] - RED(31), - // CallChain[size=5] = QShColor.GREEN <-[Propag]- QShColor.LIGHT_GREEN <-[Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] - GREEN(32), - // CallChain[size=5] = QShColor.YELLOW <-[Propag]- QShColor.LIGHT_GREEN <-[Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] - YELLOW(33), - // CallChain[size=5] = QShColor.BLUE <-[Propag]- QShColor.LIGHT_GREEN <-[Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] - BLUE(34), - // CallChain[size=5] = QShColor.MAGENTA <-[Propag]- QShColor.LIGHT_GREEN <-[Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] - MAGENTA(35), - // CallChain[size=5] = QShColor.CYAN <-[Propag]- QShColor.LIGHT_GREEN <-[Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] - CYAN(36), - // CallChain[size=5] = QShColor.LIGHT_GRAY <-[Propag]- QShColor.LIGHT_GREEN <-[Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] - LIGHT_GRAY(37), - - // CallChain[size=5] = QShColor.DARK_GRAY <-[Propag]- QShColor.LIGHT_GREEN <-[Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] - DARK_GRAY(90), - // CallChain[size=5] = QShColor.LIGHT_RED <-[Propag]- QShColor.LIGHT_GREEN <-[Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] - LIGHT_RED(91), - // CallChain[size=4] = QShColor.LIGHT_GREEN <-[Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] - LIGHT_GREEN(92), - // CallChain[size=5] = QShColor.LIGHT_YELLOW <-[Propag]- QShColor.LIGHT_GREEN <-[Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] - LIGHT_YELLOW(93), - // CallChain[size=5] = QShColor.LIGHT_BLUE <-[Propag]- QShColor.LIGHT_GREEN <-[Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] - LIGHT_BLUE(94), - // CallChain[size=5] = QShColor.LIGHT_MAGENTA <-[Propag]- QShColor.LIGHT_GREEN <-[Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] - LIGHT_MAGENTA(95), - // CallChain[size=5] = QShColor.LIGHT_CYAN <-[Propag]- QShColor.LIGHT_GREEN <-[Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] - LIGHT_CYAN(96), - // CallChain[size=5] = QShColor.WHITE <-[Propag]- QShColor.LIGHT_GREEN <-[Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] - WHITE(97); - - // CallChain[size=5] = QShColor.fg <-[Propag]- QShColor.LIGHT_GREEN <-[Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] - /** ANSI modifier string to apply the color to the text itself */ + // CallChain[size=5] = QShColor.Black <-[Propag]- QShColor.LightGreen <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + Black(30), + // CallChain[size=5] = QShColor.Red <-[Propag]- QShColor.LightGreen <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + Red(31), + // CallChain[size=5] = QShColor.Green <-[Propag]- QShColor.LightGreen <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + Green(32), + // CallChain[size=5] = QShColor.Yellow <-[Propag]- QShColor.LightGreen <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + Yellow(33), + // CallChain[size=5] = QShColor.Blue <-[Propag]- QShColor.LightGreen <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + Blue(34), + // CallChain[size=5] = QShColor.Purple <-[Propag]- QShColor.LightGreen <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + Purple(35), + // CallChain[size=5] = QShColor.Cyan <-[Propag]- QShColor.LightGreen <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + Cyan(36), + // CallChain[size=5] = QShColor.LightGray <-[Propag]- QShColor.LightGreen <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + LightGray(37), + + // CallChain[size=5] = QShColor.DefaultFG <-[Propag]- QShColor.LightGreen <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + DefaultFG(39), + // CallChain[size=5] = QShColor.DefaultBG <-[Propag]- QShColor.LightGreen <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + DefaultBG(49), + + // CallChain[size=5] = QShColor.DarkGray <-[Propag]- QShColor.LightGreen <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + DarkGray(90), + // CallChain[size=5] = QShColor.LightRed <-[Propag]- QShColor.LightGreen <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + LightRed(91), + // CallChain[size=4] = QShColor.LightGreen <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + LightGreen(92), + // CallChain[size=5] = QShColor.LightYellow <-[Propag]- QShColor.LightGreen <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + LightYellow(93), + // CallChain[size=5] = QShColor.LightBlue <-[Propag]- QShColor.LightGreen <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + LightBlue(94), + // CallChain[size=5] = QShColor.LightPurple <-[Propag]- QShColor.LightGreen <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + LightPurple(95), + // CallChain[size=5] = QShColor.LightCyan <-[Propag]- QShColor.LightGreen <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + LightCyan(96), + // CallChain[size=5] = QShColor.White <-[Propag]- QShColor.LightGreen <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + White(97); + + // CallChain[size=5] = QShColor.fg <-[Propag]- QShColor.LightGreen <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val fg: String = "$qSTART${code}m" - // CallChain[size=5] = QShColor.bg <-[Propag]- QShColor.LIGHT_GREEN <-[Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] - /** ANSI modifier string to apply the color the text's background */ + // CallChain[size=5] = QShColor.bg <-[Propag]- QShColor.LightGreen <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val bg: String = "$qSTART${code + qBG_JUMP}m" companion object { - // CallChain[size=5] = QShColor.random() <-[Propag]- QShColor.LIGHT_GREEN <-[Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] - fun random(seed: String, colors: Array = arrayOf(YELLOW, GREEN, BLUE, MAGENTA, CYAN)): QShColor { + // CallChain[size=5] = QShColor.random() <-[Propag]- QShColor.LightGreen <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + fun random(seed: String, colors: Array = arrayOf(Yellow, Green, Blue, Purple, Cyan)): QShColor { val idx = seed.hashCode().rem(colors.size).absoluteValue return colors[idx] } + + // CallChain[size=5] = QShColor.get() <-[Propag]- QShColor.LightGreen <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + fun get(ansiEscapeCode: Int): QShColor { + return QShColor.values().find { + it.code == ansiEscapeCode + }!! + } } } -// CallChain[size=8] = String.qColorTarget() <-[Call]- QException.mySrcAndStack <-[Call]- QException ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] -private fun String.qColorTarget(ptn: Regex, color: QShColor = QShColor.LIGHT_YELLOW): String { - return ptn.replace(this, "$0".qColor(color)) +// CallChain[size=8] = String.qColorTarget() <-[Call]- QException.mySrcAndStack <-[Call]- QException ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +private fun String.qColorTarget(ptn: Regex, fg: QShColor? = null, bg: QShColor? = null): String { + return ptn.replace(this, "$0".qColor(fg, bg)) } -// CallChain[size=5] = red <-[Call]- QTestResult.printIt() <-[Call]- qTestMethods() <-[Call]- qTest() <-[Call]- main()[Root] +// CallChain[size=5] = String.red <-[Call]- QTestResult.printIt() <-[Call]- qTestMethods() <-[Call]- qTest() <-[Call]- main()[Root] private val String?.red: String - get() = this?.qColor(QShColor.RED) ?: "null".qColor(QShColor.RED) + get() = this?.qColor(QShColor.Red) ?: "null".qColor(QShColor.Red) -// CallChain[size=5] = green <-[Call]- QTestResult.printIt() <-[Call]- qTestMethods() <-[Call]- qTest() <-[Call]- main()[Root] +// CallChain[size=5] = String.green <-[Call]- QTestResult.printIt() <-[Call]- qTestMethods() <-[Call]- qTest() <-[Call]- main()[Root] private val String?.green: String - get() = this?.qColor(QShColor.GREEN) ?: "null".qColor(QShColor.GREEN) + get() = this?.qColor(QShColor.Green) ?: "null".qColor(QShColor.Green) -// CallChain[size=8] = yellow <-[Call]- QException.qToString() <-[Call]- QException.toString() <-[Pr ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=8] = String.yellow <-[Call]- QException.qToString() <-[Call]- QException.toString( ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private val String?.yellow: String - get() = this?.qColor(QShColor.YELLOW) ?: "null".qColor(QShColor.YELLOW) + get() = this?.qColor(QShColor.Yellow) ?: "null".qColor(QShColor.Yellow) -// CallChain[size=3] = blue <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=3] = String.blue <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private val String?.blue: String - get() = this?.qColor(QShColor.BLUE) ?: "null".qColor(QShColor.BLUE) + get() = this?.qColor(QShColor.Blue) ?: "null".qColor(QShColor.Blue) -// CallChain[size=12] = cyan <-[Call]- QMaskResult.toString() <-[Propag]- QMaskResult <-[Ref]- QMask ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=10] = String.cyan <-[Call]- QLogStyle <-[Ref]- QLogStyle.SRC_AND_STACK <-[Call]- Q ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private val String?.cyan: String - get() = this?.qColor(QShColor.CYAN) ?: "null".qColor(QShColor.CYAN) + get() = this?.qColor(QShColor.Cyan) ?: "null".qColor(QShColor.Cyan) -// CallChain[size=3] = light_gray <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=3] = String.light_gray <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private val String?.light_gray: String - get() = this?.qColor(QShColor.LIGHT_GRAY) ?: "null".qColor(QShColor.LIGHT_GRAY) + get() = this?.qColor(QShColor.LightGray) ?: "null".qColor(QShColor.LightGray) -// CallChain[size=6] = light_red <-[Call]- allTestedMethods <-[Call]- QTestResult.printIt() <-[Call]- qTestMethods() <-[Call]- qTest() <-[Call]- main()[Root] +// CallChain[size=6] = String.light_red <-[Call]- List.allTestedMethods <-[Call]- QTestResult.printIt() <-[Call]- qTestMethods() <-[Call]- qTest() <-[Call]- main()[Root] private val String?.light_red: String - get() = this?.qColor(QShColor.LIGHT_RED) ?: "null".qColor(QShColor.LIGHT_RED) + get() = this?.qColor(QShColor.LightRed) ?: "null".qColor(QShColor.LightRed) -// CallChain[size=3] = light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=3] = String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private val String?.light_green: String - get() = this?.qColor(QShColor.LIGHT_GREEN) ?: "null".qColor(QShColor.LIGHT_GREEN) + get() = this?.qColor(QShColor.LightGreen) ?: "null".qColor(QShColor.LightGreen) -// CallChain[size=5] = light_yellow <-[Call]- colorIt <-[Call]- qFailMsg() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=5] = String.light_yellow <-[Call]- String.colorIt <-[Call]- qFailMsg() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private val String?.light_yellow: String - get() = this?.qColor(QShColor.LIGHT_YELLOW) ?: "null".qColor(QShColor.LIGHT_YELLOW) + get() = this?.qColor(QShColor.LightYellow) ?: "null".qColor(QShColor.LightYellow) -// CallChain[size=3] = light_blue <-[Call]- qTest() <-[Call]- main()[Root] +// CallChain[size=3] = String.light_blue <-[Call]- qTest() <-[Call]- main()[Root] private val String?.light_blue: String - get() = this?.qColor(QShColor.LIGHT_BLUE) ?: "null".qColor(QShColor.LIGHT_BLUE) + get() = this?.qColor(QShColor.LightBlue) ?: "null".qColor(QShColor.LightBlue) -// CallChain[size=13] = light_cyan <-[Call]- qARROW <-[Call]- qArrow() <-[Call]- QLogStyle.qLogArrow ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=13] = String.light_cyan <-[Call]- qARROW <-[Call]- qArrow() <-[Call]- QLogStyle.qL ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private val String?.light_cyan: String - get() = this?.qColor(QShColor.LIGHT_CYAN) ?: "null".qColor(QShColor.LIGHT_CYAN) + get() = this?.qColor(QShColor.LightCyan) ?: "null".qColor(QShColor.LightCyan) + +// CallChain[size=3] = String.noStyle <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +private val String.noStyle: String + get() { + return this.replace("""\Q$qSTART\E\d{1,2}m""".re, "") + } // CallChain[size=3] = StringBuilder.plusAssign() <-[Call]- N.tree() <-[Call]- QTreeNodeTest.testLargeIntTree()[Root] private operator fun StringBuilder.plusAssign(str: String) { this.append(str) } -// CallChain[size=10] = path <-[Call]- QMyPath.src_root <-[Call]- qLogStackFrames() <-[Call]- QExcep ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=10] = String.path <-[Call]- QMyPath.src_root <-[Call]- qLogStackFrames() <-[Call]- ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private val String.path: Path get() = Paths.get(this.trim()).toAbsolutePath().normalize() @@ -2971,25 +2948,25 @@ private enum class QLR { // CallChain[size=4] = qSeparator() <-[Call]- QOut.separator() <-[Call]- qTest() <-[Call]- main()[Root] private fun qSeparator( - fg: QShColor? = QShColor.LIGHT_GRAY, - bg: QShColor? = null, - char: Char = '⎯', - length: Int = 80, - start: String = "\n", - end: String = "\n", + fg: QShColor? = QShColor.LightGray, + bg: QShColor? = null, + char: Char = '⎯', + length: Int = 80, + start: String = "\n", + end: String = "\n", ): String { return start + char.toString().repeat(length).qColor(fg, bg) + end } // CallChain[size=4] = qSeparatorWithLabel() <-[Call]- qTestMethods() <-[Call]- qTest() <-[Call]- main()[Root] private fun qSeparatorWithLabel( - label: String, - fg: QShColor? = QShColor.LIGHT_GRAY, - bg: QShColor? = null, - char: Char = '⎯', - length: Int = 70, - start: String = "\n", - end: String = "\n", + label: String, + fg: QShColor? = QShColor.LightGray, + bg: QShColor? = null, + char: Char = '⎯', + length: Int = 70, + start: String = "\n", + end: String = "\n", ): String { return start + label + " " + char.toString().repeat((length - label.length - 2).coerceAtLeast(0)).qColor(fg, bg) .qWithMinAndMaxLength(length, length, alignment = QAlign.LEFT, endDots = "") + end @@ -3032,25 +3009,25 @@ private fun String.qWithMaxLength(maxLength: Int, endDots: String = " ..."): Str return substring(0, length.coerceAtMost(maxLength - endDots.length)) + endDots } -// CallChain[size=12] = QOnlyIfStr <-[Ref]- QMaskResult.toString() <-[Propag]- QMaskResult <-[Ref]- ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=5] = QOnlyIfStr <-[Ref]- String.qBracketEnd() <-[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private enum class QOnlyIfStr(val matches: (String) -> Boolean) { - // CallChain[size=12] = QOnlyIfStr.Multiline <-[Call]- QMaskResult.toString() <-[Propag]- QMaskResul ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=5] = QOnlyIfStr.Multiline <-[Call]- String.qBracketEnd() <-[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] Multiline({ it.qIsMultiLine() }), - // CallChain[size=13] = QOnlyIfStr.SingleLine <-[Propag]- QOnlyIfStr.Multiline <-[Call]- QMaskResult ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=5] = QOnlyIfStr.SingleLine <-[Call]- String.qBracketEnd() <-[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] SingleLine({ it.qIsSingleLine() }), - // CallChain[size=13] = QOnlyIfStr.Empty <-[Propag]- QOnlyIfStr.Multiline <-[Call]- QMaskResult.toSt ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=6] = QOnlyIfStr.Empty <-[Propag]- QOnlyIfStr.Multiline <-[Call]- String.qBracketEn ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] Empty({ it.isEmpty() }), - // CallChain[size=13] = QOnlyIfStr.Blank <-[Propag]- QOnlyIfStr.Multiline <-[Call]- QMaskResult.toSt ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=6] = QOnlyIfStr.Blank <-[Propag]- QOnlyIfStr.Multiline <-[Call]- String.qBracketEn ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] Blank({ it.isBlank() }), - // CallChain[size=13] = QOnlyIfStr.NotEmpty <-[Propag]- QOnlyIfStr.Multiline <-[Call]- QMaskResult.t ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=6] = QOnlyIfStr.NotEmpty <-[Propag]- QOnlyIfStr.Multiline <-[Call]- String.qBracke ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] NotEmpty({ it.isNotEmpty() }), - // CallChain[size=13] = QOnlyIfStr.NotBlank <-[Propag]- QOnlyIfStr.Multiline <-[Call]- QMaskResult.t ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=6] = QOnlyIfStr.NotBlank <-[Propag]- QOnlyIfStr.Multiline <-[Call]- String.qBracke ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] NotBlank({ it.isNotBlank() }), - // CallChain[size=13] = QOnlyIfStr.Always <-[Propag]- QOnlyIfStr.Multiline <-[Call]- QMaskResult.toS ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=6] = QOnlyIfStr.Always <-[Propag]- QOnlyIfStr.Multiline <-[Call]- String.qBracketE ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] Always({ true }) } -// CallChain[size=13] = String.qWithNewLinePrefix() <-[Call]- String.qWithNewLineSurround() <-[Call] ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=6] = String.qWithNewLinePrefix() <-[Call]- String.qWithNewLineSurround() <-[Call]- ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun String.qWithNewLinePrefix( numNewLine: Int = 1, onlyIf: QOnlyIfStr = QOnlyIfStr.Multiline, @@ -3063,7 +3040,7 @@ private fun String.qWithNewLinePrefix( return lineSeparator.value.repeat(numNewLine) + substring(nCount) } -// CallChain[size=13] = String.qWithNewLineSuffix() <-[Call]- String.qWithNewLineSurround() <-[Call] ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=6] = String.qWithNewLineSuffix() <-[Call]- String.qWithNewLineSurround() <-[Call]- ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun String.qWithNewLineSuffix(numNewLine: Int = 1, onlyIf: QOnlyIfStr = QOnlyIfStr.Multiline): String { if (!onlyIf.matches(this)) return this @@ -3072,53 +3049,53 @@ private fun String.qWithNewLineSuffix(numNewLine: Int = 1, onlyIf: QOnlyIfStr = return substring(0, length - nCount) + "\n".repeat(numNewLine) } -// CallChain[size=12] = String.qWithNewLineSurround() <-[Call]- QMaskResult.toString() <-[Propag]- Q ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=5] = String.qWithNewLineSurround() <-[Call]- String.qBracketEnd() <-[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun String.qWithNewLineSurround(numNewLine: Int = 1, onlyIf: QOnlyIfStr = QOnlyIfStr.Multiline): String { if (!onlyIf.matches(this)) return this return qWithNewLinePrefix(numNewLine, QOnlyIfStr.Always).qWithNewLineSuffix(numNewLine, QOnlyIfStr.Always) } -// CallChain[size=5] = String.qWithSpacePrefix() <-[Call]- String.qBracketEnd() <-[Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=5] = String.qWithSpacePrefix() <-[Call]- String.qBracketEnd() <-[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun String.qWithSpacePrefix(numSpace: Int = 1, onlyIf: QOnlyIfStr = QOnlyIfStr.SingleLine): String { if (!onlyIf.matches(this)) return this return " ".repeat(numSpace) + this.trimStart() } -// CallChain[size=5] = String.qWithSpaceSuffix() <-[Call]- String.qBracketStartOrMiddle() <-[Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=5] = String.qWithSpaceSuffix() <-[Call]- String.qBracketStartOrMiddle() <-[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun String.qWithSpaceSuffix(numSpace: Int = 1, onlyIf: QOnlyIfStr = QOnlyIfStr.SingleLine): String { if (!onlyIf.matches(this)) return this return this.trimEnd() + " ".repeat(numSpace) } -// CallChain[size=10] = CharSequence.qEndsWith() <-[Call]- QFetchRule.SMART_FETCH <-[Call]- qLogStac ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=10] = CharSequence.qEndsWith() <-[Call]- QFetchRule.SMART_FETCH <-[Call]- qLogStac ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun CharSequence.qEndsWith(suffix: Regex, length: Int = 100): Boolean { return takeLast(min(length, this.length)).matches(suffix) } -// CallChain[size=13] = String.qIsMultiLine() <-[Call]- QOnlyIfStr.Multiline <-[Call]- QMaskResult.t ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=6] = String.qIsMultiLine() <-[Call]- String.qIsSingleLine() <-[Call]- String.qColo ... - String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun String.qIsMultiLine(): Boolean { return this.contains("\n") || this.contains("\r") } -// CallChain[size=5] = String.qIsSingleLine() <-[Call]- String.qColor() <-[Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=5] = String.qIsSingleLine() <-[Call]- String.qColor() <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun String.qIsSingleLine(): Boolean { return !this.qIsMultiLine() } -// CallChain[size=14] = QLineSeparator <-[Ref]- String.qWithNewLinePrefix() <-[Call]- String.qWithNe ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=7] = QLineSeparator <-[Ref]- String.qWithNewLinePrefix() <-[Call]- String.qWithNew ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private enum class QLineSeparator(val value: String) { - // CallChain[size=14] = QLineSeparator.LF <-[Call]- String.qWithNewLinePrefix() <-[Call]- String.qWi ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=7] = QLineSeparator.LF <-[Call]- String.qWithNewLinePrefix() <-[Call]- String.qWit ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] LF("\n"), - // CallChain[size=15] = QLineSeparator.CRLF <-[Propag]- QLineSeparator.QLineSeparator() <-[Call]- St ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=8] = QLineSeparator.CRLF <-[Propag]- QLineSeparator.QLineSeparator() <-[Call]- Str ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] CRLF("\r\n"), - // CallChain[size=15] = QLineSeparator.CR <-[Propag]- QLineSeparator.QLineSeparator() <-[Call]- Stri ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=8] = QLineSeparator.CR <-[Propag]- QLineSeparator.QLineSeparator() <-[Call]- Strin ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] CR("\r"); companion object { - // CallChain[size=13] = QLineSeparator.DEFAULT <-[Call]- Path.qLineSeparator() <-[Call]- Path.qFetch ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=13] = QLineSeparator.DEFAULT <-[Call]- Path.qLineSeparator() <-[Call]- Path.qFetch ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val DEFAULT = QLineSeparator.LF } } @@ -3127,19 +3104,19 @@ private enum class QLineSeparator(val value: String) { private fun String.qSubstring(rangeBothInclusive: IntRange): String = substring(rangeBothInclusive.first, rangeBothInclusive.last + 1) -// CallChain[size=10] = String.qCountLeftSpace() <-[Call]- QFetchRule.SMART_FETCH <-[Call]- qLogStac ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=10] = String.qCountLeftSpace() <-[Call]- QFetchRule.SMART_FETCH <-[Call]- qLogStac ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun String.qCountLeftSpace(): Int = takeWhile { it == ' ' }.count() // CallChain[size=11] = String.qCountRightSpace() <-[Call]- String.qMoveCenter() <-[Call]- QLineMatc ... <-[Call]- qSeparatorWithLabel() <-[Call]- qTestMethods() <-[Call]- qTest() <-[Call]- main()[Root] private fun String.qCountRightSpace(): Int = takeLastWhile { it == ' ' }.count() -// CallChain[size=4] = qMASK_LENGTH_LIMIT <-[Call]- Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=4] = qMASK_LENGTH_LIMIT <-[Call]- Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private const val qMASK_LENGTH_LIMIT: Int = 100_000 -// CallChain[size=6] = QToString <-[Ref]- qToStringRegistry <-[Call]- Any?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=6] = QToString <-[Ref]- qToStringRegistry <-[Call]- Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private class QToString(val okToApply: (Any) -> Boolean, val toString: (Any) -> String) -// CallChain[size=5] = qToStringRegistry <-[Call]- Any?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=5] = qToStringRegistry <-[Call]- Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private val qToStringRegistry: MutableList by lazy { val toStrings = QMyToString::class.qFunctions( @@ -3162,7 +3139,7 @@ private val qToStringRegistry: MutableList by lazy { }.toMutableList() } -// CallChain[size=4] = Any?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=4] = Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun Any?.qToString(): String { if (this == null) return "null".light_gray @@ -3176,7 +3153,7 @@ private fun Any?.qToString(): String { return toString() } -// CallChain[size=3] = Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=3] = Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun Any?.qToLogString(maxLineLength: Int = 80): String { if (QMyLog.no_format) { return this.toString() @@ -3219,12 +3196,12 @@ private fun Any?.qToLogString(maxLineLength: Int = 80): String { }.qClarifyEmptyOrBlank() } -// CallChain[size=4] = String.qClarifyEmptyOrBlank() <-[Call]- Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=4] = String.qClarifyEmptyOrBlank() <-[Call]- Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun String.qClarifyEmptyOrBlank(): String { return if (this.isEmpty()) { - "(EMPTY STRING)".qColor(QShColor.LIGHT_GRAY) + "(EMPTY STRING)".qColor(QShColor.LightGray) } else if (this.isBlank()) { - "$this(BLANK STRING)".qColor(QShColor.LIGHT_GRAY) + "$this(BLANK STRING)".qColor(QShColor.LightGray) } else { this } @@ -3401,7 +3378,7 @@ private class QLineMatchResult( } } -// CallChain[size=10] = qSize <-[Call]- QLineMatchResult.align() <-[Call]- String.qAlign() <-[Call]- ... <-[Call]- qSeparatorWithLabel() <-[Call]- qTestMethods() <-[Call]- qTest() <-[Call]- main()[Root] +// CallChain[size=10] = IntRange.qSize <-[Call]- QLineMatchResult.align() <-[Call]- String.qAlign() ... <-[Call]- qSeparatorWithLabel() <-[Call]- qTestMethods() <-[Call]- qTest() <-[Call]- main()[Root] private val IntRange.qSize: Int get() = abs(last - first) + 1 @@ -3539,7 +3516,7 @@ private fun String.qMoveRight(range: IntRange, destRangeLeft: Int, keepLength: B } } -// CallChain[size=10] = String.qCountOccurrence() <-[Call]- QFetchRule.SMART_FETCH <-[Call]- qLogSta ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=10] = String.qCountOccurrence() <-[Call]- QFetchRule.SMART_FETCH <-[Call]- qLogSta ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun String.qCountOccurrence(word: String): Int { return windowed(word.length) { if (it == word) @@ -3549,13 +3526,13 @@ private fun String.qCountOccurrence(word: String): Int { }.sum() } -// CallChain[size=9] = QMask <-[Ref]- QMaskBetween <-[Call]- qMASK_COLORED <-[Call]- String.qApplyCo ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=7] = QMask <-[Ref]- QMaskBetween <-[Call]- QMask.DOUBLE_QUOTE <-[Call]- QMask.KOTL ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private interface QMask { - // CallChain[size=10] = QMask.apply() <-[Propag]- QMask <-[Ref]- QMaskBetween <-[Call]- qMASK_COLORE ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=5] = QMask.apply() <-[Propag]- QMask.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun apply(text: String): QMaskResult companion object { - // CallChain[size=5] = QMask.THREE_DOUBLE_QUOTES <-[Call]- QMask.KOTLIN_STRING <-[Call]- Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=5] = QMask.THREE_DOUBLE_QUOTES <-[Call]- QMask.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val THREE_DOUBLE_QUOTES by lazy { QMaskBetween( "\"\"\"", "\"\"\"", @@ -3564,7 +3541,7 @@ private interface QMask { maskIncludeStartAndEndSequence = false, ) } - // CallChain[size=5] = QMask.DOUBLE_QUOTE <-[Call]- QMask.KOTLIN_STRING <-[Call]- Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=5] = QMask.DOUBLE_QUOTE <-[Call]- QMask.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val DOUBLE_QUOTE by lazy { QMaskBetween( "\"", "\"", @@ -3573,21 +3550,21 @@ private interface QMask { maskIncludeStartAndEndSequence = false, ) } - // CallChain[size=4] = QMask.KOTLIN_STRING <-[Call]- Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=4] = QMask.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val KOTLIN_STRING by lazy { QMultiMask( THREE_DOUBLE_QUOTES, DOUBLE_QUOTE ) } - // CallChain[size=4] = QMask.PARENS <-[Call]- Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=4] = QMask.PARENS <-[Call]- Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val PARENS by lazy { QMaskBetween( "(", ")", nestStartSequence = "(", escapeChar = '\\' ) } - // CallChain[size=4] = QMask.INNER_BRACKETS <-[Call]- Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=4] = QMask.INNER_BRACKETS <-[Call]- Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val INNER_BRACKETS by lazy { QMaskBetween( "[", "]", @@ -3601,17 +3578,17 @@ private interface QMask { } } -// CallChain[size=5] = QMultiMask <-[Call]- QMask.KOTLIN_STRING <-[Call]- Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=5] = QMultiMask <-[Call]- QMask.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private class QMultiMask(vararg mask: QMaskBetween) : QMask { - // CallChain[size=7] = QMultiMask.masks <-[Call]- QMultiMask.apply() <-[Propag]- QMultiMask <-[Call] ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=7] = QMultiMask.masks <-[Call]- QMultiMask.apply() <-[Propag]- QMultiMask <-[Call] ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val masks: Array - // CallChain[size=6] = QMultiMask.init { <-[Propag]- QMultiMask <-[Call]- QMask.KOTLIN_STRING <-[Call]- Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=6] = QMultiMask.init { <-[Propag]- QMultiMask <-[Call]- QMask.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] init { masks = arrayOf(*mask) } - // CallChain[size=6] = QMultiMask.apply() <-[Propag]- QMultiMask <-[Call]- QMask.KOTLIN_STRING <-[Ca ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=6] = QMultiMask.apply() <-[Propag]- QMultiMask <-[Call]- QMask.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun apply(text: String): QMaskResult { var result: QMaskResult? = null for (mask in masks) { @@ -3622,7 +3599,7 @@ private class QMultiMask(vararg mask: QMaskBetween) : QMask { } } -// CallChain[size=8] = QMaskBetween <-[Call]- qMASK_COLORED <-[Call]- String.qApplyColorNestable() < ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=6] = QMaskBetween <-[Call]- QMask.DOUBLE_QUOTE <-[Call]- QMask.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private class QMaskBetween( val startSequence: String, val endSequence: String, @@ -3641,12 +3618,12 @@ private class QMaskBetween( val maskChar: Char = '\uee31', ) : QMask { - // CallChain[size=9] = QMaskBetween.apply() <-[Propag]- QMaskBetween.QMaskBetween() <-[Ref]- qMASK_C ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=7] = QMaskBetween.apply() <-[Propag]- QMaskBetween.QMaskBetween() <-[Ref]- QMask.D ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun apply(text: String): QMaskResult { return applyMore(text, null) } - // CallChain[size=10] = QMaskBetween.applyMore() <-[Call]- QMaskBetween.apply() <-[Propag]- QMaskBet ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=8] = QMaskBetween.applyMore() <-[Call]- QMaskBetween.apply() <-[Propag]- QMaskBetw ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun applyMore(text: String, orgText: String? = null): QMaskResult { val regions = text.qFindBetween( startSequence, @@ -3699,9 +3676,9 @@ private class QMaskBetween( } } -// CallChain[size=13] = QMutRegion <-[Ref]- QRegion.toMutRegion() <-[Propag]- QRegion.contains() <-[ ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=11] = QMutRegion <-[Ref]- QRegion.toMutRegion() <-[Propag]- QRegion.contains() <-[ ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private open class QMutRegion(override var start: Int, override var end: Int) : QRegion(start, end) { - // CallChain[size=14] = QMutRegion.intersectMut() <-[Propag]- QMutRegion <-[Ref]- QRegion.toMutRegio ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=12] = QMutRegion.intersectMut() <-[Propag]- QMutRegion <-[Ref]- QRegion.toMutRegio ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun intersectMut(region: QRegion) { val start = max(this.start, region.start) val end = min(this.end, region.end) @@ -3712,39 +3689,39 @@ private open class QMutRegion(override var start: Int, override var end: Int) : } } - // CallChain[size=14] = QMutRegion.addOffset() <-[Propag]- QMutRegion <-[Ref]- QRegion.toMutRegion() ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=12] = QMutRegion.addOffset() <-[Propag]- QMutRegion <-[Ref]- QRegion.toMutRegion() ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun addOffset(offset: Int) { start += offset end += offset } - // CallChain[size=14] = QMutRegion.shift() <-[Propag]- QMutRegion <-[Ref]- QRegion.toMutRegion() <-[ ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=12] = QMutRegion.shift() <-[Propag]- QMutRegion <-[Ref]- QRegion.toMutRegion() <-[ ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun shift(length: Int) { this.start += length this.end += length } } -// CallChain[size=13] = QRegion <-[Ref]- QRegion.intersect() <-[Propag]- QRegion.contains() <-[Call] ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=11] = QRegion <-[Ref]- QRegion.intersect() <-[Propag]- QRegion.contains() <-[Call] ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] /** * [start] inclusive, [end] exclusive */ private open class QRegion(open val start: Int, open val end: Int) { - // CallChain[size=12] = QRegion.toMutRegion() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween. ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=10] = QRegion.toMutRegion() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween. ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun toMutRegion(): QMutRegion { return QMutRegion(start, end) } - // CallChain[size=12] = QRegion.toRange() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.appl ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=10] = QRegion.toRange() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.appl ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun toRange(): IntRange { return IntRange(start, end + 1) } - // CallChain[size=12] = QRegion.length <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.applyMo ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=10] = QRegion.length <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.applyMo ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val length: Int get() = end - start - // CallChain[size=12] = QRegion.intersect() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.ap ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=10] = QRegion.intersect() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.ap ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun intersect(region: QRegion): QRegion? { val start = max(this.start, region.start) val end = min(this.end, region.end) @@ -3756,38 +3733,38 @@ private open class QRegion(open val start: Int, open val end: Int) { } } - // CallChain[size=11] = QRegion.contains() <-[Call]- QMaskBetween.applyMore() <-[Call]- QMaskBetween ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=9] = QRegion.contains() <-[Call]- QMaskBetween.applyMore() <-[Call]- QMaskBetween. ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun contains(idx: Int): Boolean { return idx in start until end } - // CallChain[size=12] = QRegion.cut() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.applyMor ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=10] = QRegion.cut() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.applyMor ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun cut(text: String): String { return text.substring(start, end) } - // CallChain[size=12] = QRegion.remove() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.apply ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=10] = QRegion.remove() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.apply ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun remove(text: String): String { return text.removeRange(start, end) } - // CallChain[size=12] = QRegion.replace() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.appl ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=10] = QRegion.replace() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.appl ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun replace(text: String, replacement: String): String { return text.replaceRange(start, end, replacement) } - // CallChain[size=12] = QRegion.mask() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.applyMo ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=10] = QRegion.mask() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.applyMo ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun mask(text: String, maskChar: Char = '*'): String { return text.replaceRange(this.toRange(), maskChar.toString().repeat(end - start)) } } -// CallChain[size=9] = QReplacer <-[Ref]- String.qMaskAndReplace() <-[Call]- String.qMaskAndReplace( ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=6] = QReplacer <-[Ref]- String.qMaskAndReplace() <-[Call]- QMaskResult.replaceAndU ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private class QReplacer(start: Int, end: Int, val replacement: String) : QMutRegion(start, end) -// CallChain[size=10] = QMaskResult <-[Ref]- QMaskBetween.apply() <-[Propag]- QMaskBetween.QMaskBetw ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=6] = QMaskResult <-[Ref]- QMask.apply() <-[Propag]- QMask.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private class QMaskResult(val maskedStr: String, val orgText: String, val maskChar: Char) { - // CallChain[size=4] = QMaskResult.replaceAndUnmask() <-[Call]- Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=4] = QMaskResult.replaceAndUnmask() <-[Call]- Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] /** * Apply regex to masked string. * Apply replacement to original text. @@ -3796,12 +3773,12 @@ private class QMaskResult(val maskedStr: String, val orgText: String, val maskCh return orgText.qMaskAndReplace(maskedStr, ptn, replacement, findAll) } - // CallChain[size=7] = QMaskResult.applyMoreMask() <-[Call]- QMultiMask.apply() <-[Propag]- QMultiMa ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=7] = QMaskResult.applyMoreMask() <-[Call]- QMultiMask.apply() <-[Propag]- QMultiMa ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun applyMoreMask(mask: QMaskBetween): QMaskResult { return mask.applyMore(maskedStr, orgText) } - // CallChain[size=11] = QMaskResult.toString() <-[Propag]- QMaskResult <-[Ref]- QMaskBetween.apply() ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=7] = QMaskResult.toString() <-[Propag]- QMaskResult <-[Ref]- QMask.apply() <-[Prop ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun toString(): String { val original = orgText.qWithNewLineSurround(onlyIf = QOnlyIfStr.Multiline) val masked = maskedStr.replace(maskChar, '*').qWithNewLineSurround(onlyIf = QOnlyIfStr.Multiline) @@ -3810,7 +3787,7 @@ private class QMaskResult(val maskedStr: String, val orgText: String, val maskCh } } -// CallChain[size=4] = CharSequence.qMask() <-[Call]- Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=4] = CharSequence.qMask() <-[Call]- Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun CharSequence.qMask(vararg mask: QMask): QMaskResult { mask.size.qaNotZero() @@ -3830,7 +3807,7 @@ private fun CharSequence.qMask(vararg mask: QMask): QMaskResult { } } -// CallChain[size=11] = String.qFindBetween() <-[Call]- QMaskBetween.applyMore() <-[Call]- QMaskBetw ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=9] = String.qFindBetween() <-[Call]- QMaskBetween.applyMore() <-[Call]- QMaskBetwe ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun String.qFindBetween( startSequence: String, endSequence: String, @@ -3857,7 +3834,7 @@ private fun String.qFindBetween( return finder.find(this) } -// CallChain[size=8] = String.qMaskAndReplace() <-[Call]- String.qMaskAndReplace() <-[Call]- String. ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=5] = String.qMaskAndReplace() <-[Call]- QMaskResult.replaceAndUnmask() <-[Call]- Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun String.qMaskAndReplace( maskedStr: String, ptn: Regex, @@ -3891,19 +3868,7 @@ private fun String.qMaskAndReplace( return qMultiReplace(replacers) } -// CallChain[size=7] = String.qMaskAndReplace() <-[Call]- String.qApplyColorNestable() <-[Call]- Str ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] -private fun String.qMaskAndReplace( - mask: QMask, - ptn: Regex, - replacement: String = "$1", - replaceAll: Boolean = true, -): String { - val maskResult = mask.apply(this) - - return qMaskAndReplace(maskResult.maskedStr, ptn, replacement, replaceAll) -} - -// CallChain[size=9] = CharSequence.qMultiReplace() <-[Call]- String.qMaskAndReplace() <-[Call]- Str ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=6] = CharSequence.qMultiReplace() <-[Call]- String.qMaskAndReplace() <-[Call]- QMa ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] /** * currently does not support region overlap */ @@ -3919,7 +3884,7 @@ private fun CharSequence.qMultiReplace(replacers: List): String { return sb.toString() } -// CallChain[size=9] = MatchResult.qResolveReplacementGroup() <-[Call]- String.qMaskAndReplace() <-[ ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=6] = MatchResult.qResolveReplacementGroup() <-[Call]- String.qMaskAndReplace() <-[ ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun MatchResult.qResolveReplacementGroup(replacement: String, orgText: String): String { var resolveGroup = replacement @@ -3938,20 +3903,20 @@ private fun MatchResult.qResolveReplacementGroup(replacement: String, orgText: S return resolveGroup } -// CallChain[size=10] = CharSequence.qReplace() <-[Call]- MatchResult.qResolveReplacementGroup() <-[ ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=7] = CharSequence.qReplace() <-[Call]- MatchResult.qResolveReplacementGroup() <-[C ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun CharSequence.qReplace(oldValue: String, newValue: String, escapeChar: Char): String { return replace(Regex("""(? 1 - // \n[\n] --> 2 + // [\n]abc\n --> lineNumber is 1 "First Line" + // \n[\n] --> lineNumber is 2 "Second Line" var lineBreakCount = 0 @@ -4058,7 +4025,7 @@ private open class QCharReader(val text: CharSequence) { return lineBreakCount + 1 } - // CallChain[size=15] = QCharReader.countIndentSpaces() <-[Propag]- QCharReader <-[Call]- QSequenceR ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=13] = QCharReader.countIndentSpaces() <-[Propag]- QCharReader <-[Call]- QSequenceR ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun countIndentSpaces(space: Char = ' '): Int { var count = 0 @@ -4095,56 +4062,74 @@ private open class QCharReader(val text: CharSequence) { return count } - // CallChain[size=15] = QCharReader.hasNextChar() <-[Propag]- QCharReader <-[Call]- QSequenceReader ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=13] = QCharReader.hasNextChar() <-[Propag]- QCharReader <-[Call]- QSequenceReader ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] inline fun hasNextChar(len: Int = 1): Boolean { return offset + len - 1 < text.length } - // CallChain[size=15] = QCharReader.isOffsetEOF() <-[Propag]- QCharReader <-[Call]- QSequenceReader ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=13] = QCharReader.isOffsetEOF() <-[Propag]- QCharReader <-[Call]- QSequenceReader ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] inline fun isOffsetEOF(): Boolean { return offset == text.length - 1 } - // CallChain[size=15] = QCharReader.isValidOffset() <-[Propag]- QCharReader <-[Call]- QSequenceReade ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=13] = QCharReader.isValidOffset() <-[Propag]- QCharReader <-[Call]- QSequenceReade ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] inline fun isValidOffset(): Boolean { return 0 <= offset && offset < text.length } - // CallChain[size=15] = QCharReader.hasPreviousChar() <-[Propag]- QCharReader <-[Call]- QSequenceRea ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=13] = QCharReader.hasPreviousChar() <-[Propag]- QCharReader <-[Call]- QSequenceRea ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] inline fun hasPreviousChar(len: Int = 1): Boolean { return 0 < offset - len + 1 } - // CallChain[size=15] = QCharReader.previousChar() <-[Propag]- QCharReader <-[Call]- QSequenceReader ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] - inline fun previousChar(len: Int = 1) { + // CallChain[size=13] = QCharReader.previousChar() <-[Propag]- QCharReader <-[Call]- QSequenceReader ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + inline fun previousChar(len: Int = 1): Char { offset -= len + return text[offset] } - // CallChain[size=15] = QCharReader.currentChar() <-[Propag]- QCharReader <-[Call]- QSequenceReader ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=13] = QCharReader.currentChar() <-[Propag]- QCharReader <-[Call]- QSequenceReader ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] inline fun currentChar(): Char { return text[offset] } - // CallChain[size=15] = QCharReader.peekNextChar() <-[Propag]- QCharReader <-[Call]- QSequenceReader ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] - fun peekNextChar(): Char { + // CallChain[size=13] = QCharReader.peekNextChar() <-[Propag]- QCharReader <-[Call]- QSequenceReader ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + inline fun peekNextChar(): Char { return text[offset] } - // CallChain[size=15] = QCharReader.moveOffset() <-[Propag]- QCharReader <-[Call]- QSequenceReader < ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=13] = QCharReader.moveOffset() <-[Propag]- QCharReader <-[Call]- QSequenceReader < ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] inline fun moveOffset(plus: Int = 1) { offset += plus } - // CallChain[size=15] = QCharReader.nextChar() <-[Propag]- QCharReader <-[Call]- QSequenceReader <-[ ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=13] = QCharReader.nextChar() <-[Propag]- QCharReader <-[Call]- QSequenceReader <-[ ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] /** * Read current offset char and add offset by 1. */ inline fun nextChar(): Char { return text[offset++] } + + // CallChain[size=13] = QCharReader.nextStringExcludingCurOffset() <-[Propag]- QCharReader <-[Call]- ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + fun nextStringExcludingCurOffset(length: Int): String { + val str = text.substring(offset + 1, (offset + 1 + length).coerceAtMost(text.length)) + offset += length + return str + } + + // CallChain[size=13] = QCharReader.peekNextStringIncludingCurOffset() <-[Propag]- QCharReader <-[Ca ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + fun peekNextStringIncludingCurOffset(length: Int): String { + return text.substring(offset, (offset + length).coerceAtMost(text.length)) + } + + // CallChain[size=13] = QCharReader.peekPreviousStringExcludingCurOffset() <-[Propag]- QCharReader < ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + fun peekPreviousStringExcludingCurOffset(length: Int): String { + return text.substring(offset - length, offset) + } } -// CallChain[size=12] = QBetween <-[Call]- String.qFindBetween() <-[Call]- QMaskBetween.applyMore() ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=10] = QBetween <-[Call]- String.qFindBetween() <-[Call]- QMaskBetween.applyMore() ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private class QBetween( val startSequence: String, val endSequence: String, @@ -4159,7 +4144,7 @@ private class QBetween( val regionIncludeStartAndEndSequence: Boolean = false, ) { - // CallChain[size=12] = QBetween.find() <-[Call]- String.qFindBetween() <-[Call]- QMaskBetween.apply ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=10] = QBetween.find() <-[Call]- String.qFindBetween() <-[Call]- QMaskBetween.apply ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun find(text: CharSequence): List { val reader = QSequenceReader(text) @@ -4218,7 +4203,7 @@ private class QBetween( } } -// CallChain[size=11] = qNow <-[Call]- qCacheItTimedThreadLocal() <-[Call]- qCacheItOneSecThreadLoca ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=11] = qNow <-[Call]- qCacheItTimedThreadLocal() <-[Call]- qCacheItOneSecThreadLoca ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private val qNow: Long get() = System.currentTimeMillis() @@ -4298,7 +4283,7 @@ private fun > N.hasCycle(): Boolean { return false } -// CallChain[size=4] = parent <-[Call]- N.add() <-[Call]- N.add() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=4] = N.parent <-[Call]- N.add() <-[Call]- N.add() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private var > N.parent: N? get() = this.qGetExPropOrNull("#parent") as N? @@ -4316,7 +4301,7 @@ private var > N.parent: N? this.qSetExProp("#parent", value) } -// CallChain[size=5] = children <-[Call]- N.depthFirstRecursive() <-[Call]- N.descendants() <-[Call]- N.descendantsList() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=5] = N.children <-[Call]- N.depthFirstRecursive() <-[Call]- N.descendants() <-[Call]- N.descendantsList() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] /** * Obtain the child nodes of this node. */ @@ -4368,7 +4353,7 @@ private enum class QTreeStyle(val plus: String, val vert: String, val end: Strin */ private fun > N.tree( style: QTreeStyle = QTreeStyle.UNICODE, - color: QShColor? = QShColor.LIGHT_YELLOW, + color: QShColor? = QShColor.LightYellow, visitChecker: HashSet = HashSet(), ): String { val hyphen = style.hyphen.repeat(3) @@ -4377,6 +4362,7 @@ private fun > N.tree( this.mark(visitChecker) + // print root node sb += this.toTreeNodeString() + "\n" for (node in depthFirst().drop(1)) { diff --git a/src-test-split/nyab/conf/QMyException.kt b/src-test-split/nyab/conf/QMyException.kt index 7962c70..d3f6268 100644 --- a/src-test-split/nyab/conf/QMyException.kt +++ b/src-test-split/nyab/conf/QMyException.kt @@ -13,33 +13,33 @@ package nyab.conf // qq-tree is a self-contained single-file library created by nyabkun. // This is a split-file version of the library, this file is not self-contained. -// CallChain[size=3] = QE <-[Ref]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=3] = QE <-[Ref]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal typealias QE = QMyException -// CallChain[size=4] = QMyException <-[Ref]- QE <-[Ref]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=4] = QMyException <-[Ref]- QE <-[Ref]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal enum class QMyException { - // CallChain[size=6] = QMyException.Other <-[Call]- QException.QException() <-[Ref]- QE.throwItBrack ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=6] = QMyException.Other <-[Call]- QException.QException() <-[Ref]- QE.throwItBrack ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] Other, - // CallChain[size=12] = QMyException.Unreachable <-[Call]- qUnreachable() <-[Call]- QFetchRule.SINGL ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=12] = QMyException.Unreachable <-[Call]- qUnreachable() <-[Call]- QFetchRule.SINGL ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] Unreachable, - // CallChain[size=3] = QMyException.ShouldBeTrue <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=3] = QMyException.ShouldBeTrue <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] ShouldBeTrue, - // CallChain[size=3] = QMyException.ShouldBeFalse <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=3] = QMyException.ShouldBeFalse <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] ShouldBeFalse, - // CallChain[size=13] = QMyException.ShouldNotBeNull <-[Call]- T?.qaNotNull() <-[Call]- qSrcFileAtFr ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=13] = QMyException.ShouldNotBeNull <-[Call]- T.qaNotNull() <-[Call]- qSrcFileAtFra ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] ShouldNotBeNull, - // CallChain[size=6] = QMyException.ShouldNotBeZero <-[Call]- Int?.qaNotZero() <-[Call]- CharSequenc ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=6] = QMyException.ShouldNotBeZero <-[Call]- Int.qaNotZero() <-[Call]- CharSequence ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] ShouldNotBeZero, - // CallChain[size=3] = QMyException.ShouldBeEqual <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=3] = QMyException.ShouldBeEqual <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] ShouldBeEqual, - // CallChain[size=4] = QMyException.ShouldBeEvenNumber <-[Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=4] = QMyException.ShouldBeEvenNumber <-[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] ShouldBeEvenNumber, - // CallChain[size=12] = QMyException.FileNotFound <-[Call]- qSrcFileAtFrame() <-[Call]- qSrcFileLine ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=12] = QMyException.FileNotFound <-[Call]- qSrcFileAtFrame() <-[Call]- qSrcFileLine ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] FileNotFound, - // CallChain[size=12] = QMyException.FetchLinesFail <-[Call]- Path.qFetchLinesAround() <-[Call]- qSr ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=12] = QMyException.FetchLinesFail <-[Call]- Path.qFetchLinesAround() <-[Call]- qSr ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] FetchLinesFail, - // CallChain[size=13] = QMyException.LineNumberExceedsMaximum <-[Call]- Path.qLineAt() <-[Call]- Pat ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=13] = QMyException.LineNumberExceedsMaximum <-[Call]- Path.qLineAt() <-[Call]- Pat ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] LineNumberExceedsMaximum, // CallChain[size=5] = QMyException.TrySetAccessibleFail <-[Call]- AccessibleObject.qTrySetAccessible() <-[Call]- qTestMethods() <-[Call]- qTest() <-[Call]- main()[Root] TrySetAccessibleFail, @@ -51,26 +51,21 @@ internal enum class QMyException { CycleDetected, // CallChain[size=3] = QMyException.TestFail <-[Call]- qTest() <-[Call]- main()[Root] - TestFail - ; + TestFail; - companion object { - // Required to implement extended functions. + +} - // CallChain[size=6] = QMyException.STACK_FRAME_FILTER <-[Call]- QException.QException() <-[Ref]- QE ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] - val STACK_FRAME_FILTER: (StackWalker.StackFrame) -> Boolean = { - !it.className.startsWith("org.gradle") && - !it.className.startsWith("org.testng") && - !it.className.startsWith("worker.org.gradle") && - !it.methodName.endsWith("\$default") && it.fileName != null && +// CallChain[size=6] = qSTACK_FRAME_FILTER <-[Call]- QException.QException() <-[Ref]- QE.throwItBrac ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +internal val qSTACK_FRAME_FILTER: (StackWalker.StackFrame) -> Boolean = { + !it.className.startsWith("org.gradle") && + !it.className.startsWith("org.testng") && + !it.className.startsWith("worker.org.gradle") && + !it.methodName.endsWith("\$default") && it.fileName != null && // && !it.className.startsWith(QException::class.qualifiedName!!) // && it.methodName != "invokeSuspend" - it.declaringClass != null + it.declaringClass != null // && it.declaringClass.canonicalName != null // && !it.declaringClass.canonicalName.startsWith("kotlin.coroutines.jvm.internal.") // && !it.declaringClass.canonicalName.startsWith("kotlinx.coroutines") - } - - - } } \ No newline at end of file diff --git a/src-test-split/nyab/conf/QMyLog.kt b/src-test-split/nyab/conf/QMyLog.kt index 18abd9d..9db532c 100644 --- a/src-test-split/nyab/conf/QMyLog.kt +++ b/src-test-split/nyab/conf/QMyLog.kt @@ -15,14 +15,14 @@ import nyab.util.QOut // qq-tree is a self-contained single-file library created by nyabkun. // This is a split-file version of the library, this file is not self-contained. -// CallChain[size=10] = QMyLog <-[Ref]- QLogStyle <-[Ref]- QLogStyle.SRC_AND_STACK <-[Call]- QExcept ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=10] = QMyLog <-[Ref]- QLogStyle <-[Ref]- QLogStyle.SRC_AND_STACK <-[Call]- QExcept ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal object QMyLog { - // CallChain[size=10] = QMyLog.out <-[Call]- QLogStyle <-[Ref]- QLogStyle.SRC_AND_STACK <-[Call]- QE ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=10] = QMyLog.out <-[Call]- QLogStyle <-[Ref]- QLogStyle.SRC_AND_STACK <-[Call]- QE ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] /** * Default output stream */ val out: QOut = QOut.CONSOLE - // CallChain[size=4] = QMyLog.no_format <-[Call]- Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=4] = QMyLog.no_format <-[Call]- Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] var no_format: Boolean = false } \ No newline at end of file diff --git a/src-test-split/nyab/conf/QMyMark.kt b/src-test-split/nyab/conf/QMyMark.kt index 7af76b6..57f4eee 100644 --- a/src-test-split/nyab/conf/QMyMark.kt +++ b/src-test-split/nyab/conf/QMyMark.kt @@ -15,13 +15,14 @@ import nyab.util.yellow // qq-tree is a self-contained single-file library created by nyabkun. // This is a split-file version of the library, this file is not self-contained. -// CallChain[size=6] = QMyMark <-[Ref]- QException.QException() <-[Ref]- QE.throwItBrackets() <-[Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=6] = QMyMark <-[Ref]- QException.QException() <-[Ref]- QE.throwItBrackets() <-[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +@Suppress("MayBeConstant") internal object QMyMark { - // CallChain[size=4] = QMyMark.TEST_METHOD <-[Call]- qTestMethods() <-[Call]- qTest() <-[Call]- main()[Root] - val TEST_METHOD = "☕".yellow - // CallChain[size=6] = QMyMark.WARN <-[Call]- QException.QException() <-[Ref]- QE.throwItBrackets() <-[Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] - val WARN = "⚠".yellow - // CallChain[size=3] = QMyMark.TEST_START <-[Call]- qTest() <-[Call]- main()[Root] - val TEST_START = "☘".yellow + // CallChain[size=4] = QMyMark.test_method <-[Call]- qTestMethods() <-[Call]- qTest() <-[Call]- main()[Root] + val test_method = "☕".yellow + // CallChain[size=6] = QMyMark.warn <-[Call]- QException.QException() <-[Ref]- QE.throwItBrackets() <-[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + val warn = "⚠".yellow + // CallChain[size=3] = QMyMark.test_start <-[Call]- qTest() <-[Call]- main()[Root] + val test_start = "☘".yellow } \ No newline at end of file diff --git a/src-test-split/nyab/conf/QMyPath.kt b/src-test-split/nyab/conf/QMyPath.kt index 7aaf696..6d5f8fb 100644 --- a/src-test-split/nyab/conf/QMyPath.kt +++ b/src-test-split/nyab/conf/QMyPath.kt @@ -21,26 +21,26 @@ import nyab.util.qListByMatch // qq-tree is a self-contained single-file library created by nyabkun. // This is a split-file version of the library, this file is not self-contained. -// CallChain[size=9] = QMyPath <-[Ref]- qLogStackFrames() <-[Call]- QException.mySrcAndStack <-[Call ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=9] = QMyPath <-[Ref]- qLogStackFrames() <-[Call]- QException.mySrcAndStack <-[Call ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal object QMyPath { // -- dirs - // CallChain[size=10] = QMyPath.src <-[Call]- QMyPath.src_root <-[Call]- qLogStackFrames() <-[Call]- ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=10] = QMyPath.src <-[Call]- QMyPath.src_root <-[Call]- qLogStackFrames() <-[Call]- ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val src = "src".path - // CallChain[size=10] = QMyPath.src_java <-[Call]- QMyPath.src_root <-[Call]- qLogStackFrames() <-[C ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=10] = QMyPath.src_java <-[Call]- QMyPath.src_root <-[Call]- qLogStackFrames() <-[C ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val src_java = "src-java".path - // CallChain[size=10] = QMyPath.src_build <-[Call]- QMyPath.src_root <-[Call]- qLogStackFrames() <-[ ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=10] = QMyPath.src_build <-[Call]- QMyPath.src_root <-[Call]- qLogStackFrames() <-[ ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val src_build = "src-build".path - // CallChain[size=10] = QMyPath.src_experiment <-[Call]- QMyPath.src_root <-[Call]- qLogStackFrames( ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=10] = QMyPath.src_experiment <-[Call]- QMyPath.src_root <-[Call]- qLogStackFrames( ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val src_experiment = "src-experiment".path - // CallChain[size=10] = QMyPath.src_plugin <-[Call]- QMyPath.src_root <-[Call]- qLogStackFrames() <- ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=10] = QMyPath.src_plugin <-[Call]- QMyPath.src_root <-[Call]- qLogStackFrames() <- ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val src_plugin = "src-plugin".path - // CallChain[size=10] = QMyPath.src_config <-[Call]- QMyPath.src_root <-[Call]- qLogStackFrames() <- ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=10] = QMyPath.src_config <-[Call]- QMyPath.src_root <-[Call]- qLogStackFrames() <- ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val src_config = "src-config".path - // CallChain[size=10] = QMyPath.src_test <-[Call]- QMyPath.src_root <-[Call]- qLogStackFrames() <-[C ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=10] = QMyPath.src_test <-[Call]- QMyPath.src_root <-[Call]- qLogStackFrames() <-[C ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val src_test = "src-test".path // --- dir list - // CallChain[size=9] = QMyPath.src_root <-[Call]- qLogStackFrames() <-[Call]- QException.mySrcAndSta ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=9] = QMyPath.src_root <-[Call]- qLogStackFrames() <-[Call]- QException.mySrcAndSta ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val src_root: List by lazy { val base = listOf( src, diff --git a/src-test-split/nyab/conf/QMyTest.kt b/src-test-split/nyab/conf/QMyTest.kt index d006eed..c585ce7 100644 --- a/src-test-split/nyab/conf/QMyTest.kt +++ b/src-test-split/nyab/conf/QMyTest.kt @@ -13,9 +13,9 @@ package nyab.conf // qq-tree is a self-contained single-file library created by nyabkun. // This is a split-file version of the library, this file is not self-contained. -// CallChain[size=4] = QMyTest <-[Ref]- qOkToTest() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=4] = QMyTest <-[Ref]- qOkToTest() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal object QMyTest { - // CallChain[size=4] = QMyTest.forceTestMode <-[Call]- qOkToTest() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=4] = QMyTest.forceTestMode <-[Call]- qOkToTest() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] const val forceTestMode = true } \ No newline at end of file diff --git a/src-test-split/nyab/conf/QMyToString.kt b/src-test-split/nyab/conf/QMyToString.kt index 2bcc815..2129d53 100644 --- a/src-test-split/nyab/conf/QMyToString.kt +++ b/src-test-split/nyab/conf/QMyToString.kt @@ -13,7 +13,7 @@ package nyab.conf // qq-tree is a self-contained single-file library created by nyabkun. // This is a split-file version of the library, this file is not self-contained. -// CallChain[size=6] = QMyToString <-[Call]- qToStringRegistry <-[Call]- Any?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=6] = QMyToString <-[Call]- qToStringRegistry <-[Call]- Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal object QMyToString { } \ No newline at end of file diff --git a/src-test-split/nyab/match/QM.kt b/src-test-split/nyab/match/QM.kt index dfd8986..c680e2b 100644 --- a/src-test-split/nyab/match/QM.kt +++ b/src-test-split/nyab/match/QM.kt @@ -13,96 +13,96 @@ package nyab.match // qq-tree is a self-contained single-file library created by nyabkun. // This is a split-file version of the library, this file is not self-contained. -// CallChain[size=14] = String.qMatches() <-[Call]- Path.qFind() <-[Call]- Collection.qFind() ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=14] = String.qMatches() <-[Call]- Path.qFind() <-[Call]- Collection.qFind() ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun String.qMatches(matcher: QM): Boolean = matcher.matches(this) -// CallChain[size=5] = not <-[Call]- QM.notExact() <-[Call]- QMMethod.nameNotExact() <-[Call]- qTest() <-[Call]- main()[Root] +// CallChain[size=5] = QM.not <-[Call]- QM.notExact() <-[Call]- QMMethod.nameNotExact() <-[Call]- qTest() <-[Call]- main()[Root] private val QM.not: QM get() = QMatchNot(this) -// CallChain[size=6] = QMatchNot <-[Call]- not <-[Call]- QM.notExact() <-[Call]- QMMethod.nameNotExact() <-[Call]- qTest() <-[Call]- main()[Root] +// CallChain[size=6] = QMatchNot <-[Call]- QM.not <-[Call]- QM.notExact() <-[Call]- QMMethod.nameNotExact() <-[Call]- qTest() <-[Call]- main()[Root] private class QMatchNot(val matcher: QM) : QM { - // CallChain[size=7] = QMatchNot.matches() <-[Propag]- QMatchNot <-[Call]- not <-[Call]- QM.notExact() <-[Call]- QMMethod.nameNotExact() <-[Call]- qTest() <-[Call]- main()[Root] + // CallChain[size=7] = QMatchNot.matches() <-[Propag]- QMatchNot <-[Call]- QM.not <-[Call]- QM.notExact() <-[Call]- QMMethod.nameNotExact() <-[Call]- qTest() <-[Call]- main()[Root] override fun matches(text: String): Boolean = !matcher.matches(text) - // CallChain[size=7] = QMatchNot.toString() <-[Propag]- QMatchNot <-[Call]- not <-[Call]- QM.notExact() <-[Call]- QMMethod.nameNotExact() <-[Call]- qTest() <-[Call]- main()[Root] + // CallChain[size=7] = QMatchNot.toString() <-[Propag]- QMatchNot <-[Call]- QM.not <-[Call]- QM.notExact() <-[Call]- QMMethod.nameNotExact() <-[Call]- qTest() <-[Call]- main()[Root] override fun toString(): String { return this::class.simpleName.toString() + "(matcher=$matcher)" } } -// CallChain[size=14] = QMatchAny <-[Call]- QM.isAny() <-[Propag]- QM.exact() <-[Call]- qSrcFileAtFr ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=14] = QMatchAny <-[Call]- QM.isAny() <-[Propag]- QM.exact() <-[Call]- qSrcFileAtFr ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal object QMatchAny : QM { - // CallChain[size=15] = QMatchAny.matches() <-[Propag]- QMatchAny <-[Call]- QM.isAny() <-[Propag]- Q ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=15] = QMatchAny.matches() <-[Propag]- QMatchAny <-[Call]- QM.isAny() <-[Propag]- Q ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun matches(text: String): Boolean { return true } - // CallChain[size=15] = QMatchAny.toString() <-[Propag]- QMatchAny <-[Call]- QM.isAny() <-[Propag]- ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=15] = QMatchAny.toString() <-[Propag]- QMatchAny <-[Call]- QM.isAny() <-[Propag]- ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun toString(): String { return this::class.simpleName.toString() } } -// CallChain[size=14] = QMatchNone <-[Call]- QM.isNone() <-[Propag]- QM.exact() <-[Call]- qSrcFileAt ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=14] = QMatchNone <-[Call]- QM.isNone() <-[Propag]- QM.exact() <-[Call]- qSrcFileAt ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal object QMatchNone : QM { - // CallChain[size=15] = QMatchNone.matches() <-[Propag]- QMatchNone <-[Call]- QM.isNone() <-[Propag] ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=15] = QMatchNone.matches() <-[Propag]- QMatchNone <-[Call]- QM.isNone() <-[Propag] ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun matches(text: String): Boolean { return false } - // CallChain[size=15] = QMatchNone.toString() <-[Propag]- QMatchNone <-[Call]- QM.isNone() <-[Propag ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=15] = QMatchNone.toString() <-[Propag]- QMatchNone <-[Call]- QM.isNone() <-[Propag ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun toString(): String { return this::class.simpleName.toString() } } -// CallChain[size=13] = QM <-[Ref]- QM.exact() <-[Call]- qSrcFileAtFrame() <-[Call]- qSrcFileLinesAt ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=13] = QM <-[Ref]- QM.exact() <-[Call]- qSrcFileAtFrame() <-[Call]- qSrcFileLinesAt ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal interface QM { - // CallChain[size=13] = QM.matches() <-[Propag]- QM.exact() <-[Call]- qSrcFileAtFrame() <-[Call]- qS ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=13] = QM.matches() <-[Propag]- QM.exact() <-[Call]- qSrcFileAtFrame() <-[Call]- qS ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun matches(text: String): Boolean - // CallChain[size=13] = QM.isAny() <-[Propag]- QM.exact() <-[Call]- qSrcFileAtFrame() <-[Call]- qSrc ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=13] = QM.isAny() <-[Propag]- QM.exact() <-[Call]- qSrcFileAtFrame() <-[Call]- qSrc ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun isAny(): Boolean = this == QMatchAny - // CallChain[size=13] = QM.isNone() <-[Propag]- QM.exact() <-[Call]- qSrcFileAtFrame() <-[Call]- qSr ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=13] = QM.isNone() <-[Propag]- QM.exact() <-[Call]- qSrcFileAtFrame() <-[Call]- qSr ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun isNone(): Boolean = this == QMatchNone companion object { - // CallChain[size=12] = QM.exact() <-[Call]- qSrcFileAtFrame() <-[Call]- qSrcFileLinesAtFrame() <-[C ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=12] = QM.exact() <-[Call]- qSrcFileAtFrame() <-[Call]- qSrcFileLinesAtFrame() <-[C ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun exact(text: String, ignoreCase: Boolean = false): QM = QExactMatch(text, ignoreCase) // CallChain[size=4] = QM.notExact() <-[Call]- QMMethod.nameNotExact() <-[Call]- qTest() <-[Call]- main()[Root] fun notExact(text: String, ignoreCase: Boolean = false): QM = QExactMatch(text, ignoreCase).not - // CallChain[size=10] = QM.startsWith() <-[Call]- QMyPath.src_root <-[Call]- qLogStackFrames() <-[Ca ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=10] = QM.startsWith() <-[Call]- QMyPath.src_root <-[Call]- qLogStackFrames() <-[Ca ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun startsWith(text: String, ignoreCase: Boolean = false): QM = QStartsWithMatch(text, ignoreCase) } } -// CallChain[size=13] = QExactMatch <-[Call]- QM.exact() <-[Call]- qSrcFileAtFrame() <-[Call]- qSrcF ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=13] = QExactMatch <-[Call]- QM.exact() <-[Call]- qSrcFileAtFrame() <-[Call]- qSrcF ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private class QExactMatch(val textExact: String, val ignoreCase: Boolean = false) : QM { - // CallChain[size=14] = QExactMatch.matches() <-[Propag]- QExactMatch <-[Call]- QM.exact() <-[Call]- ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=14] = QExactMatch.matches() <-[Propag]- QExactMatch <-[Call]- QM.exact() <-[Call]- ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun matches(text: String): Boolean { return text.equals(textExact, ignoreCase) } - // CallChain[size=14] = QExactMatch.toString() <-[Propag]- QExactMatch <-[Call]- QM.exact() <-[Call] ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=14] = QExactMatch.toString() <-[Propag]- QExactMatch <-[Call]- QM.exact() <-[Call] ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun toString(): String { return this::class.simpleName + "(textExact=$textExact, ignoreCase=$ignoreCase)" } } -// CallChain[size=11] = QStartsWithMatch <-[Call]- QM.startsWith() <-[Call]- QMyPath.src_root <-[Cal ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=11] = QStartsWithMatch <-[Call]- QM.startsWith() <-[Call]- QMyPath.src_root <-[Cal ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private class QStartsWithMatch(val textStartsWith: String, val ignoreCase: Boolean = false) : QM { - // CallChain[size=12] = QStartsWithMatch.matches() <-[Propag]- QStartsWithMatch <-[Call]- QM.startsW ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=12] = QStartsWithMatch.matches() <-[Propag]- QStartsWithMatch <-[Call]- QM.startsW ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun matches(text: String): Boolean { return text.startsWith(textStartsWith, ignoreCase) } - // CallChain[size=12] = QStartsWithMatch.toString() <-[Propag]- QStartsWithMatch <-[Call]- QM.starts ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=12] = QStartsWithMatch.toString() <-[Propag]- QStartsWithMatch <-[Call]- QM.starts ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun toString(): String { return this::class.simpleName + "(textStartsWith=$textStartsWith, ignoreCase=$ignoreCase)" } diff --git a/src-test-split/nyab/match/QMFunc.kt b/src-test-split/nyab/match/QMFunc.kt index b2199ea..6d1fc64 100644 --- a/src-test-split/nyab/match/QMFunc.kt +++ b/src-test-split/nyab/match/QMFunc.kt @@ -19,10 +19,10 @@ import nyab.util.QFlagEnum // qq-tree is a self-contained single-file library created by nyabkun. // This is a split-file version of the library, this file is not self-contained. -// CallChain[size=7] = qAnd() <-[Call]- QMFunc.and() <-[Call]- qToStringRegistry <-[Call]- Any?.qToS ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=7] = qAnd() <-[Call]- QMFunc.and() <-[Call]- qToStringRegistry <-[Call]- Any.qToSt ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun qAnd(vararg matches: QMFunc): QMFunc = QMatchFuncAnd(*matches) -// CallChain[size=6] = QMFunc.and() <-[Call]- qToStringRegistry <-[Call]- Any?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=6] = QMFunc.and() <-[Call]- qToStringRegistry <-[Call]- Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal infix fun QMFunc.and(match: QMFunc): QMFunc { return if (this is QMatchFuncAnd) { QMatchFuncAnd(*matchList, match) @@ -31,91 +31,91 @@ internal infix fun QMFunc.and(match: QMFunc): QMFunc { } } -// CallChain[size=8] = QMatchFuncAny <-[Call]- QMFunc.isAny() <-[Propag]- QMFunc.IncludeExtensionsIn ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=8] = QMatchFuncAny <-[Call]- QMFunc.isAny() <-[Propag]- QMFunc.IncludeExtensionsIn ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private object QMatchFuncAny : QMFuncA() { - // CallChain[size=9] = QMatchFuncAny.matches() <-[Propag]- QMatchFuncAny <-[Call]- QMFunc.isAny() <- ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=9] = QMatchFuncAny.matches() <-[Propag]- QMatchFuncAny <-[Call]- QMFunc.isAny() <- ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun matches(value: KFunction<*>): Boolean { return true } } -// CallChain[size=8] = QMatchFuncNone <-[Call]- QMFunc.isNone() <-[Propag]- QMFunc.IncludeExtensions ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=8] = QMatchFuncNone <-[Call]- QMFunc.isNone() <-[Propag]- QMFunc.IncludeExtensions ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private object QMatchFuncNone : QMFuncA() { - // CallChain[size=9] = QMatchFuncNone.matches() <-[Propag]- QMatchFuncNone <-[Call]- QMFunc.isNone() ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=9] = QMatchFuncNone.matches() <-[Propag]- QMatchFuncNone <-[Call]- QMFunc.isNone() ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun matches(value: KFunction<*>): Boolean { return false } } -// CallChain[size=7] = QMatchFuncDeclaredOnly <-[Call]- QMFunc.DeclaredOnly <-[Call]- qToStringRegis ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=7] = QMatchFuncDeclaredOnly <-[Call]- QMFunc.DeclaredOnly <-[Call]- qToStringRegis ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private object QMatchFuncDeclaredOnly : QMFuncA() { - // CallChain[size=8] = QMatchFuncDeclaredOnly.declaredOnly <-[Propag]- QMatchFuncDeclaredOnly <-[Cal ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=8] = QMatchFuncDeclaredOnly.declaredOnly <-[Propag]- QMatchFuncDeclaredOnly <-[Cal ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override val declaredOnly = true - // CallChain[size=8] = QMatchFuncDeclaredOnly.matches() <-[Propag]- QMatchFuncDeclaredOnly <-[Call]- ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=8] = QMatchFuncDeclaredOnly.matches() <-[Propag]- QMatchFuncDeclaredOnly <-[Call]- ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun matches(value: KFunction<*>): Boolean { return true } } -// CallChain[size=7] = QMatchFuncIncludeExtensionsInClass <-[Call]- QMFunc.IncludeExtensionsInClass ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=7] = QMatchFuncIncludeExtensionsInClass <-[Call]- QMFunc.IncludeExtensionsInClass ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private object QMatchFuncIncludeExtensionsInClass : QMFuncA() { - // CallChain[size=8] = QMatchFuncIncludeExtensionsInClass.includeExtensionsInClass <-[Propag]- QMatc ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=8] = QMatchFuncIncludeExtensionsInClass.includeExtensionsInClass <-[Propag]- QMatc ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override val includeExtensionsInClass = true - // CallChain[size=8] = QMatchFuncIncludeExtensionsInClass.matches() <-[Propag]- QMatchFuncIncludeExt ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=8] = QMatchFuncIncludeExtensionsInClass.matches() <-[Propag]- QMatchFuncIncludeExt ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun matches(value: KFunction<*>): Boolean { return true } } -// CallChain[size=7] = QMatchFuncAnd <-[Ref]- QMFunc.and() <-[Call]- qToStringRegistry <-[Call]- Any ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=7] = QMatchFuncAnd <-[Ref]- QMFunc.and() <-[Call]- qToStringRegistry <-[Call]- Any ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private class QMatchFuncAnd(vararg match: QMFunc) : QMFuncA() { - // CallChain[size=7] = QMatchFuncAnd.matchList <-[Call]- QMFunc.and() <-[Call]- qToStringRegistry <- ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=7] = QMatchFuncAnd.matchList <-[Call]- QMFunc.and() <-[Call]- qToStringRegistry <- ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val matchList = match - // CallChain[size=8] = QMatchFuncAnd.declaredOnly <-[Propag]- QMatchFuncAnd.matchList <-[Call]- QMFu ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=8] = QMatchFuncAnd.declaredOnly <-[Propag]- QMatchFuncAnd.matchList <-[Call]- QMFu ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override val declaredOnly = matchList.any { it.declaredOnly } - // CallChain[size=8] = QMatchFuncAnd.includeExtensionsInClass <-[Propag]- QMatchFuncAnd.matchList <- ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=8] = QMatchFuncAnd.includeExtensionsInClass <-[Propag]- QMatchFuncAnd.matchList <- ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override val includeExtensionsInClass: Boolean = matchList.any { it.includeExtensionsInClass } - // CallChain[size=8] = QMatchFuncAnd.matches() <-[Propag]- QMatchFuncAnd.matchList <-[Call]- QMFunc. ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=8] = QMatchFuncAnd.matches() <-[Propag]- QMatchFuncAnd.matchList <-[Call]- QMFunc. ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun matches(value: KFunction<*>): Boolean { return matchList.all { it.matches(value) } } } -// CallChain[size=9] = QMFuncA <-[Call]- QMatchFuncNone <-[Call]- QMFunc.isNone() <-[Propag]- QMFunc ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=9] = QMFuncA <-[Call]- QMatchFuncNone <-[Call]- QMFunc.isNone() <-[Propag]- QMFunc ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private abstract class QMFuncA : QMFunc { - // CallChain[size=10] = QMFuncA.declaredOnly <-[Propag]- QMFuncA <-[Call]- QMatchFuncNone <-[Call]- ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=10] = QMFuncA.declaredOnly <-[Propag]- QMFuncA <-[Call]- QMatchFuncNone <-[Call]- ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override val declaredOnly: Boolean = false - // CallChain[size=10] = QMFuncA.includeExtensionsInClass <-[Propag]- QMFuncA <-[Call]- QMatchFuncNon ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=10] = QMFuncA.includeExtensionsInClass <-[Propag]- QMFuncA <-[Call]- QMatchFuncNon ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override val includeExtensionsInClass: Boolean = false } -// CallChain[size=7] = QMFunc <-[Ref]- QMFunc.IncludeExtensionsInClass <-[Call]- qToStringRegistry < ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=7] = QMFunc <-[Ref]- QMFunc.IncludeExtensionsInClass <-[Call]- qToStringRegistry < ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal interface QMFunc { - // CallChain[size=7] = QMFunc.declaredOnly <-[Propag]- QMFunc.IncludeExtensionsInClass <-[Call]- qTo ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=7] = QMFunc.declaredOnly <-[Propag]- QMFunc.IncludeExtensionsInClass <-[Call]- qTo ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val declaredOnly: Boolean - // CallChain[size=7] = QMFunc.includeExtensionsInClass <-[Propag]- QMFunc.IncludeExtensionsInClass < ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=7] = QMFunc.includeExtensionsInClass <-[Propag]- QMFunc.IncludeExtensionsInClass < ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val includeExtensionsInClass: Boolean - // CallChain[size=7] = QMFunc.matches() <-[Propag]- QMFunc.IncludeExtensionsInClass <-[Call]- qToStr ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=7] = QMFunc.matches() <-[Propag]- QMFunc.IncludeExtensionsInClass <-[Call]- qToStr ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun matches(value: KFunction<*>): Boolean - // CallChain[size=7] = QMFunc.isAny() <-[Propag]- QMFunc.IncludeExtensionsInClass <-[Call]- qToStrin ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=7] = QMFunc.isAny() <-[Propag]- QMFunc.IncludeExtensionsInClass <-[Call]- qToStrin ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun isAny(): Boolean = this == QMatchFuncAny - // CallChain[size=7] = QMFunc.isNone() <-[Propag]- QMFunc.IncludeExtensionsInClass <-[Call]- qToStri ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=7] = QMFunc.isNone() <-[Propag]- QMFunc.IncludeExtensionsInClass <-[Call]- qToStri ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun isNone(): Boolean = this == QMatchFuncNone companion object { - // CallChain[size=6] = QMFunc.DeclaredOnly <-[Call]- qToStringRegistry <-[Call]- Any?.qToString() <- ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=6] = QMFunc.DeclaredOnly <-[Call]- qToStringRegistry <-[Call]- Any.qToString() <-[ ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val DeclaredOnly: QMFunc = QMatchFuncDeclaredOnly - // CallChain[size=6] = QMFunc.IncludeExtensionsInClass <-[Call]- qToStringRegistry <-[Call]- Any?.qT ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=6] = QMFunc.IncludeExtensionsInClass <-[Call]- qToStringRegistry <-[Call]- Any.qTo ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] // TODO OnlyExtensionsInClass val IncludeExtensionsInClass: QMFunc = QMatchFuncIncludeExtensionsInClass @@ -124,7 +124,7 @@ internal interface QMFunc { // TODO vararg, nullability, param names, type parameter // TODO handle createType() more carefully - // CallChain[size=6] = QMFunc.nameExact() <-[Call]- qToStringRegistry <-[Call]- Any?.qToString() <-[ ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=6] = QMFunc.nameExact() <-[Call]- qToStringRegistry <-[Call]- Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun nameExact(text: String, ignoreCase: Boolean = false): QMFunc { return QMatchFuncName(QM.exact(text, ignoreCase = ignoreCase)) } @@ -133,14 +133,14 @@ internal interface QMFunc { } } -// CallChain[size=7] = QMatchFuncName <-[Call]- QMFunc.nameExact() <-[Call]- qToStringRegistry <-[Ca ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=7] = QMatchFuncName <-[Call]- QMFunc.nameExact() <-[Call]- qToStringRegistry <-[Ca ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private class QMatchFuncName(val nameMatcher: QM) : QMFuncA() { - // CallChain[size=8] = QMatchFuncName.matches() <-[Propag]- QMatchFuncName <-[Call]- QMFunc.nameExac ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=8] = QMatchFuncName.matches() <-[Propag]- QMatchFuncName <-[Call]- QMFunc.nameExac ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun matches(value: KFunction<*>): Boolean { return nameMatcher.matches(value.name) } - // CallChain[size=8] = QMatchFuncName.toString() <-[Propag]- QMatchFuncName <-[Call]- QMFunc.nameExa ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=8] = QMatchFuncName.toString() <-[Propag]- QMatchFuncName <-[Call]- QMFunc.nameExa ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun toString(): String { return this::class.simpleName + ":" + nameMatcher.toString() } diff --git a/src-test-split/nyab/match/QMMethod.kt b/src-test-split/nyab/match/QMMethod.kt index fe114a2..b1699de 100644 --- a/src-test-split/nyab/match/QMMethod.kt +++ b/src-test-split/nyab/match/QMMethod.kt @@ -19,7 +19,7 @@ import nyab.util.qIsAssignableFrom // qq-tree is a self-contained single-file library created by nyabkun. // This is a split-file version of the library, this file is not self-contained. -// CallChain[size=4] = not <-[Call]- QMMethod.notAnnotation() <-[Call]- qTest() <-[Call]- main()[Root] +// CallChain[size=4] = QMMethod.not <-[Call]- QMMethod.notAnnotation() <-[Call]- qTest() <-[Call]- main()[Root] private val QMMethod.not: QMMethod get() = QMatchMethodNot(this) @@ -47,9 +47,9 @@ internal infix fun QMMethod.or(match: QMMethod): QMMethod { } } -// CallChain[size=5] = QMatchMethodNot <-[Call]- not <-[Call]- QMMethod.notAnnotation() <-[Call]- qTest() <-[Call]- main()[Root] +// CallChain[size=5] = QMatchMethodNot <-[Call]- QMMethod.not <-[Call]- QMMethod.notAnnotation() <-[Call]- qTest() <-[Call]- main()[Root] private class QMatchMethodNot(val matcher: QMMethod) : QMMethodA() { - // CallChain[size=6] = QMatchMethodNot.matches() <-[Propag]- QMatchMethodNot <-[Call]- not <-[Call]- QMMethod.notAnnotation() <-[Call]- qTest() <-[Call]- main()[Root] + // CallChain[size=6] = QMatchMethodNot.matches() <-[Propag]- QMatchMethodNot <-[Call]- QMMethod.not <-[Call]- QMMethod.notAnnotation() <-[Call]- qTest() <-[Call]- main()[Root] override fun matches(value: Method): Boolean = !matcher.matches(value) } diff --git a/src-test-split/nyab/test/QTest.kt b/src-test-split/nyab/test/QTest.kt index 2b90459..4897e8c 100644 --- a/src-test-split/nyab/test/QTest.kt +++ b/src-test-split/nyab/test/QTest.kt @@ -34,7 +34,7 @@ import nyab.util.light_gray import nyab.util.light_green import nyab.util.light_red import nyab.util.light_yellow -import nyab.util.noColor +import nyab.util.noStyle import nyab.util.qBrackets import nyab.util.qCallerFileName import nyab.util.qColor @@ -91,7 +91,7 @@ internal data class QTestResultElement(val method: Method, val cause: Throwable? get() = cause == null } -// CallChain[size=5] = allTestedMethods <-[Call]- QTestResult.printIt() <-[Call]- qTestMethods() <-[Call]- qTest() <-[Call]- main()[Root] +// CallChain[size=5] = List.allTestedMethods <-[Call]- QTestResult.printIt() <-[Call]- qTestMethods() <-[Call]- qTest() <-[Call]- main()[Root] internal val List.allTestedMethods: String get() = "\n[${"Tested".light_blue}]\n" + @@ -151,7 +151,7 @@ internal class QTestResult(val elements: List, val time: Lon """(.*($ta|${ta}Kt).*?)\(""" }.re - val stackStr = stackColoringRegex.replace(cause.mySrcAndStack, "$1".qColor(QShColor.BLUE) + "(") + val stackStr = stackColoringRegex.replace(cause.mySrcAndStack, "$1".qColor(QShColor.Blue) + "(") cause.message + "\n\n" + stackStr } else { @@ -187,7 +187,7 @@ private fun qTestMethods( val timeItResult = qTimeIt(quiet = true) { for (method in methodsToTest) { // "⭐" - out.println(qSeparatorWithLabel("${QMyMark.TEST_METHOD} " + method.qName(true))) + out.println(qSeparatorWithLabel("${QMyMark.test_method} " + method.qName(true))) method.qTrySetAccessible() @@ -303,7 +303,7 @@ internal fun qTest( qLogStackFrames( // "🚀" - msg = "${QMyMark.TEST_START} Test Start ${QMyMark.TEST_START}\n$targets".light_blue, + msg = "${QMyMark.test_start} Test Start ${QMyMark.test_start}\n$targets".light_blue, style = QLogStyle.MSG_AND_STACK, frames = listOf( qStackFrameEntryMethod { frame -> @@ -333,32 +333,32 @@ internal fun qTest( } } -// CallChain[size=3] = qFailMsg() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=3] = qFailMsg() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun qFailMsg(msg: String = "it is null"): String { val cMsg = "[$msg]".colorIt - return "${QMyMark.WARN} $cMsg" + return "${QMyMark.warn} $cMsg" } -// CallChain[size=3] = qFailMsg() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=3] = qFailMsg() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun qFailMsg(actual: Any?, msg: String = "is not equals to", expected: Any?): String { val cMsg = "[$msg]".colorIt val actualStr = actual.qToLogString() + " " + "(actual)".light_green val expectedStr = expected.qToLogString() + " " + "(expected)".blue - return "${QMyMark.WARN} ${actualStr.qWithNewLineSurround(onlyIf = QOnlyIfStr.Always)}$cMsg${ + return "${QMyMark.warn} ${actualStr.qWithNewLineSurround(onlyIf = QOnlyIfStr.Always)}$cMsg${ expectedStr.qWithNewLinePrefix(onlyIf = QOnlyIfStr.Always) }" } -// CallChain[size=4] = colorIt <-[Call]- qFailMsg() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=4] = String.colorIt <-[Call]- qFailMsg() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private val String.colorIt: String get() = this.light_yellow -// CallChain[size=3] = qThrowIt() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=3] = qThrowIt() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun qThrowIt(msg: String, exception: QE) { throw QException(exception, msg, null, stackDepth = 2, srcCut = QSrcCut.MULTILINE_INFIX_NOCUT) } -// CallChain[size=2] = Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=2] = Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal infix fun Any?.shouldBe(expected: Any?) { if (!qOkToTest()) return @@ -377,7 +377,7 @@ internal infix fun Any?.shouldBe(expected: Any?) { val thisStr = this.qToLogString() val expectedStr = expected.qToLogString() - if (thisStr.trim().noColor != expectedStr.trim().noColor) { + if (thisStr.trim().noStyle != expectedStr.trim().noStyle) { val msg = qFailMsg(thisStr, "is not equals to", expectedStr) val diffIdx = @@ -418,7 +418,7 @@ internal infix fun Any?.shouldBe(expected: Any?) { } } -// CallChain[size=3] = qOkToTest() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=3] = qOkToTest() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private inline fun qOkToTest(): Boolean { return QMyTest.forceTestMode || qIsTesting || qIsDebugging } \ No newline at end of file diff --git a/src-test-split/nyab/util/QBit.kt b/src-test-split/nyab/util/QBit.kt index 5e58b24..3f69cfa 100644 --- a/src-test-split/nyab/util/QBit.kt +++ b/src-test-split/nyab/util/QBit.kt @@ -13,5 +13,5 @@ package nyab.util // qq-tree is a self-contained single-file library created by nyabkun. // This is a split-file version of the library, this file is not self-contained. -// CallChain[size=3] = Char.qToHex() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=3] = Char.qToHex() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun Char.qToHex(): String = String.format("%02X", code) \ No newline at end of file diff --git a/src-test-split/nyab/util/QCache.kt b/src-test-split/nyab/util/QCache.kt index ac59a30..daa536d 100644 --- a/src-test-split/nyab/util/QCache.kt +++ b/src-test-split/nyab/util/QCache.kt @@ -20,10 +20,10 @@ import nyab.match.QM // qq-tree is a self-contained single-file library created by nyabkun. // This is a split-file version of the library, this file is not self-contained. -// CallChain[size=13] = qDEFAULT_CACHE_IT_EXPIRATION_CHECK_INTERVAL <-[Call]- QCacheMap.QCacheMap() ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=13] = qDEFAULT_CACHE_IT_EXPIRATION_CHECK_INTERVAL <-[Call]- QCacheMap.QCacheMap() ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal const val qDEFAULT_CACHE_IT_EXPIRATION_CHECK_INTERVAL = 1000L -// CallChain[size=11] = qThreadLocalCache <-[Call]- qCacheItTimedThreadLocal() <-[Call]- qCacheItOne ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=11] = qThreadLocalCache <-[Call]- qCacheItTimedThreadLocal() <-[Call]- qCacheItOne ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private val qThreadLocalCache: ThreadLocal by lazy { ThreadLocal.withInitial { QCacheMap( @@ -32,44 +32,44 @@ private val qThreadLocalCache: ThreadLocal by lazy { } } -// CallChain[size=12] = qCacheThreadSafe <-[Call]- qCacheItTimed() <-[Call]- qCacheItOneSec() <-[Cal ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=12] = qCacheThreadSafe <-[Call]- qCacheItTimed() <-[Call]- qCacheItOneSec() <-[Cal ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private val qCacheThreadSafe: QCacheMap by lazy { QCacheMap(qDEFAULT_CACHE_IT_EXPIRATION_CHECK_INTERVAL, true) } -// CallChain[size=10] = qCacheItOneSec() <-[Call]- qMySrcLinesAtFrame() <-[Call]- qLogStackFrames() ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=10] = qCacheItOneSec() <-[Call]- qMySrcLinesAtFrame() <-[Call]- qLogStackFrames() ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun qCacheItOneSec(key: K, block: () -> V): V = qCacheItTimed(key, 1000L, block) -// CallChain[size=11] = qCacheItTimed() <-[Call]- qCacheItOneSec() <-[Call]- qMySrcLinesAtFrame() <- ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=11] = qCacheItTimed() <-[Call]- qCacheItOneSec() <-[Call]- qMySrcLinesAtFrame() <- ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun qCacheItTimed(key: K, duration: Long, block: () -> V): V = qCacheThreadSafe.getOrPut(key) { QCacheEntry(block(), duration, qNow) }.value as V -// CallChain[size=9] = qCacheItOneSecThreadLocal() <-[Call]- qRe() <-[Call]- String.qReplaceFirstIfN ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=9] = qCacheItOneSecThreadLocal() <-[Call]- qRe() <-[Call]- QException.mySrcAndStac ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun qCacheItOneSecThreadLocal(key: K, block: () -> V): V = qCacheItTimedThreadLocal(key, 1000L, block) -// CallChain[size=10] = qCacheItTimedThreadLocal() <-[Call]- qCacheItOneSecThreadLocal() <-[Call]- q ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=10] = qCacheItTimedThreadLocal() <-[Call]- qCacheItOneSecThreadLocal() <-[Call]- q ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun qCacheItTimedThreadLocal(key: K, duration: Long, block: () -> V): V = qThreadLocalCache.get().getOrPut(key) { QCacheEntry(block(), duration, qNow) }.value as V -// CallChain[size=12] = QCacheMap <-[Ref]- qThreadLocalCache <-[Call]- qCacheItTimedThreadLocal() <- ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=12] = QCacheMap <-[Ref]- qThreadLocalCache <-[Call]- qCacheItTimedThreadLocal() <- ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal class QCacheMap( val expirationCheckInterval: Long = qDEFAULT_CACHE_IT_EXPIRATION_CHECK_INTERVAL, val threadSafe: Boolean = false ) { - // CallChain[size=12] = QCacheMap.lastCheck <-[Call]- QCacheMap.getOrPut() <-[Call]- qCacheItTimedTh ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=12] = QCacheMap.lastCheck <-[Call]- QCacheMap.getOrPut() <-[Call]- qCacheItTimedTh ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] var lastCheck: Long = -1 - // CallChain[size=12] = QCacheMap.lock <-[Call]- QCacheMap.getOrPut() <-[Call]- qCacheItTimedThreadL ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=12] = QCacheMap.lock <-[Call]- QCacheMap.getOrPut() <-[Call]- qCacheItTimedThreadL ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val lock: ReentrantLock = ReentrantLock() - // CallChain[size=12] = QCacheMap.map <-[Call]- QCacheMap.getOrPut() <-[Call]- qCacheItTimedThreadLo ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=12] = QCacheMap.map <-[Call]- QCacheMap.getOrPut() <-[Call]- qCacheItTimedThreadLo ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val map: MutableMap = mutableMapOf() - // CallChain[size=12] = QCacheMap.clearExpired() <-[Call]- QCacheMap.getOrPut() <-[Call]- qCacheItTi ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=12] = QCacheMap.clearExpired() <-[Call]- QCacheMap.getOrPut() <-[Call]- qCacheItTi ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun clearExpired(): Int = lock.qWithLock(threadSafe) { val toRemove = map.filterValues { it.isExpired() } toRemove.forEach { map.remove(it.key) } return toRemove.count() } - // CallChain[size=11] = QCacheMap.getOrPut() <-[Call]- qCacheItTimedThreadLocal() <-[Call]- qCacheIt ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=11] = QCacheMap.getOrPut() <-[Call]- qCacheItTimedThreadLocal() <-[Call]- qCacheIt ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun getOrPut(key: Any, defaultValue: () -> QCacheEntry): QCacheEntry = lock.qWithLock(threadSafe) { val now = qNow if (now - lastCheck > expirationCheckInterval) { @@ -81,8 +81,8 @@ internal class QCacheMap( } } -// CallChain[size=11] = QCacheEntry <-[Call]- qCacheItTimedThreadLocal() <-[Call]- qCacheItOneSecThr ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=11] = QCacheEntry <-[Call]- qCacheItTimedThreadLocal() <-[Call]- qCacheItOneSecThr ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal data class QCacheEntry(val value: Any?, val duration: Long, val creationTime: Long = qNow) { - // CallChain[size=13] = QCacheEntry.isExpired() <-[Call]- QCacheMap.clearExpired() <-[Call]- QCacheM ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=13] = QCacheEntry.isExpired() <-[Call]- QCacheMap.clearExpired() <-[Call]- QCacheM ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun isExpired() = (qNow - creationTime) > duration } \ No newline at end of file diff --git a/src-test-split/nyab/util/QConcurrent.kt b/src-test-split/nyab/util/QConcurrent.kt index d494084..dd635cc 100644 --- a/src-test-split/nyab/util/QConcurrent.kt +++ b/src-test-split/nyab/util/QConcurrent.kt @@ -16,7 +16,7 @@ import kotlin.concurrent.withLock // qq-tree is a self-contained single-file library created by nyabkun. // This is a split-file version of the library, this file is not self-contained. -// CallChain[size=12] = Lock.qWithLock() <-[Call]- QCacheMap.getOrPut() <-[Call]- qCacheItTimedThrea ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=12] = Lock.qWithLock() <-[Call]- QCacheMap.getOrPut() <-[Call]- qCacheItTimedThrea ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal inline fun Lock.qWithLock(threadSafe: Boolean, block: () -> T): T { return if (threadSafe) { withLock(block) diff --git a/src-test-split/nyab/util/QException.kt b/src-test-split/nyab/util/QException.kt index 4f9fe1f..3a55dbc 100644 --- a/src-test-split/nyab/util/QException.kt +++ b/src-test-split/nyab/util/QException.kt @@ -14,18 +14,18 @@ package nyab.util import java.io.PrintStream import java.nio.file.Path -import java.util.* import kotlin.io.path.absolutePathString import kotlin.io.path.isDirectory import kotlin.io.path.isRegularFile import nyab.conf.QE import nyab.conf.QMyMark +import nyab.conf.qSTACK_FRAME_FILTER import nyab.match.QM // qq-tree is a self-contained single-file library created by nyabkun. // This is a split-file version of the library, this file is not self-contained. -// CallChain[size=12] = QE.throwIt() <-[Call]- qUnreachable() <-[Call]- QFetchRule.SINGLE_LINE <-[Ca ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=12] = QE.throwIt() <-[Call]- qUnreachable() <-[Call]- QFetchRule.SINGLE_LINE <-[Ca ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun QE.throwIt(msg: Any? = "", e: Throwable? = null, stackDepth: Int = 0): Nothing { throw QException( this, @@ -38,54 +38,54 @@ internal fun QE.throwIt(msg: Any? = "", e: Throwable? = null, stackDepth: Int = ) } -// CallChain[size=13] = QE.throwItFile() <-[Call]- LineNumberReader.qFetchLinesAround() <-[Call]- Pa ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=13] = QE.throwItFile() <-[Call]- LineNumberReader.qFetchLinesAround() <-[Call]- Pa ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun QE.throwItFile(path: Path, e: Throwable? = null, stackDepth: Int = 0): Nothing { throw QException(this, qBrackets("File", path.absolutePathString()), e, stackDepth = stackDepth + 1) } -// CallChain[size=4] = QE.throwItBrackets() <-[Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=4] = QE.throwItBrackets() <-[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun QE.throwItBrackets(vararg keysAndValues: Any?, e: Throwable? = null, stackDepth: Int = 0): Nothing { throw QException(this, qBrackets(*keysAndValues), e, stackDepth = stackDepth + 1) } -// CallChain[size=11] = qUnreachable() <-[Call]- QFetchRule.SINGLE_LINE <-[Call]- QSrcCut.QSrcCut() ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=11] = qUnreachable() <-[Call]- QFetchRule.SINGLE_LINE <-[Call]- QSrcCut.QSrcCut() ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun qUnreachable(msg: Any? = ""): Nothing { QE.Unreachable.throwIt(msg) } -// CallChain[size=5] = QException <-[Call]- QE.throwItBrackets() <-[Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=5] = QException <-[Call]- QE.throwItBrackets() <-[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal class QException( val type: QE = QE.Other, - msg: String = QMyMark.WARN, + msg: String = QMyMark.warn, e: Throwable? = null, val stackDepth: Int = 0, stackSize: Int = 20, - stackFilter: (StackWalker.StackFrame) -> Boolean = QE.STACK_FRAME_FILTER, + stackFilter: (StackWalker.StackFrame) -> Boolean = qSTACK_FRAME_FILTER, private val srcCut: QSrcCut = QSrcCut.MULTILINE_NOCUT, ) : RuntimeException(msg, e) { - // CallChain[size=6] = QException.printStackTrace() <-[Propag]- QException.QException() <-[Ref]- QE. ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=6] = QException.printStackTrace() <-[Propag]- QException.QException() <-[Ref]- QE. ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun printStackTrace(s: PrintStream) { s.println("\n" + qToString() + "\n" + mySrcAndStack) } - // CallChain[size=7] = QException.stackFrames <-[Call]- QException.getStackTrace() <-[Propag]- QExce ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=7] = QException.stackFrames <-[Call]- QException.getStackTrace() <-[Propag]- QExce ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val stackFrames = qStackFrames(stackDepth + 2, size = stackSize, filter = stackFilter) - // CallChain[size=7] = QException.mySrcAndStack <-[Call]- QException.printStackTrace() <-[Propag]- Q ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=7] = QException.mySrcAndStack <-[Call]- QException.printStackTrace() <-[Propag]- Q ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val mySrcAndStack: String by lazy { qLogStackFrames(frames = stackFrames, style = QLogStyle.SRC_AND_STACK, srcCut = srcCut, quiet = true) - .qColorTarget(qRe("""\sshould[a-zA-Z]+"""), QShColor.LIGHT_YELLOW) + .qColorTarget(qRe("""\sshould[a-zA-Z]+"""), QShColor.LightYellow) } - // CallChain[size=6] = QException.getStackTrace() <-[Propag]- QException.QException() <-[Ref]- QE.th ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=6] = QException.getStackTrace() <-[Propag]- QException.QException() <-[Ref]- QE.th ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun getStackTrace(): Array { return stackFrames.map { it.toStackTraceElement() }.toTypedArray() } - // CallChain[size=7] = QException.qToString() <-[Call]- QException.toString() <-[Propag]- QException ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=7] = QException.qToString() <-[Call]- QException.toString() <-[Propag]- QException ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun qToString(): String { val msg = message @@ -98,7 +98,7 @@ internal class QException( } } - // CallChain[size=6] = QException.toString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=6] = QException.toString() <-[Propag]- QException.QException() <-[Ref]- QE.throwIt ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun toString(): String { return qToString() // used by @Test @@ -113,7 +113,7 @@ internal fun Boolean.qaTrue(exceptionType: QE = QE.ShouldBeTrue, msg: Any? = "") } } -// CallChain[size=12] = T?.qaNotNull() <-[Call]- qSrcFileAtFrame() <-[Call]- qSrcFileLinesAtFrame() ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=12] = T.qaNotNull() <-[Call]- qSrcFileAtFrame() <-[Call]- qSrcFileLinesAtFrame() < ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun T?.qaNotNull(exceptionType: QE = QE.ShouldNotBeNull, msg: Any? = ""): T { if (this != null) { return this @@ -122,7 +122,7 @@ internal fun T?.qaNotNull(exceptionType: QE = QE.ShouldNotBeNull, msg: } } -// CallChain[size=5] = Int?.qaNotZero() <-[Call]- CharSequence.qMask() <-[Call]- Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=5] = Int.qaNotZero() <-[Call]- CharSequence.qMask() <-[Call]- Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun Int?.qaNotZero(exceptionType: QE = QE.ShouldNotBeZero, msg: Any? = ""): Int { if (this == null) { QE.ShouldNotBeNull.throwIt(stackDepth = 1, msg = msg) diff --git a/src-test-split/nyab/util/QExtraProp.kt b/src-test-split/nyab/util/QExtraProp.kt index 0085313..8173cdd 100644 --- a/src-test-split/nyab/util/QExtraProp.kt +++ b/src-test-split/nyab/util/QExtraProp.kt @@ -18,12 +18,12 @@ import java.nio.file.Path // qq-tree is a self-contained single-file library created by nyabkun. // This is a split-file version of the library, this file is not self-contained. -// CallChain[size=7] = QExProps <-[Call]- Any.qGetExProp() <-[Call]- children <-[Call]- N.depthFirst ... N.descendants() <-[Call]- N.descendantsList() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=7] = QExProps <-[Call]- Any.qGetExProp() <-[Call]- N.children <-[Call]- N.depthFir ... N.descendants() <-[Call]- N.descendantsList() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] /** * Minimal Version of IdentityWeakHashMap. */ private object QExProps { - // CallChain[size=8] = QExProps.map <-[Call]- QExProps.get() <-[Call]- Any.qGetExProp() <-[Call]- ch ... N.descendants() <-[Call]- N.descendantsList() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=8] = QExProps.map <-[Call]- QExProps.get() <-[Call]- Any.qGetExProp() <-[Call]- N. ... N.descendants() <-[Call]- N.descendantsList() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val map: MutableMap> = HashMap() // CallChain[size=8] = QExProps.removeGarbageCollectedEntries() <-[Call]- QExProps.get() <-[Call]- A ... N.descendants() <-[Call]- N.descendantsList() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] @@ -31,14 +31,14 @@ private object QExProps { map.keys.removeIf { it.get() == null } } - // CallChain[size=7] = QExProps.get() <-[Call]- Any.qGetExProp() <-[Call]- children <-[Call]- N.dept ... N.descendants() <-[Call]- N.descendantsList() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=7] = QExProps.get() <-[Call]- Any.qGetExProp() <-[Call]- N.children <-[Call]- N.de ... N.descendants() <-[Call]- N.descendantsList() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun get(key: Any): HashMap? { removeGarbageCollectedEntries() return map[WeakKey(key)] } - // CallChain[size=7] = QExProps.put() <-[Call]- Any.qSetExProp() <-[Call]- children <-[Call]- N.dept ... N.descendants() <-[Call]- N.descendantsList() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=7] = QExProps.put() <-[Call]- Any.qSetExProp() <-[Call]- N.children <-[Call]- N.de ... N.descendants() <-[Call]- N.descendantsList() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun put(key: Any, value: HashMap) { removeGarbageCollectedEntries() @@ -61,7 +61,7 @@ private object QExProps { } } -// CallChain[size=6] = Any.qSetExProp() <-[Call]- children <-[Call]- N.depthFirstRecursive() <-[Call]- N.descendants() <-[Call]- N.descendantsList() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=6] = Any.qSetExProp() <-[Call]- N.children <-[Call]- N.depthFirstRecursive() <-[Ca ... N.descendants() <-[Call]- N.descendantsList() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun Any.qSetExProp(key: String, value: Any?) = synchronized(QExProps) { var props = QExProps.get(this) if (props == null) { @@ -71,21 +71,21 @@ internal fun Any.qSetExProp(key: String, value: Any?) = synchronized(QExProps) { props[key] = value } -// CallChain[size=6] = Any.qGetExProp() <-[Call]- children <-[Call]- N.depthFirstRecursive() <-[Call]- N.descendants() <-[Call]- N.descendantsList() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=6] = Any.qGetExProp() <-[Call]- N.children <-[Call]- N.depthFirstRecursive() <-[Ca ... N.descendants() <-[Call]- N.descendantsList() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun Any.qGetExProp(key: String): Any? = synchronized(QExProps) { val props = QExProps.get(this) ?: return null return props[key] } -// CallChain[size=7] = Any.qGetExPropOrDefault() <-[Call]- Any.qGetExPropOrNull() <-[Call]- children ... N.descendants() <-[Call]- N.descendantsList() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=7] = Any.qGetExPropOrDefault() <-[Call]- Any.qGetExPropOrNull() <-[Call]- N.childr ... N.descendants() <-[Call]- N.descendantsList() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun Any.qGetExPropOrDefault(key: String, default: T): T = synchronized(QExProps) { val props = QExProps.get(this) ?: return default return props.getOrDefault(key, default) as T } -// CallChain[size=6] = Any.qGetExPropOrNull() <-[Call]- children <-[Call]- N.depthFirstRecursive() < ... N.descendants() <-[Call]- N.descendantsList() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=6] = Any.qGetExPropOrNull() <-[Call]- N.children <-[Call]- N.depthFirstRecursive() ... N.descendants() <-[Call]- N.descendantsList() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun Any.qGetExPropOrNull(key: String): Any? = synchronized(QExProps) { return qGetExPropOrDefault(key, null) } \ No newline at end of file diff --git a/src-test-split/nyab/util/QFile.kt b/src-test-split/nyab/util/QFile.kt index ee491f7..9ef3ea9 100644 --- a/src-test-split/nyab/util/QFile.kt +++ b/src-test-split/nyab/util/QFile.kt @@ -42,41 +42,41 @@ import nyab.match.qMatches // qq-tree is a self-contained single-file library created by nyabkun. // This is a split-file version of the library, this file is not self-contained. -// CallChain[size=13] = qBUFFER_SIZE <-[Call]- Path.qReader() <-[Call]- Path.qFetchLinesAround() <-[ ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=13] = qBUFFER_SIZE <-[Call]- Path.qReader() <-[Call]- Path.qFetchLinesAround() <-[ ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal const val qBUFFER_SIZE = DEFAULT_BUFFER_SIZE -// CallChain[size=13] = QOpenOpt <-[Ref]- Path.qReader() <-[Call]- Path.qFetchLinesAround() <-[Call] ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=13] = QOpenOpt <-[Ref]- Path.qReader() <-[Call]- Path.qFetchLinesAround() <-[Call] ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] // @formatter:off internal enum class QOpenOpt(val opt: OpenOption) : QFlagEnum { - // CallChain[size=15] = QOpenOpt.TRUNCATE_EXISTING <-[Propag]- QOpenOpt.QOpenOpt() <-[Call]- QFlag.to ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=15] = QOpenOpt.CREATE <-[Propag]- QOpenOpt.QOpenOpt() <-[Call]- QFlag.to ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] CREATE(StandardOpenOption.CREATE), - // CallChain[size=15] = QOpenOpt.CREATE_NEW <-[Propag]- QOpenOpt.QOpenOpt() <-[Call]- QFlag.toO ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=15] = QOpenOpt.WRITE <-[Propag]- QOpenOpt.QOpenOpt() <-[Call]- QFlag.toO ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] WRITE(StandardOpenOption.WRITE), - // CallChain[size=15] = QOpenOpt.READ <-[Propag]- QOpenOpt.QOpenOpt() <-[Call]- QFlag.toOp ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=15] = QOpenOpt.READ <-[Propag]- QOpenOpt.QOpenOpt() <-[Call]- QFlag.toOp ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] READ(StandardOpenOption.READ), - // CallChain[size=15] = QOpenOpt.APPEND <-[Propag]- QOpenOpt.QOpenOpt() <-[Call]- QFlag.to ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=15] = QOpenOpt.APPEND <-[Propag]- QOpenOpt.QOpenOpt() <-[Call]- QFlag.to ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] APPEND(StandardOpenOption.APPEND), - // CallChain[size=15] = QOpenOpt.DELETE_ON_CLOSE <-[Propag]- QOpenOpt.QOpenOpt() <-[Call]- QFlag.toO ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=15] = QOpenOpt.DSYNC <-[Propag]- QOpenOpt.QOpenOpt() <-[Call]- QFlag.toO ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] DSYNC(StandardOpenOption.DSYNC), - // CallChain[size=15] = QOpenOpt.SYNC <-[Propag]- QOpenOpt.QOpenOpt() <-[Call]- QFlag.toOp ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=15] = QOpenOpt.SYNC <-[Propag]- QOpenOpt.QOpenOpt() <-[Call]- QFlag.toOp ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] SYNC(StandardOpenOption.SYNC), - // CallChain[size=15] = QOpenOpt.SPARSE <-[Propag]- QOpenOpt.QOpenOpt() <-[Call]- QFlag.to ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=15] = QOpenOpt.SPARSE <-[Propag]- QOpenOpt.QOpenOpt() <-[Call]- QFlag.to ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] SPARSE(StandardOpenOption.SPARSE), - // CallChain[size=15] = QOpenOpt.EX_DIRECT <-[Propag]- QOpenOpt.QOpenOpt() <-[Call]- QFlag ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=15] = QOpenOpt.EX_DIRECT <-[Propag]- QOpenOpt.QOpenOpt() <-[Call]- QFlag ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] EX_DIRECT(ExtendedOpenOption.DIRECT), - // CallChain[size=15] = QOpenOpt.EX_NOSHARE_DELETE <-[Propag]- QOpenOpt.QOpenOpt() <-[Call]- QFlag { } } -// CallChain[size=13] = QFlag.toOptEnums() <-[Call]- Path.qReader() <-[Call]- Path.qFetchL ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=13] = QFlag.toOptEnums() <-[Call]- Path.qReader() <-[Call]- Path.qFetchL ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun QFlag.toOptEnums(): Array { return toEnumValues().map { it.opt }.toTypedArray() } -// CallChain[size=12] = Path.qLineSeparator() <-[Call]- Path.qFetchLinesAround() <-[Call]- qSrcFileL ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=12] = Path.qLineSeparator() <-[Call]- Path.qFetchLinesAround() <-[Call]- qSrcFileL ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun Path.qLineSeparator(charset: Charset = Charsets.UTF_8): QLineSeparator { this.bufferedReader(charset).use { reader -> var ch: Char @@ -113,44 +113,44 @@ internal fun Path.qLineSeparator(charset: Charset = Charsets.UTF_8): QLineSepara } } -// CallChain[size=11] = QFetchEnd <-[Ref]- QFetchRule.SINGLE_LINE <-[Call]- QSrcCut.QSrcCut() <-[Cal ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=11] = QFetchEnd <-[Ref]- QFetchRule.SINGLE_LINE <-[Call]- QSrcCut.QSrcCut() <-[Cal ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal enum class QFetchEnd { - // CallChain[size=12] = QFetchEnd.FETCH_THIS_LINE_AND_GO_TO_NEXT_LINE <-[Propag]- QFetchEnd.END_WITH ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=12] = QFetchEnd.FETCH_THIS_LINE_AND_GO_TO_NEXT_LINE <-[Propag]- QFetchEnd.END_WITH ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] FETCH_THIS_LINE_AND_GO_TO_NEXT_LINE, - // CallChain[size=11] = QFetchEnd.END_WITH_THIS_LINE <-[Call]- QFetchRule.SINGLE_LINE <-[Call]- QSrc ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=11] = QFetchEnd.END_WITH_THIS_LINE <-[Call]- QFetchRule.SINGLE_LINE <-[Call]- QSrc ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] END_WITH_THIS_LINE, - // CallChain[size=12] = QFetchEnd.END_WITH_NEXT_LINE <-[Propag]- QFetchEnd.END_WITH_THIS_LINE <-[Cal ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=12] = QFetchEnd.END_WITH_NEXT_LINE <-[Propag]- QFetchEnd.END_WITH_THIS_LINE <-[Cal ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] END_WITH_NEXT_LINE, - // CallChain[size=12] = QFetchEnd.END_WITH_PREVIOUS_LINE <-[Propag]- QFetchEnd.END_WITH_THIS_LINE <- ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=12] = QFetchEnd.END_WITH_PREVIOUS_LINE <-[Propag]- QFetchEnd.END_WITH_THIS_LINE <- ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] END_WITH_PREVIOUS_LINE } -// CallChain[size=11] = QFetchStart <-[Ref]- QFetchRule.SINGLE_LINE <-[Call]- QSrcCut.QSrcCut() <-[C ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=11] = QFetchStart <-[Ref]- QFetchRule.SINGLE_LINE <-[Call]- QSrcCut.QSrcCut() <-[C ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal enum class QFetchStart { - // CallChain[size=11] = QFetchStart.FETCH_THIS_LINE_AND_GO_TO_PREVIOUS_LINE <-[Call]- QFetchRule.SIN ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=11] = QFetchStart.FETCH_THIS_LINE_AND_GO_TO_PREVIOUS_LINE <-[Call]- QFetchRule.SIN ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] FETCH_THIS_LINE_AND_GO_TO_PREVIOUS_LINE, - // CallChain[size=11] = QFetchStart.START_FROM_THIS_LINE <-[Call]- QFetchRule.SINGLE_LINE <-[Call]- ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=11] = QFetchStart.START_FROM_THIS_LINE <-[Call]- QFetchRule.SINGLE_LINE <-[Call]- ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] START_FROM_THIS_LINE, - // CallChain[size=12] = QFetchStart.START_FROM_NEXT_LINE <-[Propag]- QFetchStart.FETCH_THIS_LINE_AND ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=12] = QFetchStart.START_FROM_NEXT_LINE <-[Propag]- QFetchStart.FETCH_THIS_LINE_AND ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] START_FROM_NEXT_LINE, - // CallChain[size=12] = QFetchStart.START_FROM_PREVIOUS_LINE <-[Propag]- QFetchStart.FETCH_THIS_LINE ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=12] = QFetchStart.START_FROM_PREVIOUS_LINE <-[Propag]- QFetchStart.FETCH_THIS_LINE ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] START_FROM_PREVIOUS_LINE } -// CallChain[size=11] = QFetchRuleA <-[Call]- QFetchRule.SINGLE_LINE <-[Call]- QSrcCut.QSrcCut() <-[ ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=11] = QFetchRuleA <-[Call]- QFetchRule.SINGLE_LINE <-[Call]- QSrcCut.QSrcCut() <-[ ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal abstract class QFetchRuleA( override val numLinesBeforeTargetLine: Int = 10, override val numLinesAfterTargetLine: Int = 10, ) : QFetchRule -// CallChain[size=10] = QFetchRule <-[Ref]- QSrcCut.QSrcCut() <-[Call]- qLogStackFrames() <-[Call]- ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=10] = QFetchRule <-[Ref]- QSrcCut.QSrcCut() <-[Call]- qLogStackFrames() <-[Call]- ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal interface QFetchRule { - // CallChain[size=11] = QFetchRule.numLinesBeforeTargetLine <-[Propag]- QFetchRule.SINGLE_LINE <-[Ca ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=11] = QFetchRule.numLinesBeforeTargetLine <-[Propag]- QFetchRule.SINGLE_LINE <-[Ca ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val numLinesBeforeTargetLine: Int - // CallChain[size=11] = QFetchRule.numLinesAfterTargetLine <-[Propag]- QFetchRule.SINGLE_LINE <-[Cal ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=11] = QFetchRule.numLinesAfterTargetLine <-[Propag]- QFetchRule.SINGLE_LINE <-[Cal ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val numLinesAfterTargetLine: Int - // CallChain[size=11] = QFetchRule.fetchStartCheck() <-[Propag]- QFetchRule.SINGLE_LINE <-[Call]- QS ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=11] = QFetchRule.fetchStartCheck() <-[Propag]- QFetchRule.SINGLE_LINE <-[Call]- QS ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun fetchStartCheck( line: String, currentLineNumber: Int, @@ -159,7 +159,7 @@ internal interface QFetchRule { context: MutableSet, ): QFetchStart - // CallChain[size=11] = QFetchRule.fetchEndCheck() <-[Propag]- QFetchRule.SINGLE_LINE <-[Call]- QSrc ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=11] = QFetchRule.fetchEndCheck() <-[Propag]- QFetchRule.SINGLE_LINE <-[Call]- QSrc ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun fetchEndCheck( line: String, currentLineNumber: Int, @@ -169,7 +169,7 @@ internal interface QFetchRule { ): QFetchEnd companion object { - // CallChain[size=10] = QFetchRule.SINGLE_LINE <-[Call]- QSrcCut.QSrcCut() <-[Call]- qLogStackFrames ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=10] = QFetchRule.SINGLE_LINE <-[Call]- QSrcCut.QSrcCut() <-[Call]- qLogStackFrames ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val SINGLE_LINE = object : QFetchRuleA(0, 0) { override fun fetchStartCheck( line: String, @@ -196,7 +196,7 @@ internal interface QFetchRule { } } - // CallChain[size=5] = QFetchRule.SMART_FETCH_INFIX <-[Call]- QSrcCut.MULTILINE_INFIX_NOCUT <-[Call]- qThrowIt() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=5] = QFetchRule.SMART_FETCH_INFIX <-[Call]- QSrcCut.MULTILINE_INFIX_NOCUT <-[Call]- qThrowIt() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val SMART_FETCH_INFIX = object : QFetchRuleA(10, 10) { // """ <<< targetLine // some text @@ -245,7 +245,7 @@ internal interface QFetchRule { } } - // CallChain[size=9] = QFetchRule.SMART_FETCH <-[Call]- qLogStackFrames() <-[Call]- QException.mySrc ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=9] = QFetchRule.SMART_FETCH <-[Call]- qLogStackFrames() <-[Call]- QException.mySrc ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val SMART_FETCH = object : QFetchRuleA(10, 10) { override fun fetchStartCheck( line: String, @@ -317,7 +317,7 @@ internal interface QFetchRule { } } -// CallChain[size=14] = LineNumberReader.qFetchLinesBetween() <-[Call]- LineNumberReader.qFetchTarge ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=14] = LineNumberReader.qFetchLinesBetween() <-[Call]- LineNumberReader.qFetchTarge ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun LineNumberReader.qFetchLinesBetween( lineNumberStartInclusive: Int, lineNumberEndInclusive: Int, @@ -344,7 +344,7 @@ private fun LineNumberReader.qFetchLinesBetween( return lines } -// CallChain[size=14] = TargetSurroundingLines <-[Ref]- LineNumberReader.qFetchTargetSurroundingLine ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=14] = TargetSurroundingLines <-[Ref]- LineNumberReader.qFetchTargetSurroundingLine ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal class TargetSurroundingLines( val targetLineNumber: Int, val startLineNumber: Int, @@ -353,7 +353,7 @@ internal class TargetSurroundingLines( val linesBeforeTargetLine: List, val linesAfterTargetLine: List, ) { - // CallChain[size=13] = TargetSurroundingLines.linesBetween() <-[Call]- LineNumberReader.qFetchLines ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=13] = TargetSurroundingLines.linesBetween() <-[Call]- LineNumberReader.qFetchLines ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun linesBetween(lineNumberStartInclusive: Int, lineNumberEndInclusive: Int): List { val lines = mutableListOf() @@ -368,7 +368,7 @@ internal class TargetSurroundingLines( } } -// CallChain[size=13] = LineNumberReader.qFetchTargetSurroundingLines() <-[Call]- LineNumberReader.q ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=13] = LineNumberReader.qFetchTargetSurroundingLines() <-[Call]- LineNumberReader.q ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun LineNumberReader.qFetchTargetSurroundingLines( targetLineNumber: Int, numLinesBeforeTargetLine: Int = 10, @@ -389,7 +389,7 @@ private fun LineNumberReader.qFetchTargetSurroundingLines( ) } -// CallChain[size=12] = LineNumberReader.qFetchLinesAround() <-[Call]- Path.qFetchLinesAround() <-[C ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=12] = LineNumberReader.qFetchLinesAround() <-[Call]- Path.qFetchLinesAround() <-[C ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun LineNumberReader.qFetchLinesAround( file: Path, targetLineNumber: Int, @@ -494,7 +494,7 @@ private fun LineNumberReader.qFetchLinesAround( } } -// CallChain[size=12] = Path.qReader() <-[Call]- Path.qFetchLinesAround() <-[Call]- qSrcFileLinesAtF ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=12] = Path.qReader() <-[Call]- Path.qFetchLinesAround() <-[Call]- qSrcFileLinesAtF ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun Path.qReader( charset: Charset = Charsets.UTF_8, buffSize: Int = qBUFFER_SIZE, @@ -503,7 +503,7 @@ internal fun Path.qReader( return LineNumberReader(reader(charset, *opts.toOptEnums()), buffSize) } -// CallChain[size=11] = Path.qFetchLinesAround() <-[Call]- qSrcFileLinesAtFrame() <-[Call]- qMySrcLi ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=11] = Path.qFetchLinesAround() <-[Call]- qSrcFileLinesAtFrame() <-[Call]- qMySrcLi ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun Path.qFetchLinesAround( lineNumber: Int, fetchRule: QFetchRule = QFetchRule.SMART_FETCH, @@ -528,7 +528,7 @@ internal fun Path.qFetchLinesAround( } } -// CallChain[size=12] = Path.qLineAt() <-[Call]- Path.qFetchLinesAround() <-[Call]- qSrcFileLinesAtF ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=12] = Path.qLineAt() <-[Call]- Path.qFetchLinesAround() <-[Call]- qSrcFileLinesAtF ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun Path.qLineAt( lineNumber: Int, charset: Charset = Charsets.UTF_8, @@ -551,20 +551,20 @@ internal fun Path.qLineAt( } } -// CallChain[size=13] = QFType <-[Ref]- Collection.qFind() <-[Call]- qSrcFileAtFrame() <-[Call ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=13] = QFType <-[Ref]- Collection.qFind() <-[Call]- qSrcFileAtFrame() <-[Call ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal enum class QFType { - // CallChain[size=17] = QFType.Any <-[Call]- QFType.matches() <-[Call]- Path.qSeq() <-[Call]- Path.q ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=17] = QFType.Any <-[Call]- QFType.matches() <-[Call]- Path.qSeq() <-[Call]- Path.q ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] Any, - // CallChain[size=13] = QFType.File <-[Call]- Collection.qFind() <-[Call]- qSrcFileAtFrame() < ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=13] = QFType.File <-[Call]- Collection.qFind() <-[Call]- qSrcFileAtFrame() < ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] File, - // CallChain[size=17] = QFType.Dir <-[Call]- QFType.matches() <-[Call]- Path.qSeq() <-[Call]- Path.q ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=17] = QFType.Dir <-[Call]- QFType.matches() <-[Call]- Path.qSeq() <-[Call]- Path.q ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] Dir, - // CallChain[size=17] = QFType.SymLink <-[Call]- QFType.matches() <-[Call]- Path.qSeq() <-[Call]- Pa ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=17] = QFType.SymLink <-[Call]- QFType.matches() <-[Call]- Path.qSeq() <-[Call]- Pa ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] SymLink, - // CallChain[size=17] = QFType.FileOrDir <-[Call]- QFType.matches() <-[Call]- Path.qSeq() <-[Call]- ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=17] = QFType.FileOrDir <-[Call]- QFType.matches() <-[Call]- Path.qSeq() <-[Call]- ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] FileOrDir; - // CallChain[size=16] = QFType.matches() <-[Call]- Path.qSeq() <-[Call]- Path.qList() <-[Call]- Path ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=16] = QFType.matches() <-[Call]- Path.qSeq() <-[Call]- Path.qList() <-[Call]- Path ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun matches(path: Path?, followSymLink: Boolean = true): Boolean { if (path == null) return false @@ -583,7 +583,7 @@ internal enum class QFType { } } -// CallChain[size=12] = Collection.qFind() <-[Call]- qSrcFileAtFrame() <-[Call]- qSrcFileLines ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=12] = Collection.qFind() <-[Call]- qSrcFileAtFrame() <-[Call]- qSrcFileLines ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun Collection.qFind(nameMatcher: QM, type: QFType = QFType.File, maxDepth: Int = 1): Path? { for (path in this) { val found = path.qFind(nameMatcher, type, maxDepth) @@ -593,7 +593,7 @@ internal fun Collection.qFind(nameMatcher: QM, type: QFType = QFType.File, return null } -// CallChain[size=13] = Path.qFind() <-[Call]- Collection.qFind() <-[Call]- qSrcFileAtFrame() ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=13] = Path.qFind() <-[Call]- Collection.qFind() <-[Call]- qSrcFileAtFrame() ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun Path.qFind(nameMatcher: QM, type: QFType = QFType.File, maxDepth: Int = 1): Path? { return try { qList(type, maxDepth = maxDepth) { @@ -604,7 +604,7 @@ internal fun Path.qFind(nameMatcher: QM, type: QFType = QFType.File, maxDepth: I } } -// CallChain[size=10] = Path.qListByMatch() <-[Call]- QMyPath.src_root <-[Call]- qLogStackFrames() < ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=10] = Path.qListByMatch() <-[Call]- QMyPath.src_root <-[Call]- qLogStackFrames() < ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun Path.qListByMatch( nameMatch: QM, type: QFType = QFType.File, @@ -618,7 +618,7 @@ internal fun Path.qListByMatch( } } -// CallChain[size=14] = Path.qList() <-[Call]- Path.qFind() <-[Call]- Collection.qFind() <-[Ca ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=14] = Path.qList() <-[Call]- Path.qFind() <-[Call]- Collection.qFind() <-[Ca ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun Path.qList( type: QFType = QFType.File, maxDepth: Int = 1, @@ -637,7 +637,7 @@ internal fun Path.qList( ).toList() } -// CallChain[size=15] = Path.qSeq() <-[Call]- Path.qList() <-[Call]- Path.qFind() <-[Call]- Collecti ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=15] = Path.qSeq() <-[Call]- Path.qList() <-[Call]- Path.qFind() <-[Call]- Collecti ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun Path.qSeq( type: QFType = QFType.File, maxDepth: Int = 1, diff --git a/src-test-split/nyab/util/QFlag.kt b/src-test-split/nyab/util/QFlag.kt index e9c8505..6210870 100644 --- a/src-test-split/nyab/util/QFlag.kt +++ b/src-test-split/nyab/util/QFlag.kt @@ -17,23 +17,23 @@ import kotlin.reflect.KClass // qq-tree is a self-contained single-file library created by nyabkun. // This is a split-file version of the library, this file is not self-contained. -// CallChain[size=13] = QFlag <-[Ref]- Path.qReader() <-[Call]- Path.qFetchLinesAround() <-[Call]- q ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=13] = QFlag <-[Ref]- Path.qReader() <-[Call]- Path.qFetchLinesAround() <-[Call]- q ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] /** * Only Enum or QFlag can implement this interface. */ internal sealed interface QFlag where T : QFlag, T : Enum { - // CallChain[size=15] = QFlag.bits <-[Propag]- QFlag.toEnumValues() <-[Call]- QFlag.toOptE ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=15] = QFlag.bits <-[Propag]- QFlag.toEnumValues() <-[Call]- QFlag.toOptE ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val bits: Int - // CallChain[size=15] = QFlag.contains() <-[Propag]- QFlag.toEnumValues() <-[Call]- QFlag. ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=15] = QFlag.contains() <-[Propag]- QFlag.toEnumValues() <-[Call]- QFlag. ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun contains(flags: QFlag): Boolean { return (bits and flags.bits) == flags.bits } - // CallChain[size=14] = QFlag.toEnumValues() <-[Call]- QFlag.toOptEnums() <-[Call]- Path.q ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=14] = QFlag.toEnumValues() <-[Call]- QFlag.toOptEnums() <-[Call]- Path.q ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun toEnumValues(): List - // CallChain[size=15] = QFlag.str() <-[Propag]- QFlag.toEnumValues() <-[Call]- QFlag.toOpt ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=15] = QFlag.str() <-[Propag]- QFlag.toEnumValues() <-[Call]- QFlag.toOpt ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun str(): String { return toEnumValues().joinToString(", ") { it.name } } @@ -42,7 +42,7 @@ internal sealed interface QFlag where T : QFlag, T : Enum { // https://discuss.kotlinlang.org/t/reified-generics-on-class-level/16711/2 // But, can't make constructor private ... - // CallChain[size=13] = QFlag.none() <-[Call]- Path.qReader() <-[Call]- Path.qFetchLinesAround() <-[ ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=13] = QFlag.none() <-[Call]- Path.qReader() <-[Call]- Path.qFetchLinesAround() <-[ ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] inline fun none(): QFlag where T : QFlag, T : Enum { return QFlagSet(T::class, 0) @@ -50,24 +50,24 @@ internal sealed interface QFlag where T : QFlag, T : Enum { } } -// CallChain[size=14] = QFlagEnum <-[Ref]- QOpenOpt <-[Ref]- Path.qReader() <-[Call]- Path.qFetchLin ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=14] = QFlagEnum <-[Ref]- QOpenOpt <-[Ref]- Path.qReader() <-[Call]- Path.qFetchLin ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal interface QFlagEnum : QFlag where T : QFlag, T : Enum { - // CallChain[size=15] = QFlagEnum.bits <-[Propag]- QFlagEnum <-[Ref]- QOpenOpt <-[Ref]- Path.qReader ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=15] = QFlagEnum.bits <-[Propag]- QFlagEnum <-[Ref]- QOpenOpt <-[Ref]- Path.qReader ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override val bits: Int get() = 1 shl (this as T).ordinal - // CallChain[size=15] = QFlagEnum.toEnumValues() <-[Propag]- QFlagEnum <-[Ref]- QOpenOpt <-[Ref]- Pa ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=15] = QFlagEnum.toEnumValues() <-[Propag]- QFlagEnum <-[Ref]- QOpenOpt <-[Ref]- Pa ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun toEnumValues(): List = listOf(this) as List } -// CallChain[size=14] = QFlagSet <-[Call]- QFlag.none() <-[Call]- Path.qReader() <-[Call]- Path.qFet ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=14] = QFlagSet <-[Call]- QFlag.none() <-[Call]- Path.qReader() <-[Call]- Path.qFet ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] /** * Mutable bit flag */ internal class QFlagSet(val enumClass: KClass, override var bits: Int) : QFlag where T : QFlag, T : Enum { - // CallChain[size=16] = QFlagSet.enumValues <-[Call]- QFlagSet.toEnumValues() <-[Propag]- QFlagSet < ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=16] = QFlagSet.enumValues <-[Call]- QFlagSet.toEnumValues() <-[Propag]- QFlagSet < ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val enumValues: Array by lazy { enumClass.qEnumValues() } - // CallChain[size=15] = QFlagSet.toEnumValues() <-[Propag]- QFlagSet <-[Call]- QFlag.none() <-[Call] ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=15] = QFlagSet.toEnumValues() <-[Propag]- QFlagSet <-[Call]- QFlag.none() <-[Call] ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun toEnumValues(): List = enumValues.filter { contains(it) } } \ No newline at end of file diff --git a/src-test-split/nyab/util/QFormat.kt b/src-test-split/nyab/util/QFormat.kt index 7558fcc..88fd753 100644 --- a/src-test-split/nyab/util/QFormat.kt +++ b/src-test-split/nyab/util/QFormat.kt @@ -42,7 +42,7 @@ internal fun Long.qFormatDuration(unit: QUnit = QUnit.Nano): String { QUnit.Milli -> Duration.ofMillis(this).qFormat() QUnit.Micro -> - Duration.ofNanos(this).qFormat() + Duration.ofNanos(this * 1000).qFormat() QUnit.Nano -> Duration.ofNanos(this).qFormat() QUnit.Second -> @@ -68,6 +68,10 @@ internal fun Duration.qToNanoOnlyPart(): Int { // CallChain[size=7] = Duration.qFormat() <-[Call]- Long.qFormatDuration() <-[Call]- QTestResult.str <-[Call]- QTestResult.printIt() <-[Call]- qTestMethods() <-[Call]- qTest() <-[Call]- main()[Root] internal fun Duration.qFormat(detail: Boolean = false): String { + if(this.isZero) { + return "0" + } + val du = abs() val maxUnit: QUnit = du.let { diff --git a/src-test-split/nyab/util/QLog.kt b/src-test-split/nyab/util/QLog.kt index f6ffb18..f88abe2 100644 --- a/src-test-split/nyab/util/QLog.kt +++ b/src-test-split/nyab/util/QLog.kt @@ -21,16 +21,16 @@ import nyab.conf.QMyPath // qq-tree is a self-contained single-file library created by nyabkun. // This is a split-file version of the library, this file is not self-contained. -// CallChain[size=12] = qARROW <-[Call]- qArrow() <-[Call]- QLogStyle.qLogArrow() <-[Call]- QLogStyl ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=12] = qARROW <-[Call]- qArrow() <-[Call]- QLogStyle.qLogArrow() <-[Call]- QLogStyl ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal val qARROW = "===>".light_cyan -// CallChain[size=4] = qIsDebugging <-[Call]- qOkToTest() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=4] = qIsDebugging <-[Call]- qOkToTest() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] // https://stackoverflow.com/a/28754689/5570400 internal val qIsDebugging by lazy { java.lang.management.ManagementFactory.getRuntimeMXBean().inputArguments.toString().indexOf("jdwp") >= 0 } -// CallChain[size=4] = qIsTesting <-[Call]- qOkToTest() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=4] = qIsTesting <-[Call]- qOkToTest() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] // https://stackoverflow.com/a/12717377/5570400 internal val qIsTesting by lazy { qStackFrames(size = Int.MAX_VALUE).any { @@ -39,30 +39,30 @@ internal val qIsTesting by lazy { } } -// CallChain[size=6] = QSrcCut <-[Ref]- QException.QException() <-[Ref]- QE.throwItBrackets() <-[Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=6] = QSrcCut <-[Ref]- QException.QException() <-[Ref]- QE.throwItBrackets() <-[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal class QSrcCut( val fetchRule: QFetchRule = QFetchRule.SINGLE_LINE, val cut: (srcLines: String) -> String, ) { companion object { - // CallChain[size=10] = QSrcCut.CUT_PARAM_qLog <-[Call]- QSrcCut.SINGLE_qLog_PARAM <-[Call]- qLogSta ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=10] = QSrcCut.CUT_PARAM_qLog <-[Call]- QSrcCut.SINGLE_qLog_PARAM <-[Call]- qLogSta ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private val CUT_PARAM_qLog = { mySrc: String -> mySrc.replaceFirst("""(?s)^\s*(\S.+)\.qLog[a-zA-Z]{0,10}.*$""".re, "$1") } - // CallChain[size=9] = QSrcCut.SINGLE_qLog_PARAM <-[Call]- qLogStackFrames() <-[Call]- QException.my ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=9] = QSrcCut.SINGLE_qLog_PARAM <-[Call]- qLogStackFrames() <-[Call]- QException.my ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val SINGLE_qLog_PARAM = QSrcCut(QFetchRule.SINGLE_LINE, CUT_PARAM_qLog) - // CallChain[size=6] = QSrcCut.MULTILINE_NOCUT <-[Call]- QException.QException() <-[Ref]- QE.throwIt ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=6] = QSrcCut.MULTILINE_NOCUT <-[Call]- QException.QException() <-[Ref]- QE.throwIt ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val MULTILINE_NOCUT = QSrcCut(QFetchRule.SMART_FETCH) { it } - // CallChain[size=4] = QSrcCut.MULTILINE_INFIX_NOCUT <-[Call]- qThrowIt() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=4] = QSrcCut.MULTILINE_INFIX_NOCUT <-[Call]- qThrowIt() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val MULTILINE_INFIX_NOCUT = QSrcCut(QFetchRule.SMART_FETCH_INFIX) { it } - // CallChain[size=10] = QSrcCut.NOCUT_JUST_SINGLE_LINE <-[Call]- qMySrcLinesAtFrame() <-[Call]- qLog ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=10] = QSrcCut.NOCUT_JUST_SINGLE_LINE <-[Call]- qMySrcLinesAtFrame() <-[Call]- qLog ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val NOCUT_JUST_SINGLE_LINE = QSrcCut(QFetchRule.SINGLE_LINE) { it } } } -// CallChain[size=9] = QLogStyle <-[Ref]- QLogStyle.SRC_AND_STACK <-[Call]- QException.mySrcAndStack ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=9] = QLogStyle <-[Ref]- QLogStyle.SRC_AND_STACK <-[Call]- QException.mySrcAndStack ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal class QLogStyle( val stackSize: Int, val out: QOut = QMyLog.out, @@ -73,17 +73,17 @@ internal class QLogStyle( ) { @Suppress("UNUSED_PARAMETER") companion object { - // CallChain[size=9] = QLogStyle.String.clarifySrcRegion() <-[Call]- QLogStyle.SRC_AND_STACK <-[Call ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=9] = QLogStyle.String.clarifySrcRegion() <-[Call]- QLogStyle.SRC_AND_STACK <-[Call ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun String.clarifySrcRegion(onlyIf: QOnlyIfStr = QOnlyIfStr.Multiline): String { if (!onlyIf.matches(this)) return this - return """${"SRC START ―――――――――――".qColor(QShColor.CYAN)} + return """${"SRC START ―――――――――――".qColor(QShColor.Cyan)} ${this.trim()} -${"SRC END ―――――――――――".qColor(QShColor.CYAN)}""" +${"SRC END ―――――――――――".qColor(QShColor.Cyan)}""" } - // CallChain[size=10] = QLogStyle.qLogArrow() <-[Call]- QLogStyle.S <-[Call]- qLogStackFrames() <-[C ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=10] = QLogStyle.qLogArrow() <-[Call]- QLogStyle.S <-[Call]- qLogStackFrames() <-[C ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun qLogArrow(mySrc: String, msg: String): String { return if (mySrc.startsWith("\"") && mySrc.endsWith("\"") && mySrc.substring(1, mySrc.length - 1) .matches("""[\w\s]+""".re) @@ -96,7 +96,7 @@ ${"SRC END ―――――――――――".qColor(QShColor.CYAN)}""" } } - // CallChain[size=8] = QLogStyle.SRC_AND_STACK <-[Call]- QException.mySrcAndStack <-[Call]- QExcepti ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=8] = QLogStyle.SRC_AND_STACK <-[Call]- QException.mySrcAndStack <-[Call]- QExcepti ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val SRC_AND_STACK: QLogStyle get() = QLogStyle(1) { _, mySrc, _, stackTrace -> """ @@ -113,7 +113,7 @@ $stackTrace """.trim() } - // CallChain[size=9] = QLogStyle.S <-[Call]- qLogStackFrames() <-[Call]- QException.mySrcAndStack <- ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=9] = QLogStyle.S <-[Call]- qLogStackFrames() <-[Call]- QException.mySrcAndStack <- ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val S: QLogStyle get() = QLogStyle(1) { msg, mySrc, _, stackTrace -> """ @@ -126,7 +126,7 @@ $stackTrace } } -// CallChain[size=9] = qMySrcLinesAtFrame() <-[Call]- qLogStackFrames() <-[Call]- QException.mySrcAn ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=9] = qMySrcLinesAtFrame() <-[Call]- qLogStackFrames() <-[Call]- QException.mySrcAn ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun qMySrcLinesAtFrame( frame: StackFrame, srcCut: QSrcCut = QSrcCut.NOCUT_JUST_SINGLE_LINE, @@ -144,11 +144,11 @@ internal fun qMySrcLinesAtFrame( src2 } catch (e: Exception) { // e.message - "${QMyMark.WARN} Couldn't cut src lines : ${qBrackets("FileName", frame.fileName, "LineNo", frame.lineNumber, "SrcRoots", srcRoots)}" + "${QMyMark.warn} Couldn't cut src lines : ${qBrackets("FileName", frame.fileName, "LineNo", frame.lineNumber, "SrcRoots", srcRoots)}" } } -// CallChain[size=8] = qLogStackFrames() <-[Call]- QException.mySrcAndStack <-[Call]- QException.pri ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=8] = qLogStackFrames() <-[Call]- QException.mySrcAndStack <-[Call]- QException.pri ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun qLogStackFrames( frames: List, msg: Any? = "", @@ -186,15 +186,15 @@ internal fun qLogStackFrames( val text = style.start + output + style.end - val finalTxt = if (noColor) text.noColor else text + val finalTxt = if (noColor) text.noStyle else text if (!quiet) style.out.print(finalTxt) - return if (noColor) output.noColor else output + return if (noColor) output.noStyle else output } -// CallChain[size=10] = qSrcFileLinesAtFrame() <-[Call]- qMySrcLinesAtFrame() <-[Call]- qLogStackFra ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=10] = qSrcFileLinesAtFrame() <-[Call]- qMySrcLinesAtFrame() <-[Call]- qLogStackFra ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun qSrcFileLinesAtFrame( srcRoots: List = QMyPath.src_root, pkgDirHint: String? = null, @@ -208,7 +208,7 @@ internal fun qSrcFileLinesAtFrame( return srcFile.qFetchLinesAround(frame.lineNumber, fetchRule, charset, lineSeparator) } -// CallChain[size=11] = qArrow() <-[Call]- QLogStyle.qLogArrow() <-[Call]- QLogStyle.S <-[Call]- qLo ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=11] = qArrow() <-[Call]- QLogStyle.qLogArrow() <-[Call]- QLogStyle.S <-[Call]- qLo ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun qArrow(key: Any?, value: Any?): String { val keyStr = key.qToLogString() .qWithNewLinePrefix(onlyIf = QOnlyIfStr.Multiline) @@ -220,7 +220,7 @@ internal fun qArrow(key: Any?, value: Any?): String { return "$keyStr$qARROW$valStr" } -// CallChain[size=4] = String.qBracketEnd() <-[Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=4] = String.qBracketEnd() <-[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] /** * ``` * [key1] value1 [key2] value2 @@ -234,7 +234,7 @@ private fun String.qBracketEnd(value: Any?): String { return "[$this]$valStr" } -// CallChain[size=4] = String.qBracketStartOrMiddle() <-[Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=4] = String.qBracketStartOrMiddle() <-[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] /** * ``` * [key1] value1 [key2] value2 @@ -247,7 +247,7 @@ private fun String.qBracketStartOrMiddle(value: Any?): String { return "[$this]$valStr" } -// CallChain[size=3] = qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=3] = qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun qBrackets(vararg keysAndValues: Any?): String { if (keysAndValues.size % 2 != 0) { QE.ShouldBeEvenNumber.throwItBrackets("KeysAndValues.size", keysAndValues.size) diff --git a/src-test-split/nyab/util/QOut.kt b/src-test-split/nyab/util/QOut.kt index 03a6eba..360fbdb 100644 --- a/src-test-split/nyab/util/QOut.kt +++ b/src-test-split/nyab/util/QOut.kt @@ -16,22 +16,22 @@ import java.nio.file.Path // qq-tree is a self-contained single-file library created by nyabkun. // This is a split-file version of the library, this file is not self-contained. -// CallChain[size=10] = QOut <-[Ref]- QLogStyle <-[Ref]- QLogStyle.SRC_AND_STACK <-[Call]- QExceptio ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=10] = QOut <-[Ref]- QLogStyle <-[Ref]- QLogStyle.SRC_AND_STACK <-[Call]- QExceptio ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal interface QOut { - // CallChain[size=12] = QOut.isAcceptColoredText <-[Propag]- QOut.CONSOLE <-[Call]- QMyLog.out <-[Ca ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=12] = QOut.isAcceptColoredText <-[Propag]- QOut.CONSOLE <-[Call]- QMyLog.out <-[Ca ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val isAcceptColoredText: Boolean - // CallChain[size=12] = QOut.print() <-[Propag]- QOut.CONSOLE <-[Call]- QMyLog.out <-[Call]- QLogSty ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=12] = QOut.print() <-[Propag]- QOut.CONSOLE <-[Call]- QMyLog.out <-[Call]- QLogSty ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun print(msg: Any? = "") - // CallChain[size=12] = QOut.println() <-[Propag]- QOut.CONSOLE <-[Call]- QMyLog.out <-[Call]- QLogS ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=12] = QOut.println() <-[Propag]- QOut.CONSOLE <-[Call]- QMyLog.out <-[Call]- QLogS ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun println(msg: Any? = "") - // CallChain[size=12] = QOut.close() <-[Propag]- QOut.CONSOLE <-[Call]- QMyLog.out <-[Call]- QLogSty ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=12] = QOut.close() <-[Propag]- QOut.CONSOLE <-[Call]- QMyLog.out <-[Call]- QLogSty ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun close() companion object { - // CallChain[size=11] = QOut.CONSOLE <-[Call]- QMyLog.out <-[Call]- QLogStyle <-[Ref]- QLogStyle.SRC ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=11] = QOut.CONSOLE <-[Call]- QMyLog.out <-[Call]- QLogStyle <-[Ref]- QLogStyle.SRC ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val CONSOLE: QOut = QConsole(true) @@ -43,23 +43,23 @@ internal fun QOut.separator(start: String = "\n", end: String = "\n") { this.println(qSeparator(start = start, end = end)) } -// CallChain[size=12] = QConsole <-[Call]- QOut.CONSOLE <-[Call]- QMyLog.out <-[Call]- QLogStyle <-[ ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=12] = QConsole <-[Call]- QOut.CONSOLE <-[Call]- QMyLog.out <-[Call]- QLogStyle <-[ ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private class QConsole(override val isAcceptColoredText: Boolean) : QOut { - // CallChain[size=13] = QConsole.print() <-[Propag]- QConsole <-[Call]- QOut.CONSOLE <-[Call]- QMyLo ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=13] = QConsole.print() <-[Propag]- QConsole <-[Call]- QOut.CONSOLE <-[Call]- QMyLo ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun print(msg: Any?) { if (isAcceptColoredText) { kotlin.io.print(msg.toString()) } else { - kotlin.io.print(msg.toString().noColor) + kotlin.io.print(msg.toString().noStyle) } } - // CallChain[size=13] = QConsole.println() <-[Propag]- QConsole <-[Call]- QOut.CONSOLE <-[Call]- QMy ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=13] = QConsole.println() <-[Propag]- QConsole <-[Call]- QOut.CONSOLE <-[Call]- QMy ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun println(msg: Any?) { kotlin.io.println(msg.toString()) } - // CallChain[size=13] = QConsole.close() <-[Propag]- QConsole <-[Call]- QOut.CONSOLE <-[Call]- QMyLo ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=13] = QConsole.close() <-[Propag]- QConsole <-[Call]- QOut.CONSOLE <-[Call]- QMyLo ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun close() { // Do nothing } diff --git a/src-test-split/nyab/util/QReflection.kt b/src-test-split/nyab/util/QReflection.kt index 5e6f59e..9641ef2 100644 --- a/src-test-split/nyab/util/QReflection.kt +++ b/src-test-split/nyab/util/QReflection.kt @@ -32,6 +32,7 @@ import kotlin.reflect.jvm.isAccessible import kotlin.streams.asSequence import nyab.conf.QE import nyab.conf.QMyPath +import nyab.conf.qSTACK_FRAME_FILTER import nyab.match.QM import nyab.match.QMFunc import nyab.match.and @@ -56,7 +57,7 @@ internal fun Method.qName(withParenthesis: Boolean = false): String { } } -// CallChain[size=6] = KClass<*>.qFunctions() <-[Call]- qToStringRegistry <-[Call]- Any?.qToString() ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=6] = KClass<*>.qFunctions() <-[Call]- qToStringRegistry <-[Call]- Any.qToString() ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun KClass<*>.qFunctions(matcher: QMFunc = QMFunc.DeclaredOnly and QMFunc.IncludeExtensionsInClass): List> { val list = mutableListOf>() @@ -81,7 +82,7 @@ internal fun KClass<*>.qFunctions(matcher: QMFunc = QMFunc.DeclaredOnly and QMFu return list } -// CallChain[size=17] = KClass.qEnumValues() <-[Call]- QFlagSet.enumValues <-[Call]- QFlagSet.toE ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=17] = KClass.qEnumValues() <-[Call]- QFlagSet.enumValues <-[Call]- QFlagSet.toE ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun > KClass.qEnumValues(): Array { return java.enumConstants as Array } @@ -90,7 +91,7 @@ internal fun > KClass.qEnumValues(): Array { internal val qThisSrcLineSignature: String get() = qCallerSrcLineSignature() -// CallChain[size=11] = qSrcFileAtFrame() <-[Call]- qSrcFileLinesAtFrame() <-[Call]- qMySrcLinesAtFr ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=11] = qSrcFileAtFrame() <-[Call]- qSrcFileLinesAtFrame() <-[Call]- qMySrcLinesAtFr ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun qSrcFileAtFrame(frame: StackFrame, srcRoots: List = QMyPath.src_root, pkgDirHint: String? = null): Path = qCacheItOneSec( frame.fileName + frame.lineNumber + srcRoots.map { it }.joinToString() + pkgDirHint ) { @@ -143,21 +144,21 @@ internal fun qCallerSrcLineSignature(stackDepth: Int = 0): String { } } -// CallChain[size=8] = qStackFrames() <-[Call]- QException.stackFrames <-[Call]- QException.getStack ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=8] = qStackFrames() <-[Call]- QException.stackFrames <-[Call]- QException.getStack ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal inline fun qStackFrames( stackDepth: Int = 0, size: Int = 1, - noinline filter: (StackFrame) -> Boolean = QE.STACK_FRAME_FILTER, + noinline filter: (StackFrame) -> Boolean = qSTACK_FRAME_FILTER, ): List { return StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE).walk { s: Stream -> s.asSequence().filter(filter).drop(stackDepth).take(size).toList() } } -// CallChain[size=11] = qStackFrame() <-[Call]- qSrcFileLinesAtFrame() <-[Call]- qMySrcLinesAtFrame( ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=11] = qStackFrame() <-[Call]- qSrcFileLinesAtFrame() <-[Call]- qMySrcLinesAtFrame( ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal inline fun qStackFrame( stackDepth: Int = 0, - noinline filter: (StackFrame) -> Boolean = QE.STACK_FRAME_FILTER, + noinline filter: (StackFrame) -> Boolean = qSTACK_FRAME_FILTER, ): StackFrame { return qStackFrames(stackDepth, 1, filter)[0] } @@ -171,7 +172,7 @@ internal fun qStackFrameEntryMethod(filter: (StackFrame) -> Boolean): StackFrame }.qaNotNull() } -// CallChain[size=7] = KType.qToClass() <-[Call]- KType.qIsSuperclassOf() <-[Call]- qToStringRegistr ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=7] = KType.qToClass() <-[Call]- KType.qIsSuperclassOf() <-[Call]- qToStringRegistr ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun KType.qToClass(): KClass<*>? { return if (this.classifier != null && this.classifier is KClass<*>) { this.classifier as KClass<*> @@ -180,7 +181,7 @@ internal fun KType.qToClass(): KClass<*>? { } } -// CallChain[size=6] = KType.qIsSuperclassOf() <-[Call]- qToStringRegistry <-[Call]- Any?.qToString( ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=6] = KType.qIsSuperclassOf() <-[Call]- qToStringRegistry <-[Call]- Any.qToString() ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun KType.qIsSuperclassOf(cls: KClass<*>): Boolean { return try { val thisClass = qToClass() diff --git a/src-test-split/nyab/util/QRegex.kt b/src-test-split/nyab/util/QRegex.kt index 2eba412..701cbf1 100644 --- a/src-test-split/nyab/util/QRegex.kt +++ b/src-test-split/nyab/util/QRegex.kt @@ -15,28 +15,17 @@ import org.intellij.lang.annotations.Language // qq-tree is a self-contained single-file library created by nyabkun. // This is a split-file version of the library, this file is not self-contained. -// CallChain[size=8] = RO <-[Ref]- String.qReplaceFirstIfNonEmptyStringGroup() <-[Call]- String.qApp ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=9] = RO <-[Ref]- qRe() <-[Call]- QException.mySrcAndStack <-[Call]- QException.pri ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal typealias RO = RegexOption -// CallChain[size=8] = qRe() <-[Call]- String.qReplaceFirstIfNonEmptyStringGroup() <-[Call]- String. ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=8] = qRe() <-[Call]- QException.mySrcAndStack <-[Call]- QException.printStackTrace ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun qRe(@Language("RegExp") regex: String, vararg opts: RO): Regex { return qCacheItOneSecThreadLocal(regex + opts.contentToString()) { Regex(regex, setOf(*opts)) } } -// CallChain[size=7] = re <-[Call]- String.qApplyColorNestable() <-[Call]- String.qColorLine() <-[Ca ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=10] = @receiver:Language("RegExp") String.re <-[Call]- QFetchRule.SMART_FETCH <-[C ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] // https://youtrack.jetbrains.com/issue/KTIJ-5643 internal val @receiver:Language("RegExp") String.re: Regex - get() = qRe(this) - -// CallChain[size=7] = String.qReplaceFirstIfNonEmptyStringGroup() <-[Call]- String.qApplyColorNesta ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] -internal fun String.qReplaceFirstIfNonEmptyStringGroup(@Language("RegExp") regex: String, nonEmptyGroupIdx: Int, replace: String = "$1", vararg opts: RO): String { - val re = qRe(regex, *opts) - - return if (re.find(this)?.groups?.get(nonEmptyGroupIdx)?.value?.isNotEmpty() == true) { - re.replaceFirst(this, replace) - } else { - this - } -} \ No newline at end of file + get() = qRe(this) \ No newline at end of file diff --git a/src-test-split/nyab/util/QShColor.kt b/src-test-split/nyab/util/QShColor.kt index 88b3379..5491b56 100644 --- a/src-test-split/nyab/util/QShColor.kt +++ b/src-test-split/nyab/util/QShColor.kt @@ -15,191 +15,179 @@ import kotlin.math.absoluteValue // qq-tree is a self-contained single-file library created by nyabkun. // This is a split-file version of the library, this file is not self-contained. -// CallChain[size=6] = qBG_JUMP <-[Call]- QShColor.bg <-[Propag]- QShColor.LIGHT_GREEN <-[Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=6] = qBG_JUMP <-[Call]- QShColor.bg <-[Propag]- QShColor.LightGreen <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private const val qBG_JUMP = 10 -// CallChain[size=6] = qSTART <-[Call]- QShColor.bg <-[Propag]- QShColor.LIGHT_GREEN <-[Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=6] = qSTART <-[Call]- QShColor.bg <-[Propag]- QShColor.LightGreen <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private const val qSTART = "\u001B[" -// CallChain[size=6] = qEND <-[Call]- String.qColorLine() <-[Call]- String.qColor() <-[Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=7] = qEND <-[Call]- String.qApplyEscapeLine() <-[Call]- String.qApplyEscapeLine() ... - String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private const val qEND = "${qSTART}0m" -// CallChain[size=7] = qMASK_COLORED <-[Call]- String.qApplyColorNestable() <-[Call]- String.qColorL ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] -private val qMASK_COLORED by lazy { - QMaskBetween( - qSTART, - qEND, - qSTART, - escapeChar = '\\', - targetNestDepth = 1, - maskIncludeStartAndEndSequence = false - ) -} +// CallChain[size=7] = String.qApplyEscapeNestable() <-[Call]- String.qApplyEscapeLine() <-[Call]- S ... - String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +private fun String.qApplyEscapeNestable(start: String): String { + val lastEnd = this.endsWith(qEND) -// CallChain[size=6] = String.qApplyColorNestable() <-[Call]- String.qColorLine() <-[Call]- String.q ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] -private fun String.qApplyColorNestable(colorStart: String): String { - val re = "(?s)(\\Q$qEND\\E)(.+?)(\\Q$qSTART\\E|$)".re - val replace = "$1$colorStart$2$qEND$3" - val re2 = "^(?s)(.*?)(\\Q$qSTART\\E)" - val replace2 = "$colorStart$1$qEND$2" - - return this.qMaskAndReplace( - qMASK_COLORED, - re, - replace - ).qReplaceFirstIfNonEmptyStringGroup(re2, 1, replace2) + return if( lastEnd ) { + start + this.substring(0, this.length - 1).replace(qEND, qEND + start) + this[this.length - 1] + } else { + start + this.replace(qEND, qEND + start) + qEND + } } -// CallChain[size=4] = String.qColor() <-[Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=4] = String.qColor() <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun String.qColor(fg: QShColor? = null, bg: QShColor? = null, nestable: Boolean = this.contains(qSTART)): String { return if (this.qIsSingleLine()) { - this.qColorLine(fg, bg, nestable) + this.qApplyEscapeLine(fg, bg, nestable) } else { lineSequence().map { line -> - line.qColorLine(fg, bg, nestable) + line.qApplyEscapeLine(fg, bg, nestable) }.joinToString("\n") } } -// CallChain[size=5] = String.qColorLine() <-[Call]- String.qColor() <-[Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] -private fun String.qColorLine( - fg: QShColor? = null, - bg: QShColor? = null, - nestable: Boolean = true, +// CallChain[size=5] = String.qApplyEscapeLine() <-[Call]- String.qColor() <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +private fun String.qApplyEscapeLine(fg: QShColor?, bg: QShColor?, nestable: Boolean): String { + return this.qApplyEscapeLine( + listOfNotNull(fg?.fg, bg?.bg).toTypedArray(), + nestable + ) +} + +// CallChain[size=6] = String.qApplyEscapeLine() <-[Call]- String.qApplyEscapeLine() <-[Call]- Strin ... - String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +private fun String.qApplyEscapeLine( + startSequences: Array, + nestable: Boolean ): String { val nest = nestable && this.contains(qEND) - val fgApplied = if (fg != null) { - val fgStart = fg.fg + var text = this - if (nest) { - this.qApplyColorNestable(fgStart) + for (start in startSequences) { + text = if (nest) { + text.qApplyEscapeNestable(start) } else { - "$fgStart$this$qEND" + "$start$text$qEND" } - } else { - this } - val bgApplied = if (bg != null) { - val bgStart = bg.bg - - if (nest) { - fgApplied.qApplyColorNestable(bgStart) - } else { - "$bgStart$fgApplied$qEND" - } - } else { - fgApplied - } - - return bgApplied + return text } -// CallChain[size=3] = noColor <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] -internal val String.noColor: String - get() { - return this.replace("""\Q$qSTART\E\d{1,2}m""".re, "") - } - -// CallChain[size=4] = QShColor <-[Ref]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=4] = QShColor <-[Ref]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] enum class QShColor(val code: Int) { - // CallChain[size=5] = QShColor.BLACK <-[Propag]- QShColor.LIGHT_GREEN <-[Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] - BLACK(30), - // CallChain[size=5] = QShColor.RED <-[Propag]- QShColor.LIGHT_GREEN <-[Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] - RED(31), - // CallChain[size=5] = QShColor.GREEN <-[Propag]- QShColor.LIGHT_GREEN <-[Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] - GREEN(32), - // CallChain[size=5] = QShColor.YELLOW <-[Propag]- QShColor.LIGHT_GREEN <-[Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] - YELLOW(33), - // CallChain[size=5] = QShColor.BLUE <-[Propag]- QShColor.LIGHT_GREEN <-[Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] - BLUE(34), - // CallChain[size=5] = QShColor.MAGENTA <-[Propag]- QShColor.LIGHT_GREEN <-[Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] - MAGENTA(35), - // CallChain[size=5] = QShColor.CYAN <-[Propag]- QShColor.LIGHT_GREEN <-[Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] - CYAN(36), - // CallChain[size=5] = QShColor.LIGHT_GRAY <-[Propag]- QShColor.LIGHT_GREEN <-[Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] - LIGHT_GRAY(37), - - // CallChain[size=5] = QShColor.DARK_GRAY <-[Propag]- QShColor.LIGHT_GREEN <-[Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] - DARK_GRAY(90), - // CallChain[size=5] = QShColor.LIGHT_RED <-[Propag]- QShColor.LIGHT_GREEN <-[Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] - LIGHT_RED(91), - // CallChain[size=4] = QShColor.LIGHT_GREEN <-[Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] - LIGHT_GREEN(92), - // CallChain[size=5] = QShColor.LIGHT_YELLOW <-[Propag]- QShColor.LIGHT_GREEN <-[Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] - LIGHT_YELLOW(93), - // CallChain[size=5] = QShColor.LIGHT_BLUE <-[Propag]- QShColor.LIGHT_GREEN <-[Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] - LIGHT_BLUE(94), - // CallChain[size=5] = QShColor.LIGHT_MAGENTA <-[Propag]- QShColor.LIGHT_GREEN <-[Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] - LIGHT_MAGENTA(95), - // CallChain[size=5] = QShColor.LIGHT_CYAN <-[Propag]- QShColor.LIGHT_GREEN <-[Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] - LIGHT_CYAN(96), - // CallChain[size=5] = QShColor.WHITE <-[Propag]- QShColor.LIGHT_GREEN <-[Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] - WHITE(97); - - // CallChain[size=5] = QShColor.fg <-[Propag]- QShColor.LIGHT_GREEN <-[Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] - /** ANSI modifier string to apply the color to the text itself */ + // CallChain[size=5] = QShColor.Black <-[Propag]- QShColor.LightGreen <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + Black(30), + // CallChain[size=5] = QShColor.Red <-[Propag]- QShColor.LightGreen <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + Red(31), + // CallChain[size=5] = QShColor.Green <-[Propag]- QShColor.LightGreen <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + Green(32), + // CallChain[size=5] = QShColor.Yellow <-[Propag]- QShColor.LightGreen <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + Yellow(33), + // CallChain[size=5] = QShColor.Blue <-[Propag]- QShColor.LightGreen <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + Blue(34), + // CallChain[size=5] = QShColor.Purple <-[Propag]- QShColor.LightGreen <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + Purple(35), + // CallChain[size=5] = QShColor.Cyan <-[Propag]- QShColor.LightGreen <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + Cyan(36), + // CallChain[size=5] = QShColor.LightGray <-[Propag]- QShColor.LightGreen <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + LightGray(37), + + // CallChain[size=5] = QShColor.DefaultFG <-[Propag]- QShColor.LightGreen <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + DefaultFG(39), + // CallChain[size=5] = QShColor.DefaultBG <-[Propag]- QShColor.LightGreen <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + DefaultBG(49), + + // CallChain[size=5] = QShColor.DarkGray <-[Propag]- QShColor.LightGreen <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + DarkGray(90), + // CallChain[size=5] = QShColor.LightRed <-[Propag]- QShColor.LightGreen <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + LightRed(91), + // CallChain[size=4] = QShColor.LightGreen <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + LightGreen(92), + // CallChain[size=5] = QShColor.LightYellow <-[Propag]- QShColor.LightGreen <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + LightYellow(93), + // CallChain[size=5] = QShColor.LightBlue <-[Propag]- QShColor.LightGreen <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + LightBlue(94), + // CallChain[size=5] = QShColor.LightPurple <-[Propag]- QShColor.LightGreen <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + LightPurple(95), + // CallChain[size=5] = QShColor.LightCyan <-[Propag]- QShColor.LightGreen <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + LightCyan(96), + // CallChain[size=5] = QShColor.White <-[Propag]- QShColor.LightGreen <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + White(97); + + // CallChain[size=5] = QShColor.fg <-[Propag]- QShColor.LightGreen <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val fg: String = "$qSTART${code}m" - // CallChain[size=5] = QShColor.bg <-[Propag]- QShColor.LIGHT_GREEN <-[Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] - /** ANSI modifier string to apply the color the text's background */ + // CallChain[size=5] = QShColor.bg <-[Propag]- QShColor.LightGreen <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val bg: String = "$qSTART${code + qBG_JUMP}m" companion object { - // CallChain[size=5] = QShColor.random() <-[Propag]- QShColor.LIGHT_GREEN <-[Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] - fun random(seed: String, colors: Array = arrayOf(YELLOW, GREEN, BLUE, MAGENTA, CYAN)): QShColor { + // CallChain[size=5] = QShColor.random() <-[Propag]- QShColor.LightGreen <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + fun random(seed: String, colors: Array = arrayOf(Yellow, Green, Blue, Purple, Cyan)): QShColor { val idx = seed.hashCode().rem(colors.size).absoluteValue return colors[idx] } + + // CallChain[size=5] = QShColor.get() <-[Propag]- QShColor.LightGreen <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + fun get(ansiEscapeCode: Int): QShColor { + return QShColor.values().find { + it.code == ansiEscapeCode + }!! + } } } -// CallChain[size=8] = String.qColorTarget() <-[Call]- QException.mySrcAndStack <-[Call]- QException ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] -internal fun String.qColorTarget(ptn: Regex, color: QShColor = QShColor.LIGHT_YELLOW): String { - return ptn.replace(this, "$0".qColor(color)) +// CallChain[size=8] = String.qColorTarget() <-[Call]- QException.mySrcAndStack <-[Call]- QException ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +internal fun String.qColorTarget(ptn: Regex, fg: QShColor? = null, bg: QShColor? = null): String { + return ptn.replace(this, "$0".qColor(fg, bg)) } -// CallChain[size=5] = red <-[Call]- QTestResult.printIt() <-[Call]- qTestMethods() <-[Call]- qTest() <-[Call]- main()[Root] +// CallChain[size=5] = String.red <-[Call]- QTestResult.printIt() <-[Call]- qTestMethods() <-[Call]- qTest() <-[Call]- main()[Root] internal val String?.red: String - get() = this?.qColor(QShColor.RED) ?: "null".qColor(QShColor.RED) + get() = this?.qColor(QShColor.Red) ?: "null".qColor(QShColor.Red) -// CallChain[size=5] = green <-[Call]- QTestResult.printIt() <-[Call]- qTestMethods() <-[Call]- qTest() <-[Call]- main()[Root] +// CallChain[size=5] = String.green <-[Call]- QTestResult.printIt() <-[Call]- qTestMethods() <-[Call]- qTest() <-[Call]- main()[Root] internal val String?.green: String - get() = this?.qColor(QShColor.GREEN) ?: "null".qColor(QShColor.GREEN) + get() = this?.qColor(QShColor.Green) ?: "null".qColor(QShColor.Green) -// CallChain[size=8] = yellow <-[Call]- QException.qToString() <-[Call]- QException.toString() <-[Pr ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=8] = String.yellow <-[Call]- QException.qToString() <-[Call]- QException.toString( ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal val String?.yellow: String - get() = this?.qColor(QShColor.YELLOW) ?: "null".qColor(QShColor.YELLOW) + get() = this?.qColor(QShColor.Yellow) ?: "null".qColor(QShColor.Yellow) -// CallChain[size=3] = blue <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=3] = String.blue <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal val String?.blue: String - get() = this?.qColor(QShColor.BLUE) ?: "null".qColor(QShColor.BLUE) + get() = this?.qColor(QShColor.Blue) ?: "null".qColor(QShColor.Blue) -// CallChain[size=12] = cyan <-[Call]- QMaskResult.toString() <-[Propag]- QMaskResult <-[Ref]- QMask ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=10] = String.cyan <-[Call]- QLogStyle <-[Ref]- QLogStyle.SRC_AND_STACK <-[Call]- Q ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal val String?.cyan: String - get() = this?.qColor(QShColor.CYAN) ?: "null".qColor(QShColor.CYAN) + get() = this?.qColor(QShColor.Cyan) ?: "null".qColor(QShColor.Cyan) -// CallChain[size=3] = light_gray <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=3] = String.light_gray <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal val String?.light_gray: String - get() = this?.qColor(QShColor.LIGHT_GRAY) ?: "null".qColor(QShColor.LIGHT_GRAY) + get() = this?.qColor(QShColor.LightGray) ?: "null".qColor(QShColor.LightGray) -// CallChain[size=6] = light_red <-[Call]- allTestedMethods <-[Call]- QTestResult.printIt() <-[Call]- qTestMethods() <-[Call]- qTest() <-[Call]- main()[Root] +// CallChain[size=6] = String.light_red <-[Call]- List.allTestedMethods <-[Call]- QTestResult.printIt() <-[Call]- qTestMethods() <-[Call]- qTest() <-[Call]- main()[Root] internal val String?.light_red: String - get() = this?.qColor(QShColor.LIGHT_RED) ?: "null".qColor(QShColor.LIGHT_RED) + get() = this?.qColor(QShColor.LightRed) ?: "null".qColor(QShColor.LightRed) -// CallChain[size=3] = light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=3] = String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal val String?.light_green: String - get() = this?.qColor(QShColor.LIGHT_GREEN) ?: "null".qColor(QShColor.LIGHT_GREEN) + get() = this?.qColor(QShColor.LightGreen) ?: "null".qColor(QShColor.LightGreen) -// CallChain[size=5] = light_yellow <-[Call]- colorIt <-[Call]- qFailMsg() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=5] = String.light_yellow <-[Call]- String.colorIt <-[Call]- qFailMsg() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal val String?.light_yellow: String - get() = this?.qColor(QShColor.LIGHT_YELLOW) ?: "null".qColor(QShColor.LIGHT_YELLOW) + get() = this?.qColor(QShColor.LightYellow) ?: "null".qColor(QShColor.LightYellow) -// CallChain[size=3] = light_blue <-[Call]- qTest() <-[Call]- main()[Root] +// CallChain[size=3] = String.light_blue <-[Call]- qTest() <-[Call]- main()[Root] internal val String?.light_blue: String - get() = this?.qColor(QShColor.LIGHT_BLUE) ?: "null".qColor(QShColor.LIGHT_BLUE) + get() = this?.qColor(QShColor.LightBlue) ?: "null".qColor(QShColor.LightBlue) -// CallChain[size=13] = light_cyan <-[Call]- qARROW <-[Call]- qArrow() <-[Call]- QLogStyle.qLogArrow ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=13] = String.light_cyan <-[Call]- qARROW <-[Call]- qArrow() <-[Call]- QLogStyle.qL ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal val String?.light_cyan: String - get() = this?.qColor(QShColor.LIGHT_CYAN) ?: "null".qColor(QShColor.LIGHT_CYAN) \ No newline at end of file + get() = this?.qColor(QShColor.LightCyan) ?: "null".qColor(QShColor.LightCyan) + +// CallChain[size=3] = String.noStyle <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +internal val String.noStyle: String + get() { + return this.replace("""\Q$qSTART\E\d{1,2}m""".re, "") + } \ No newline at end of file diff --git a/src-test-split/nyab/util/QShortExtensions.kt b/src-test-split/nyab/util/QShortExtensions.kt index 73a6521..9142a36 100644 --- a/src-test-split/nyab/util/QShortExtensions.kt +++ b/src-test-split/nyab/util/QShortExtensions.kt @@ -22,6 +22,6 @@ internal operator fun StringBuilder.plusAssign(str: String) { this.append(str) } -// CallChain[size=10] = path <-[Call]- QMyPath.src_root <-[Call]- qLogStackFrames() <-[Call]- QExcep ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=10] = String.path <-[Call]- QMyPath.src_root <-[Call]- qLogStackFrames() <-[Call]- ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal val String.path: Path get() = Paths.get(this.trim()).toAbsolutePath().normalize() \ No newline at end of file diff --git a/src-test-split/nyab/util/QString.kt b/src-test-split/nyab/util/QString.kt index cf62f65..b1ef012 100644 --- a/src-test-split/nyab/util/QString.kt +++ b/src-test-split/nyab/util/QString.kt @@ -11,6 +11,7 @@ package nyab.util import java.nio.charset.Charset +import java.util.* import kotlin.math.min import kotlin.reflect.full.extensionReceiverParameter import kotlin.reflect.full.isSuperclassOf @@ -33,25 +34,25 @@ internal enum class QLR { // CallChain[size=4] = qSeparator() <-[Call]- QOut.separator() <-[Call]- qTest() <-[Call]- main()[Root] internal fun qSeparator( - fg: QShColor? = QShColor.LIGHT_GRAY, - bg: QShColor? = null, - char: Char = '⎯', - length: Int = 80, - start: String = "\n", - end: String = "\n", + fg: QShColor? = QShColor.LightGray, + bg: QShColor? = null, + char: Char = '⎯', + length: Int = 80, + start: String = "\n", + end: String = "\n", ): String { return start + char.toString().repeat(length).qColor(fg, bg) + end } // CallChain[size=4] = qSeparatorWithLabel() <-[Call]- qTestMethods() <-[Call]- qTest() <-[Call]- main()[Root] internal fun qSeparatorWithLabel( - label: String, - fg: QShColor? = QShColor.LIGHT_GRAY, - bg: QShColor? = null, - char: Char = '⎯', - length: Int = 70, - start: String = "\n", - end: String = "\n", + label: String, + fg: QShColor? = QShColor.LightGray, + bg: QShColor? = null, + char: Char = '⎯', + length: Int = 70, + start: String = "\n", + end: String = "\n", ): String { return start + label + " " + char.toString().repeat((length - label.length - 2).coerceAtLeast(0)).qColor(fg, bg) .qWithMinAndMaxLength(length, length, alignment = QAlign.LEFT, endDots = "") + end @@ -94,25 +95,25 @@ internal fun String.qWithMaxLength(maxLength: Int, endDots: String = " ..."): St return substring(0, length.coerceAtMost(maxLength - endDots.length)) + endDots } -// CallChain[size=12] = QOnlyIfStr <-[Ref]- QMaskResult.toString() <-[Propag]- QMaskResult <-[Ref]- ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=5] = QOnlyIfStr <-[Ref]- String.qBracketEnd() <-[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal enum class QOnlyIfStr(val matches: (String) -> Boolean) { - // CallChain[size=12] = QOnlyIfStr.Multiline <-[Call]- QMaskResult.toString() <-[Propag]- QMaskResul ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=5] = QOnlyIfStr.Multiline <-[Call]- String.qBracketEnd() <-[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] Multiline({ it.qIsMultiLine() }), - // CallChain[size=13] = QOnlyIfStr.SingleLine <-[Propag]- QOnlyIfStr.Multiline <-[Call]- QMaskResult ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=5] = QOnlyIfStr.SingleLine <-[Call]- String.qBracketEnd() <-[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] SingleLine({ it.qIsSingleLine() }), - // CallChain[size=13] = QOnlyIfStr.Empty <-[Propag]- QOnlyIfStr.Multiline <-[Call]- QMaskResult.toSt ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=6] = QOnlyIfStr.Empty <-[Propag]- QOnlyIfStr.Multiline <-[Call]- String.qBracketEn ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] Empty({ it.isEmpty() }), - // CallChain[size=13] = QOnlyIfStr.Blank <-[Propag]- QOnlyIfStr.Multiline <-[Call]- QMaskResult.toSt ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=6] = QOnlyIfStr.Blank <-[Propag]- QOnlyIfStr.Multiline <-[Call]- String.qBracketEn ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] Blank({ it.isBlank() }), - // CallChain[size=13] = QOnlyIfStr.NotEmpty <-[Propag]- QOnlyIfStr.Multiline <-[Call]- QMaskResult.t ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=6] = QOnlyIfStr.NotEmpty <-[Propag]- QOnlyIfStr.Multiline <-[Call]- String.qBracke ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] NotEmpty({ it.isNotEmpty() }), - // CallChain[size=13] = QOnlyIfStr.NotBlank <-[Propag]- QOnlyIfStr.Multiline <-[Call]- QMaskResult.t ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=6] = QOnlyIfStr.NotBlank <-[Propag]- QOnlyIfStr.Multiline <-[Call]- String.qBracke ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] NotBlank({ it.isNotBlank() }), - // CallChain[size=13] = QOnlyIfStr.Always <-[Propag]- QOnlyIfStr.Multiline <-[Call]- QMaskResult.toS ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=6] = QOnlyIfStr.Always <-[Propag]- QOnlyIfStr.Multiline <-[Call]- String.qBracketE ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] Always({ true }) } -// CallChain[size=13] = String.qWithNewLinePrefix() <-[Call]- String.qWithNewLineSurround() <-[Call] ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=6] = String.qWithNewLinePrefix() <-[Call]- String.qWithNewLineSurround() <-[Call]- ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun String.qWithNewLinePrefix( numNewLine: Int = 1, onlyIf: QOnlyIfStr = QOnlyIfStr.Multiline, @@ -125,7 +126,7 @@ internal fun String.qWithNewLinePrefix( return lineSeparator.value.repeat(numNewLine) + substring(nCount) } -// CallChain[size=13] = String.qWithNewLineSuffix() <-[Call]- String.qWithNewLineSurround() <-[Call] ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=6] = String.qWithNewLineSuffix() <-[Call]- String.qWithNewLineSurround() <-[Call]- ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun String.qWithNewLineSuffix(numNewLine: Int = 1, onlyIf: QOnlyIfStr = QOnlyIfStr.Multiline): String { if (!onlyIf.matches(this)) return this @@ -134,53 +135,53 @@ internal fun String.qWithNewLineSuffix(numNewLine: Int = 1, onlyIf: QOnlyIfStr = return substring(0, length - nCount) + "\n".repeat(numNewLine) } -// CallChain[size=12] = String.qWithNewLineSurround() <-[Call]- QMaskResult.toString() <-[Propag]- Q ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=5] = String.qWithNewLineSurround() <-[Call]- String.qBracketEnd() <-[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun String.qWithNewLineSurround(numNewLine: Int = 1, onlyIf: QOnlyIfStr = QOnlyIfStr.Multiline): String { if (!onlyIf.matches(this)) return this return qWithNewLinePrefix(numNewLine, QOnlyIfStr.Always).qWithNewLineSuffix(numNewLine, QOnlyIfStr.Always) } -// CallChain[size=5] = String.qWithSpacePrefix() <-[Call]- String.qBracketEnd() <-[Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=5] = String.qWithSpacePrefix() <-[Call]- String.qBracketEnd() <-[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun String.qWithSpacePrefix(numSpace: Int = 1, onlyIf: QOnlyIfStr = QOnlyIfStr.SingleLine): String { if (!onlyIf.matches(this)) return this return " ".repeat(numSpace) + this.trimStart() } -// CallChain[size=5] = String.qWithSpaceSuffix() <-[Call]- String.qBracketStartOrMiddle() <-[Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=5] = String.qWithSpaceSuffix() <-[Call]- String.qBracketStartOrMiddle() <-[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun String.qWithSpaceSuffix(numSpace: Int = 1, onlyIf: QOnlyIfStr = QOnlyIfStr.SingleLine): String { if (!onlyIf.matches(this)) return this return this.trimEnd() + " ".repeat(numSpace) } -// CallChain[size=10] = CharSequence.qEndsWith() <-[Call]- QFetchRule.SMART_FETCH <-[Call]- qLogStac ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=10] = CharSequence.qEndsWith() <-[Call]- QFetchRule.SMART_FETCH <-[Call]- qLogStac ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun CharSequence.qEndsWith(suffix: Regex, length: Int = 100): Boolean { return takeLast(min(length, this.length)).matches(suffix) } -// CallChain[size=13] = String.qIsMultiLine() <-[Call]- QOnlyIfStr.Multiline <-[Call]- QMaskResult.t ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=6] = String.qIsMultiLine() <-[Call]- String.qIsSingleLine() <-[Call]- String.qColo ... - String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun String.qIsMultiLine(): Boolean { return this.contains("\n") || this.contains("\r") } -// CallChain[size=5] = String.qIsSingleLine() <-[Call]- String.qColor() <-[Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=5] = String.qIsSingleLine() <-[Call]- String.qColor() <-[Call]- String.light_green <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun String.qIsSingleLine(): Boolean { return !this.qIsMultiLine() } -// CallChain[size=14] = QLineSeparator <-[Ref]- String.qWithNewLinePrefix() <-[Call]- String.qWithNe ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=7] = QLineSeparator <-[Ref]- String.qWithNewLinePrefix() <-[Call]- String.qWithNew ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal enum class QLineSeparator(val value: String) { - // CallChain[size=14] = QLineSeparator.LF <-[Call]- String.qWithNewLinePrefix() <-[Call]- String.qWi ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=7] = QLineSeparator.LF <-[Call]- String.qWithNewLinePrefix() <-[Call]- String.qWit ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] LF("\n"), - // CallChain[size=15] = QLineSeparator.CRLF <-[Propag]- QLineSeparator.QLineSeparator() <-[Call]- St ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=8] = QLineSeparator.CRLF <-[Propag]- QLineSeparator.QLineSeparator() <-[Call]- Str ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] CRLF("\r\n"), - // CallChain[size=15] = QLineSeparator.CR <-[Propag]- QLineSeparator.QLineSeparator() <-[Call]- Stri ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=8] = QLineSeparator.CR <-[Propag]- QLineSeparator.QLineSeparator() <-[Call]- Strin ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] CR("\r"); companion object { - // CallChain[size=13] = QLineSeparator.DEFAULT <-[Call]- Path.qLineSeparator() <-[Call]- Path.qFetch ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=13] = QLineSeparator.DEFAULT <-[Call]- Path.qLineSeparator() <-[Call]- Path.qFetch ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val DEFAULT = QLineSeparator.LF } } @@ -189,19 +190,19 @@ internal enum class QLineSeparator(val value: String) { internal fun String.qSubstring(rangeBothInclusive: IntRange): String = substring(rangeBothInclusive.first, rangeBothInclusive.last + 1) -// CallChain[size=10] = String.qCountLeftSpace() <-[Call]- QFetchRule.SMART_FETCH <-[Call]- qLogStac ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=10] = String.qCountLeftSpace() <-[Call]- QFetchRule.SMART_FETCH <-[Call]- qLogStac ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun String.qCountLeftSpace(): Int = takeWhile { it == ' ' }.count() // CallChain[size=11] = String.qCountRightSpace() <-[Call]- String.qMoveCenter() <-[Call]- QLineMatc ... <-[Call]- qSeparatorWithLabel() <-[Call]- qTestMethods() <-[Call]- qTest() <-[Call]- main()[Root] internal fun String.qCountRightSpace(): Int = takeLastWhile { it == ' ' }.count() -// CallChain[size=4] = qMASK_LENGTH_LIMIT <-[Call]- Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=4] = qMASK_LENGTH_LIMIT <-[Call]- Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal const val qMASK_LENGTH_LIMIT: Int = 100_000 -// CallChain[size=6] = QToString <-[Ref]- qToStringRegistry <-[Call]- Any?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=6] = QToString <-[Ref]- qToStringRegistry <-[Call]- Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal class QToString(val okToApply: (Any) -> Boolean, val toString: (Any) -> String) -// CallChain[size=5] = qToStringRegistry <-[Call]- Any?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=5] = qToStringRegistry <-[Call]- Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private val qToStringRegistry: MutableList by lazy { val toStrings = QMyToString::class.qFunctions( @@ -224,7 +225,7 @@ private val qToStringRegistry: MutableList by lazy { }.toMutableList() } -// CallChain[size=4] = Any?.qToString() <-[Call]- Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=4] = Any.qToString() <-[Call]- Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun Any?.qToString(): String { if (this == null) return "null".light_gray @@ -238,7 +239,7 @@ internal fun Any?.qToString(): String { return toString() } -// CallChain[size=3] = Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=3] = Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun Any?.qToLogString(maxLineLength: Int = 80): String { if (QMyLog.no_format) { return this.toString() @@ -281,12 +282,12 @@ internal fun Any?.qToLogString(maxLineLength: Int = 80): String { }.qClarifyEmptyOrBlank() } -// CallChain[size=4] = String.qClarifyEmptyOrBlank() <-[Call]- Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=4] = String.qClarifyEmptyOrBlank() <-[Call]- Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun String.qClarifyEmptyOrBlank(): String { return if (this.isEmpty()) { - "(EMPTY STRING)".qColor(QShColor.LIGHT_GRAY) + "(EMPTY STRING)".qColor(QShColor.LightGray) } else if (this.isBlank()) { - "$this(BLANK STRING)".qColor(QShColor.LIGHT_GRAY) + "$this(BLANK STRING)".qColor(QShColor.LightGray) } else { this } diff --git a/src-test-split/nyab/util/QStringAlign.kt b/src-test-split/nyab/util/QStringAlign.kt index 1960741..01cab26 100644 --- a/src-test-split/nyab/util/QStringAlign.kt +++ b/src-test-split/nyab/util/QStringAlign.kt @@ -186,7 +186,7 @@ internal class QLineMatchResult( } } -// CallChain[size=10] = qSize <-[Call]- QLineMatchResult.align() <-[Call]- String.qAlign() <-[Call]- ... <-[Call]- qSeparatorWithLabel() <-[Call]- qTestMethods() <-[Call]- qTest() <-[Call]- main()[Root] +// CallChain[size=10] = IntRange.qSize <-[Call]- QLineMatchResult.align() <-[Call]- String.qAlign() ... <-[Call]- qSeparatorWithLabel() <-[Call]- qTestMethods() <-[Call]- qTest() <-[Call]- main()[Root] private val IntRange.qSize: Int get() = abs(last - first) + 1 diff --git a/src-test-split/nyab/util/QStringMask.kt b/src-test-split/nyab/util/QStringMask.kt index bec548d..86ffaad 100644 --- a/src-test-split/nyab/util/QStringMask.kt +++ b/src-test-split/nyab/util/QStringMask.kt @@ -18,7 +18,7 @@ import kotlin.math.min // qq-tree is a self-contained single-file library created by nyabkun. // This is a split-file version of the library, this file is not self-contained. -// CallChain[size=10] = String.qCountOccurrence() <-[Call]- QFetchRule.SMART_FETCH <-[Call]- qLogSta ... [Call]- qBrackets() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=10] = String.qCountOccurrence() <-[Call]- QFetchRule.SMART_FETCH <-[Call]- qLogSta ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun String.qCountOccurrence(word: String): Int { return windowed(word.length) { if (it == word) @@ -28,13 +28,13 @@ internal fun String.qCountOccurrence(word: String): Int { }.sum() } -// CallChain[size=9] = QMask <-[Ref]- QMaskBetween <-[Call]- qMASK_COLORED <-[Call]- String.qApplyCo ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=7] = QMask <-[Ref]- QMaskBetween <-[Call]- QMask.DOUBLE_QUOTE <-[Call]- QMask.KOTL ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal interface QMask { - // CallChain[size=10] = QMask.apply() <-[Propag]- QMask <-[Ref]- QMaskBetween <-[Call]- qMASK_COLORE ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=5] = QMask.apply() <-[Propag]- QMask.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun apply(text: String): QMaskResult companion object { - // CallChain[size=5] = QMask.THREE_DOUBLE_QUOTES <-[Call]- QMask.KOTLIN_STRING <-[Call]- Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=5] = QMask.THREE_DOUBLE_QUOTES <-[Call]- QMask.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val THREE_DOUBLE_QUOTES by lazy { QMaskBetween( "\"\"\"", "\"\"\"", @@ -43,7 +43,7 @@ internal interface QMask { maskIncludeStartAndEndSequence = false, ) } - // CallChain[size=5] = QMask.DOUBLE_QUOTE <-[Call]- QMask.KOTLIN_STRING <-[Call]- Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=5] = QMask.DOUBLE_QUOTE <-[Call]- QMask.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val DOUBLE_QUOTE by lazy { QMaskBetween( "\"", "\"", @@ -52,21 +52,21 @@ internal interface QMask { maskIncludeStartAndEndSequence = false, ) } - // CallChain[size=4] = QMask.KOTLIN_STRING <-[Call]- Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=4] = QMask.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val KOTLIN_STRING by lazy { QMultiMask( THREE_DOUBLE_QUOTES, DOUBLE_QUOTE ) } - // CallChain[size=4] = QMask.PARENS <-[Call]- Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=4] = QMask.PARENS <-[Call]- Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val PARENS by lazy { QMaskBetween( "(", ")", nestStartSequence = "(", escapeChar = '\\' ) } - // CallChain[size=4] = QMask.INNER_BRACKETS <-[Call]- Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=4] = QMask.INNER_BRACKETS <-[Call]- Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val INNER_BRACKETS by lazy { QMaskBetween( "[", "]", @@ -80,17 +80,17 @@ internal interface QMask { } } -// CallChain[size=5] = QMultiMask <-[Call]- QMask.KOTLIN_STRING <-[Call]- Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=5] = QMultiMask <-[Call]- QMask.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal class QMultiMask(vararg mask: QMaskBetween) : QMask { - // CallChain[size=7] = QMultiMask.masks <-[Call]- QMultiMask.apply() <-[Propag]- QMultiMask <-[Call] ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=7] = QMultiMask.masks <-[Call]- QMultiMask.apply() <-[Propag]- QMultiMask <-[Call] ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val masks: Array - // CallChain[size=6] = QMultiMask.init { <-[Propag]- QMultiMask <-[Call]- QMask.KOTLIN_STRING <-[Call]- Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=6] = QMultiMask.init { <-[Propag]- QMultiMask <-[Call]- QMask.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] init { masks = arrayOf(*mask) } - // CallChain[size=6] = QMultiMask.apply() <-[Propag]- QMultiMask <-[Call]- QMask.KOTLIN_STRING <-[Ca ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=6] = QMultiMask.apply() <-[Propag]- QMultiMask <-[Call]- QMask.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun apply(text: String): QMaskResult { var result: QMaskResult? = null for (mask in masks) { @@ -101,7 +101,7 @@ internal class QMultiMask(vararg mask: QMaskBetween) : QMask { } } -// CallChain[size=8] = QMaskBetween <-[Call]- qMASK_COLORED <-[Call]- String.qApplyColorNestable() < ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=6] = QMaskBetween <-[Call]- QMask.DOUBLE_QUOTE <-[Call]- QMask.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal class QMaskBetween( val startSequence: String, val endSequence: String, @@ -120,12 +120,12 @@ internal class QMaskBetween( val maskChar: Char = '\uee31', ) : QMask { - // CallChain[size=9] = QMaskBetween.apply() <-[Propag]- QMaskBetween.QMaskBetween() <-[Ref]- qMASK_C ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=7] = QMaskBetween.apply() <-[Propag]- QMaskBetween.QMaskBetween() <-[Ref]- QMask.D ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun apply(text: String): QMaskResult { return applyMore(text, null) } - // CallChain[size=10] = QMaskBetween.applyMore() <-[Call]- QMaskBetween.apply() <-[Propag]- QMaskBet ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=8] = QMaskBetween.applyMore() <-[Call]- QMaskBetween.apply() <-[Propag]- QMaskBetw ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun applyMore(text: String, orgText: String? = null): QMaskResult { val regions = text.qFindBetween( startSequence, @@ -178,9 +178,9 @@ internal class QMaskBetween( } } -// CallChain[size=13] = QMutRegion <-[Ref]- QRegion.toMutRegion() <-[Propag]- QRegion.contains() <-[ ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=11] = QMutRegion <-[Ref]- QRegion.toMutRegion() <-[Propag]- QRegion.contains() <-[ ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal open class QMutRegion(override var start: Int, override var end: Int) : QRegion(start, end) { - // CallChain[size=14] = QMutRegion.intersectMut() <-[Propag]- QMutRegion <-[Ref]- QRegion.toMutRegio ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=12] = QMutRegion.intersectMut() <-[Propag]- QMutRegion <-[Ref]- QRegion.toMutRegio ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun intersectMut(region: QRegion) { val start = max(this.start, region.start) val end = min(this.end, region.end) @@ -191,39 +191,39 @@ internal open class QMutRegion(override var start: Int, override var end: Int) : } } - // CallChain[size=14] = QMutRegion.addOffset() <-[Propag]- QMutRegion <-[Ref]- QRegion.toMutRegion() ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=12] = QMutRegion.addOffset() <-[Propag]- QMutRegion <-[Ref]- QRegion.toMutRegion() ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun addOffset(offset: Int) { start += offset end += offset } - // CallChain[size=14] = QMutRegion.shift() <-[Propag]- QMutRegion <-[Ref]- QRegion.toMutRegion() <-[ ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=12] = QMutRegion.shift() <-[Propag]- QMutRegion <-[Ref]- QRegion.toMutRegion() <-[ ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun shift(length: Int) { this.start += length this.end += length } } -// CallChain[size=13] = QRegion <-[Ref]- QRegion.intersect() <-[Propag]- QRegion.contains() <-[Call] ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=11] = QRegion <-[Ref]- QRegion.intersect() <-[Propag]- QRegion.contains() <-[Call] ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] /** * [start] inclusive, [end] exclusive */ internal open class QRegion(open val start: Int, open val end: Int) { - // CallChain[size=12] = QRegion.toMutRegion() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween. ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=10] = QRegion.toMutRegion() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween. ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun toMutRegion(): QMutRegion { return QMutRegion(start, end) } - // CallChain[size=12] = QRegion.toRange() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.appl ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=10] = QRegion.toRange() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.appl ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun toRange(): IntRange { return IntRange(start, end + 1) } - // CallChain[size=12] = QRegion.length <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.applyMo ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=10] = QRegion.length <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.applyMo ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] val length: Int get() = end - start - // CallChain[size=12] = QRegion.intersect() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.ap ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=10] = QRegion.intersect() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.ap ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun intersect(region: QRegion): QRegion? { val start = max(this.start, region.start) val end = min(this.end, region.end) @@ -235,38 +235,38 @@ internal open class QRegion(open val start: Int, open val end: Int) { } } - // CallChain[size=11] = QRegion.contains() <-[Call]- QMaskBetween.applyMore() <-[Call]- QMaskBetween ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=9] = QRegion.contains() <-[Call]- QMaskBetween.applyMore() <-[Call]- QMaskBetween. ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun contains(idx: Int): Boolean { return idx in start until end } - // CallChain[size=12] = QRegion.cut() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.applyMor ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=10] = QRegion.cut() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.applyMor ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun cut(text: String): String { return text.substring(start, end) } - // CallChain[size=12] = QRegion.remove() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.apply ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=10] = QRegion.remove() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.apply ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun remove(text: String): String { return text.removeRange(start, end) } - // CallChain[size=12] = QRegion.replace() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.appl ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=10] = QRegion.replace() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.appl ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun replace(text: String, replacement: String): String { return text.replaceRange(start, end, replacement) } - // CallChain[size=12] = QRegion.mask() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.applyMo ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=10] = QRegion.mask() <-[Propag]- QRegion.contains() <-[Call]- QMaskBetween.applyMo ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun mask(text: String, maskChar: Char = '*'): String { return text.replaceRange(this.toRange(), maskChar.toString().repeat(end - start)) } } -// CallChain[size=9] = QReplacer <-[Ref]- String.qMaskAndReplace() <-[Call]- String.qMaskAndReplace( ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=6] = QReplacer <-[Ref]- String.qMaskAndReplace() <-[Call]- QMaskResult.replaceAndU ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal class QReplacer(start: Int, end: Int, val replacement: String) : QMutRegion(start, end) -// CallChain[size=10] = QMaskResult <-[Ref]- QMaskBetween.apply() <-[Propag]- QMaskBetween.QMaskBetw ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=6] = QMaskResult <-[Ref]- QMask.apply() <-[Propag]- QMask.KOTLIN_STRING <-[Call]- Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal class QMaskResult(val maskedStr: String, val orgText: String, val maskChar: Char) { - // CallChain[size=4] = QMaskResult.replaceAndUnmask() <-[Call]- Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=4] = QMaskResult.replaceAndUnmask() <-[Call]- Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] /** * Apply regex to masked string. * Apply replacement to original text. @@ -275,12 +275,12 @@ internal class QMaskResult(val maskedStr: String, val orgText: String, val maskC return orgText.qMaskAndReplace(maskedStr, ptn, replacement, findAll) } - // CallChain[size=7] = QMaskResult.applyMoreMask() <-[Call]- QMultiMask.apply() <-[Propag]- QMultiMa ... Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=7] = QMaskResult.applyMoreMask() <-[Call]- QMultiMask.apply() <-[Propag]- QMultiMa ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun applyMoreMask(mask: QMaskBetween): QMaskResult { return mask.applyMore(maskedStr, orgText) } - // CallChain[size=11] = QMaskResult.toString() <-[Propag]- QMaskResult <-[Ref]- QMaskBetween.apply() ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=7] = QMaskResult.toString() <-[Propag]- QMaskResult <-[Ref]- QMask.apply() <-[Prop ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] override fun toString(): String { val original = orgText.qWithNewLineSurround(onlyIf = QOnlyIfStr.Multiline) val masked = maskedStr.replace(maskChar, '*').qWithNewLineSurround(onlyIf = QOnlyIfStr.Multiline) @@ -289,7 +289,7 @@ internal class QMaskResult(val maskedStr: String, val orgText: String, val maskC } } -// CallChain[size=4] = CharSequence.qMask() <-[Call]- Any?.qToLogString() <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=4] = CharSequence.qMask() <-[Call]- Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun CharSequence.qMask(vararg mask: QMask): QMaskResult { mask.size.qaNotZero() @@ -309,7 +309,7 @@ internal fun CharSequence.qMask(vararg mask: QMask): QMaskResult { } } -// CallChain[size=11] = String.qFindBetween() <-[Call]- QMaskBetween.applyMore() <-[Call]- QMaskBetw ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=9] = String.qFindBetween() <-[Call]- QMaskBetween.applyMore() <-[Call]- QMaskBetwe ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun String.qFindBetween( startSequence: String, endSequence: String, @@ -336,7 +336,7 @@ internal fun String.qFindBetween( return finder.find(this) } -// CallChain[size=8] = String.qMaskAndReplace() <-[Call]- String.qMaskAndReplace() <-[Call]- String. ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=5] = String.qMaskAndReplace() <-[Call]- QMaskResult.replaceAndUnmask() <-[Call]- Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private fun String.qMaskAndReplace( maskedStr: String, ptn: Regex, @@ -370,19 +370,7 @@ private fun String.qMaskAndReplace( return qMultiReplace(replacers) } -// CallChain[size=7] = String.qMaskAndReplace() <-[Call]- String.qApplyColorNestable() <-[Call]- Str ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] -internal fun String.qMaskAndReplace( - mask: QMask, - ptn: Regex, - replacement: String = "$1", - replaceAll: Boolean = true, -): String { - val maskResult = mask.apply(this) - - return qMaskAndReplace(maskResult.maskedStr, ptn, replacement, replaceAll) -} - -// CallChain[size=9] = CharSequence.qMultiReplace() <-[Call]- String.qMaskAndReplace() <-[Call]- Str ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=6] = CharSequence.qMultiReplace() <-[Call]- String.qMaskAndReplace() <-[Call]- QMa ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] /** * currently does not support region overlap */ @@ -398,7 +386,7 @@ internal fun CharSequence.qMultiReplace(replacers: List): String { return sb.toString() } -// CallChain[size=9] = MatchResult.qResolveReplacementGroup() <-[Call]- String.qMaskAndReplace() <-[ ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=6] = MatchResult.qResolveReplacementGroup() <-[Call]- String.qMaskAndReplace() <-[ ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun MatchResult.qResolveReplacementGroup(replacement: String, orgText: String): String { var resolveGroup = replacement @@ -417,20 +405,20 @@ internal fun MatchResult.qResolveReplacementGroup(replacement: String, orgText: return resolveGroup } -// CallChain[size=10] = CharSequence.qReplace() <-[Call]- MatchResult.qResolveReplacementGroup() <-[ ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=7] = CharSequence.qReplace() <-[Call]- MatchResult.qResolveReplacementGroup() <-[C ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal fun CharSequence.qReplace(oldValue: String, newValue: String, escapeChar: Char): String { return replace(Regex("""(? 1 - // \n[\n] --> 2 + // [\n]abc\n --> lineNumber is 1 "First Line" + // \n[\n] --> lineNumber is 2 "Second Line" var lineBreakCount = 0 @@ -537,7 +527,7 @@ internal open class QCharReader(val text: CharSequence) { return lineBreakCount + 1 } - // CallChain[size=15] = QCharReader.countIndentSpaces() <-[Propag]- QCharReader <-[Call]- QSequenceR ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=13] = QCharReader.countIndentSpaces() <-[Propag]- QCharReader <-[Call]- QSequenceR ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun countIndentSpaces(space: Char = ' '): Int { var count = 0 @@ -574,56 +564,74 @@ internal open class QCharReader(val text: CharSequence) { return count } - // CallChain[size=15] = QCharReader.hasNextChar() <-[Propag]- QCharReader <-[Call]- QSequenceReader ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=13] = QCharReader.hasNextChar() <-[Propag]- QCharReader <-[Call]- QSequenceReader ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] inline fun hasNextChar(len: Int = 1): Boolean { return offset + len - 1 < text.length } - // CallChain[size=15] = QCharReader.isOffsetEOF() <-[Propag]- QCharReader <-[Call]- QSequenceReader ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=13] = QCharReader.isOffsetEOF() <-[Propag]- QCharReader <-[Call]- QSequenceReader ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] inline fun isOffsetEOF(): Boolean { return offset == text.length - 1 } - // CallChain[size=15] = QCharReader.isValidOffset() <-[Propag]- QCharReader <-[Call]- QSequenceReade ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=13] = QCharReader.isValidOffset() <-[Propag]- QCharReader <-[Call]- QSequenceReade ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] inline fun isValidOffset(): Boolean { return 0 <= offset && offset < text.length } - // CallChain[size=15] = QCharReader.hasPreviousChar() <-[Propag]- QCharReader <-[Call]- QSequenceRea ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=13] = QCharReader.hasPreviousChar() <-[Propag]- QCharReader <-[Call]- QSequenceRea ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] inline fun hasPreviousChar(len: Int = 1): Boolean { return 0 < offset - len + 1 } - // CallChain[size=15] = QCharReader.previousChar() <-[Propag]- QCharReader <-[Call]- QSequenceReader ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] - inline fun previousChar(len: Int = 1) { + // CallChain[size=13] = QCharReader.previousChar() <-[Propag]- QCharReader <-[Call]- QSequenceReader ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + inline fun previousChar(len: Int = 1): Char { offset -= len + return text[offset] } - // CallChain[size=15] = QCharReader.currentChar() <-[Propag]- QCharReader <-[Call]- QSequenceReader ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=13] = QCharReader.currentChar() <-[Propag]- QCharReader <-[Call]- QSequenceReader ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] inline fun currentChar(): Char { return text[offset] } - // CallChain[size=15] = QCharReader.peekNextChar() <-[Propag]- QCharReader <-[Call]- QSequenceReader ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] - fun peekNextChar(): Char { + // CallChain[size=13] = QCharReader.peekNextChar() <-[Propag]- QCharReader <-[Call]- QSequenceReader ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + inline fun peekNextChar(): Char { return text[offset] } - // CallChain[size=15] = QCharReader.moveOffset() <-[Propag]- QCharReader <-[Call]- QSequenceReader < ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=13] = QCharReader.moveOffset() <-[Propag]- QCharReader <-[Call]- QSequenceReader < ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] inline fun moveOffset(plus: Int = 1) { offset += plus } - // CallChain[size=15] = QCharReader.nextChar() <-[Propag]- QCharReader <-[Call]- QSequenceReader <-[ ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=13] = QCharReader.nextChar() <-[Propag]- QCharReader <-[Call]- QSequenceReader <-[ ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] /** * Read current offset char and add offset by 1. */ inline fun nextChar(): Char { return text[offset++] } + + // CallChain[size=13] = QCharReader.nextStringExcludingCurOffset() <-[Propag]- QCharReader <-[Call]- ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + fun nextStringExcludingCurOffset(length: Int): String { + val str = text.substring(offset + 1, (offset + 1 + length).coerceAtMost(text.length)) + offset += length + return str + } + + // CallChain[size=13] = QCharReader.peekNextStringIncludingCurOffset() <-[Propag]- QCharReader <-[Ca ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + fun peekNextStringIncludingCurOffset(length: Int): String { + return text.substring(offset, (offset + length).coerceAtMost(text.length)) + } + + // CallChain[size=13] = QCharReader.peekPreviousStringExcludingCurOffset() <-[Propag]- QCharReader < ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + fun peekPreviousStringExcludingCurOffset(length: Int): String { + return text.substring(offset - length, offset) + } } -// CallChain[size=12] = QBetween <-[Call]- String.qFindBetween() <-[Call]- QMaskBetween.applyMore() ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=10] = QBetween <-[Call]- String.qFindBetween() <-[Call]- QMaskBetween.applyMore() ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] private class QBetween( val startSequence: String, val endSequence: String, @@ -638,7 +646,7 @@ private class QBetween( val regionIncludeStartAndEndSequence: Boolean = false, ) { - // CallChain[size=12] = QBetween.find() <-[Call]- String.qFindBetween() <-[Call]- QMaskBetween.apply ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] + // CallChain[size=10] = QBetween.find() <-[Call]- String.qFindBetween() <-[Call]- QMaskBetween.apply ... - Any.qToLogString() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] fun find(text: CharSequence): List { val reader = QSequenceReader(text) diff --git a/src-test-split/nyab/util/QTime.kt b/src-test-split/nyab/util/QTime.kt index c75dae4..13a12ab 100644 --- a/src-test-split/nyab/util/QTime.kt +++ b/src-test-split/nyab/util/QTime.kt @@ -15,6 +15,6 @@ package nyab.util // qq-tree is a self-contained single-file library created by nyabkun. // This is a split-file version of the library, this file is not self-contained. -// CallChain[size=11] = qNow <-[Call]- qCacheItTimedThreadLocal() <-[Call]- qCacheItOneSecThreadLoca ... [Call]- light_green <-[Call]- Any?.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=11] = qNow <-[Call]- qCacheItTimedThreadLocal() <-[Call]- qCacheItOneSecThreadLoca ... -[Call]- qBrackets() <-[Call]- Any.shouldBe() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal val qNow: Long get() = System.currentTimeMillis() \ No newline at end of file diff --git a/src-test-split/nyab/util/QTreeNode.kt b/src-test-split/nyab/util/QTreeNode.kt index f148d7b..fdeced6 100644 --- a/src-test-split/nyab/util/QTreeNode.kt +++ b/src-test-split/nyab/util/QTreeNode.kt @@ -66,7 +66,7 @@ internal fun > N.hasCycle(): Boolean { return false } -// CallChain[size=4] = parent <-[Call]- N.add() <-[Call]- N.add() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=4] = N.parent <-[Call]- N.add() <-[Call]- N.add() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] internal var > N.parent: N? get() = this.qGetExPropOrNull("#parent") as N? @@ -84,7 +84,7 @@ internal var > N.parent: N? this.qSetExProp("#parent", value) } -// CallChain[size=5] = children <-[Call]- N.depthFirstRecursive() <-[Call]- N.descendants() <-[Call]- N.descendantsList() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] +// CallChain[size=5] = N.children <-[Call]- N.depthFirstRecursive() <-[Call]- N.descendants() <-[Call]- N.descendantsList() <-[Call]- QTreeNodeTest.testDepthFirstSearch()[Root] /** * Obtain the child nodes of this node. */ @@ -136,7 +136,7 @@ internal enum class QTreeStyle(val plus: String, val vert: String, val end: Stri */ internal fun > N.tree( style: QTreeStyle = QTreeStyle.UNICODE, - color: QShColor? = QShColor.LIGHT_YELLOW, + color: QShColor? = QShColor.LightYellow, visitChecker: HashSet = HashSet(), ): String { val hyphen = style.hyphen.repeat(3) @@ -145,6 +145,7 @@ internal fun > N.tree( this.mark(visitChecker) + // print root node sb += this.toTreeNodeString() + "\n" for (node in depthFirst().drop(1)) { diff --git a/stat.txt b/stat.txt new file mode 100644 index 0000000..8e449ef --- /dev/null +++ b/stat.txt @@ -0,0 +1,71 @@ +Version: v2023-06-02 + +# Public API [main] +N.fillTree() - ExtensionFunction +N.root() - ExtensionFunction +N.isRoot() - ExtensionFunction +N.hasCycle() - ExtensionFunction +N.depth() - ExtensionFunction +N.tree() - ExtensionFunction +N.descendants() - ExtensionFunction +N.add() - ExtensionFunction +N.add() - ExtensionFunction +N.add() - ExtensionFunction +N.newNode() - ExtensionFunction +N.ancestors() - ExtensionFunction +N.descendantsList() - ExtensionFunction +N.ancestorsList() - ExtensionFunction +N.isLeaf - ExtensionProperty +N.parent - ExtensionProperty +N.children - ExtensionProperty +QTreeNode - Class +QLazyTreeNode - Interface +QTreeNodeI - Interface +QTreeStyle - EnumClass +QSearchAlgo - EnumClass +QShColor (Chained) - EnumClass + +# single src file number of lines [main] +3140 +# split src file number of files [main] +23 +# number of marked nodes [main] +458 +# number of all nodes [main] +1217 +# number of root of chain nodes [main] +39 +# single src file number of lines [test] +4581 +# split src file number of files [test] +32 +# number of marked nodes [test] +650 +# number of all nodes [test] +1674 +# number of root of chain nodes [test] +9 + +# chain node hit count [main] + N.depthFirst() [KtNamedFunction] : 404 + QE.throwIt() [KtNamedFunction] : 400 +QException.QException() [KtPrimaryConstructor] : 272 +QException.printStackTrace() [KtNamedFunction] : 207 + QException.mySrcAndStack [KtProperty] : 206 + qLogStackFrames() [KtNamedFunction] : 163 + Any.qToLogString() [KtNamedFunction] : 124 + qMySrcLinesAtFrame() [KtNamedFunction] : 98 + qSrcFileLinesAtFrame() [KtNamedFunction] : 85 + QMask.KOTLIN_STRING [KtProperty] : 64 + +# chain node hit count [test] +QTreeNodeTest.testDepthFirstSearch() [KtNamedFunction] : 460 + Any.shouldBe() [KtNamedFunction] : 424 + qBrackets() [KtNamedFunction] : 238 + QE.throwItBrackets() [KtNamedFunction] : 214 + QException.QException() [KtPrimaryConstructor] : 212 + QException.printStackTrace() [KtNamedFunction] : 198 + QException.mySrcAndStack [KtProperty] : 197 + main() [KtNamedFunction] : 171 + qTest() [KtNamedFunction] : 170 + qLogStackFrames() [KtNamedFunction] : 156 \ No newline at end of file