-
-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* wip: better logger config * wip: better logger config * wip: better logger config * wip: better logger config * wip: better printing for plus-concatenated args * wip: best-match prefix search
- Loading branch information
Showing
37 changed files
with
1,034 additions
and
1,037 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...platform/src/main/scala/izumi/fundamentals/platform/strings/WildcardPrefixTreeTools.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package izumi.fundamentals.platform.strings | ||
|
||
import izumi.fundamentals.collections.WildcardPrefixTree | ||
import izumi.fundamentals.collections.WildcardPrefixTree.PathElement | ||
|
||
object WildcardPrefixTreeTools { | ||
implicit class WildcardPrefixTreeExt[K, V](tree: WildcardPrefixTree[K, V]) { | ||
def print: String = { | ||
print(Seq.empty, tree) | ||
} | ||
|
||
private def print(path: Seq[PathElement[K]], tree: WildcardPrefixTree[K, V]): String = { | ||
import izumi.fundamentals.preamble.* | ||
|
||
val pathRepr = if (path.isEmpty) { | ||
"/" | ||
} else { | ||
path.map { | ||
case PathElement.Value(value) => value.toString | ||
case PathElement.Wildcard => "*" | ||
}.last | ||
} | ||
|
||
val head = if (tree.values.isEmpty) { | ||
s"$pathRepr" | ||
} else { | ||
s"$pathRepr => ${tree.values.mkString(", ")}" | ||
} | ||
|
||
if (tree.children.isEmpty) { | ||
head | ||
} else { | ||
val sub = tree.children.map { case (p, t) => print(path :+ p, t) }.niceList(shift = "").shift(2) | ||
s"$head $sub" | ||
} | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.