From 6e7e1fe13ef832e78232b45c3cf828e37ecdbca6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Segovia=20C=C3=B3rdoba?= Date: Tue, 3 Dec 2024 17:56:32 +0100 Subject: [PATCH] Improve code --- kotlin-stdlib/api/android/kotlin-stdlib.api | 74 +-- kotlin-stdlib/api/jvm/kotlin-stdlib.api | 74 +-- kotlin-stdlib/api/kotlin-stdlib.api | 585 ------------------ .../javiersc/kotlin/stdlib/CharSequence.kt | 30 + .../stdlib/{Collections.kt => Iterable.kt} | 28 +- .../kotlin/com/javiersc/kotlin/stdlib/List.kt | 9 + .../com/javiersc/kotlin/stdlib/Strings.kt | 52 +- .../com/javiersc/kotlin/stdlib/graph/Graph.kt | 2 - .../javiersc/kotlin/stdlib/tree/TreeNode.kt | 1 - .../kotlin/stdlib/CharSequenceTest.kt | 98 +++ .../com/javiersc/kotlin/stdlib/StringsTest.kt | 76 +-- .../com/javiersc/kotlin/stdlib/Files.kt | 4 +- .../com/javiersc/kotlin/stdlib/FilesTest.kt | 3 +- kotlin-test-junit/api/kotlin-test-junit.api | 75 --- 14 files changed, 240 insertions(+), 871 deletions(-) delete mode 100644 kotlin-stdlib/api/kotlin-stdlib.api create mode 100644 kotlin-stdlib/common/main/kotlin/com/javiersc/kotlin/stdlib/CharSequence.kt rename kotlin-stdlib/common/main/kotlin/com/javiersc/kotlin/stdlib/{Collections.kt => Iterable.kt} (80%) create mode 100644 kotlin-stdlib/common/main/kotlin/com/javiersc/kotlin/stdlib/List.kt create mode 100644 kotlin-stdlib/common/test/kotlin/com/javiersc/kotlin/stdlib/CharSequenceTest.kt delete mode 100644 kotlin-test-junit/api/kotlin-test-junit.api diff --git a/kotlin-stdlib/api/android/kotlin-stdlib.api b/kotlin-stdlib/api/android/kotlin-stdlib.api index ab55cd48..f396f031 100644 --- a/kotlin-stdlib/api/android/kotlin-stdlib.api +++ b/kotlin-stdlib/api/android/kotlin-stdlib.api @@ -143,32 +143,14 @@ public final class com/javiersc/kotlin/stdlib/BooleanKt { public static final fun ifTrue (ZLkotlin/jvm/functions/Function0;)Z } -public final class com/javiersc/kotlin/stdlib/CollectionsKt { - public static final fun capitalize (Ljava/lang/String;)Ljava/lang/String; - public static final fun decapitalize (Ljava/lang/String;)Ljava/lang/String; - public static final fun eighth (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun eighthOrNull (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun fifth (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun fifthOrNull (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun forth (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun forthOrNull (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun getIndex (Ljava/lang/Iterable;I)Ljava/lang/Object; - public static final fun getIndexOrNull (Ljava/lang/Iterable;I)Ljava/lang/Object; - public static final fun ninth (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun ninthOrNull (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun penultimate (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun penultimateOrNull (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun removeDuplicateEmptyLines (Ljava/util/List;)Ljava/lang/String; - public static final fun second (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun secondOrNull (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun seventh (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun seventhOrNull (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun sixth (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun sixthOrNull (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun tenth (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun tenthOrNull (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun third (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun thirdOrNull (Ljava/lang/Iterable;)Ljava/lang/Object; +public final class com/javiersc/kotlin/stdlib/CharSequenceKt { + public static final fun endWithNewLine (Ljava/lang/CharSequence;)Ljava/lang/CharSequence; + public static final fun isNotNullNorBlank (Ljava/lang/CharSequence;)Z + public static final fun isNotNullNorEmpty (Ljava/lang/CharSequence;)Z + public static final fun notContain (Ljava/lang/CharSequence;Ljava/lang/CharSequence;Z)Z + public static final fun notContain (Ljava/lang/CharSequence;Lkotlin/text/Regex;)Z + public static synthetic fun notContain$default (Ljava/lang/CharSequence;Ljava/lang/CharSequence;ZILjava/lang/Object;)Z + public static final fun removeDuplicateEmptyLines (Ljava/lang/CharSequence;)Ljava/lang/CharSequence; } public abstract class com/javiersc/kotlin/stdlib/Either { @@ -235,21 +217,43 @@ public final class com/javiersc/kotlin/stdlib/IdentityKt { public static final fun identity (Ljava/lang/Object;)Ljava/lang/Object; } +public final class com/javiersc/kotlin/stdlib/IterableKt { + public static final fun eighth (Ljava/lang/Iterable;)Ljava/lang/Object; + public static final fun eighthOrNull (Ljava/lang/Iterable;)Ljava/lang/Object; + public static final fun fifth (Ljava/lang/Iterable;)Ljava/lang/Object; + public static final fun fifthOrNull (Ljava/lang/Iterable;)Ljava/lang/Object; + public static final fun forth (Ljava/lang/Iterable;)Ljava/lang/Object; + public static final fun forthOrNull (Ljava/lang/Iterable;)Ljava/lang/Object; + public static final fun getIndex (Ljava/lang/Iterable;I)Ljava/lang/Object; + public static final fun getIndexOrNull (Ljava/lang/Iterable;I)Ljava/lang/Object; + public static final fun ninth (Ljava/lang/Iterable;)Ljava/lang/Object; + public static final fun ninthOrNull (Ljava/lang/Iterable;)Ljava/lang/Object; + public static final fun penultimate (Ljava/lang/Iterable;)Ljava/lang/Object; + public static final fun penultimateOrNull (Ljava/lang/Iterable;)Ljava/lang/Object; + public static final fun second (Ljava/lang/Iterable;)Ljava/lang/Object; + public static final fun secondOrNull (Ljava/lang/Iterable;)Ljava/lang/Object; + public static final fun seventh (Ljava/lang/Iterable;)Ljava/lang/Object; + public static final fun seventhOrNull (Ljava/lang/Iterable;)Ljava/lang/Object; + public static final fun sixth (Ljava/lang/Iterable;)Ljava/lang/Object; + public static final fun sixthOrNull (Ljava/lang/Iterable;)Ljava/lang/Object; + public static final fun tenth (Ljava/lang/Iterable;)Ljava/lang/Object; + public static final fun tenthOrNull (Ljava/lang/Iterable;)Ljava/lang/Object; + public static final fun third (Ljava/lang/Iterable;)Ljava/lang/Object; + public static final fun thirdOrNull (Ljava/lang/Iterable;)Ljava/lang/Object; +} + +public final class com/javiersc/kotlin/stdlib/ListKt { + public static final fun removeDuplicateEmptyLines (Ljava/util/List;)Ljava/lang/String; +} + public final class com/javiersc/kotlin/stdlib/StringsKt { - public static final fun endWithNewLine (Ljava/lang/String;)Ljava/lang/String; + public static final fun capitalize (Ljava/lang/String;)Ljava/lang/String; + public static final fun decapitalize (Ljava/lang/String;)Ljava/lang/String; public static final fun getEmpty (Lkotlin/jvm/internal/StringCompanionObject;)Ljava/lang/String; - public static final fun isNotNullNorBlank (Ljava/lang/CharSequence;)Z - public static final fun isNotNullNorBlank (Ljava/lang/String;)Z - public static final fun isNotNullNorEmpty (Ljava/lang/CharSequence;)Z - public static final fun isNotNullNorEmpty (Ljava/lang/String;)Z - public static final fun notContain (Ljava/lang/CharSequence;Ljava/lang/CharSequence;Z)Z - public static final fun notContain (Ljava/lang/CharSequence;Lkotlin/text/Regex;)Z - public static synthetic fun notContain$default (Ljava/lang/CharSequence;Ljava/lang/CharSequence;ZILjava/lang/Object;)Z public static final fun remove (Ljava/lang/String;Ljava/lang/String;Z)Ljava/lang/String; public static final fun remove (Ljava/lang/String;[Ljava/lang/String;Z)Ljava/lang/String; public static synthetic fun remove$default (Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Ljava/lang/String; public static synthetic fun remove$default (Ljava/lang/String;[Ljava/lang/String;ZILjava/lang/Object;)Ljava/lang/String; - public static final fun removeDuplicateEmptyLines (Ljava/lang/String;)Ljava/lang/String; public static final fun removeIf (Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Ljava/lang/String; public static synthetic fun removeIf$default (Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/String; public static final fun replace (Ljava/lang/String;[Lkotlin/Pair;)Ljava/lang/String; diff --git a/kotlin-stdlib/api/jvm/kotlin-stdlib.api b/kotlin-stdlib/api/jvm/kotlin-stdlib.api index 79b38de0..3b128c58 100644 --- a/kotlin-stdlib/api/jvm/kotlin-stdlib.api +++ b/kotlin-stdlib/api/jvm/kotlin-stdlib.api @@ -143,32 +143,14 @@ public final class com/javiersc/kotlin/stdlib/BooleanKt { public static final fun ifTrue (ZLkotlin/jvm/functions/Function0;)Z } -public final class com/javiersc/kotlin/stdlib/CollectionsKt { - public static final fun capitalize (Ljava/lang/String;)Ljava/lang/String; - public static final fun decapitalize (Ljava/lang/String;)Ljava/lang/String; - public static final fun eighth (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun eighthOrNull (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun fifth (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun fifthOrNull (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun forth (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun forthOrNull (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun getIndex (Ljava/lang/Iterable;I)Ljava/lang/Object; - public static final fun getIndexOrNull (Ljava/lang/Iterable;I)Ljava/lang/Object; - public static final fun ninth (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun ninthOrNull (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun penultimate (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun penultimateOrNull (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun removeDuplicateEmptyLines (Ljava/util/List;)Ljava/lang/String; - public static final fun second (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun secondOrNull (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun seventh (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun seventhOrNull (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun sixth (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun sixthOrNull (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun tenth (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun tenthOrNull (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun third (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun thirdOrNull (Ljava/lang/Iterable;)Ljava/lang/Object; +public final class com/javiersc/kotlin/stdlib/CharSequenceKt { + public static final fun endWithNewLine (Ljava/lang/CharSequence;)Ljava/lang/CharSequence; + public static final fun isNotNullNorBlank (Ljava/lang/CharSequence;)Z + public static final fun isNotNullNorEmpty (Ljava/lang/CharSequence;)Z + public static final fun notContain (Ljava/lang/CharSequence;Ljava/lang/CharSequence;Z)Z + public static final fun notContain (Ljava/lang/CharSequence;Lkotlin/text/Regex;)Z + public static synthetic fun notContain$default (Ljava/lang/CharSequence;Ljava/lang/CharSequence;ZILjava/lang/Object;)Z + public static final fun removeDuplicateEmptyLines (Ljava/lang/CharSequence;)Ljava/lang/CharSequence; } public class com/javiersc/kotlin/stdlib/DirScope : com/javiersc/kotlin/stdlib/FileScope { @@ -258,21 +240,43 @@ public final class com/javiersc/kotlin/stdlib/IdentityKt { public static final fun identity (Ljava/lang/Object;)Ljava/lang/Object; } +public final class com/javiersc/kotlin/stdlib/IterableKt { + public static final fun eighth (Ljava/lang/Iterable;)Ljava/lang/Object; + public static final fun eighthOrNull (Ljava/lang/Iterable;)Ljava/lang/Object; + public static final fun fifth (Ljava/lang/Iterable;)Ljava/lang/Object; + public static final fun fifthOrNull (Ljava/lang/Iterable;)Ljava/lang/Object; + public static final fun forth (Ljava/lang/Iterable;)Ljava/lang/Object; + public static final fun forthOrNull (Ljava/lang/Iterable;)Ljava/lang/Object; + public static final fun getIndex (Ljava/lang/Iterable;I)Ljava/lang/Object; + public static final fun getIndexOrNull (Ljava/lang/Iterable;I)Ljava/lang/Object; + public static final fun ninth (Ljava/lang/Iterable;)Ljava/lang/Object; + public static final fun ninthOrNull (Ljava/lang/Iterable;)Ljava/lang/Object; + public static final fun penultimate (Ljava/lang/Iterable;)Ljava/lang/Object; + public static final fun penultimateOrNull (Ljava/lang/Iterable;)Ljava/lang/Object; + public static final fun second (Ljava/lang/Iterable;)Ljava/lang/Object; + public static final fun secondOrNull (Ljava/lang/Iterable;)Ljava/lang/Object; + public static final fun seventh (Ljava/lang/Iterable;)Ljava/lang/Object; + public static final fun seventhOrNull (Ljava/lang/Iterable;)Ljava/lang/Object; + public static final fun sixth (Ljava/lang/Iterable;)Ljava/lang/Object; + public static final fun sixthOrNull (Ljava/lang/Iterable;)Ljava/lang/Object; + public static final fun tenth (Ljava/lang/Iterable;)Ljava/lang/Object; + public static final fun tenthOrNull (Ljava/lang/Iterable;)Ljava/lang/Object; + public static final fun third (Ljava/lang/Iterable;)Ljava/lang/Object; + public static final fun thirdOrNull (Ljava/lang/Iterable;)Ljava/lang/Object; +} + +public final class com/javiersc/kotlin/stdlib/ListKt { + public static final fun removeDuplicateEmptyLines (Ljava/util/List;)Ljava/lang/String; +} + public final class com/javiersc/kotlin/stdlib/StringsKt { - public static final fun endWithNewLine (Ljava/lang/String;)Ljava/lang/String; + public static final fun capitalize (Ljava/lang/String;)Ljava/lang/String; + public static final fun decapitalize (Ljava/lang/String;)Ljava/lang/String; public static final fun getEmpty (Lkotlin/jvm/internal/StringCompanionObject;)Ljava/lang/String; - public static final fun isNotNullNorBlank (Ljava/lang/CharSequence;)Z - public static final fun isNotNullNorBlank (Ljava/lang/String;)Z - public static final fun isNotNullNorEmpty (Ljava/lang/CharSequence;)Z - public static final fun isNotNullNorEmpty (Ljava/lang/String;)Z - public static final fun notContain (Ljava/lang/CharSequence;Ljava/lang/CharSequence;Z)Z - public static final fun notContain (Ljava/lang/CharSequence;Lkotlin/text/Regex;)Z - public static synthetic fun notContain$default (Ljava/lang/CharSequence;Ljava/lang/CharSequence;ZILjava/lang/Object;)Z public static final fun remove (Ljava/lang/String;Ljava/lang/String;Z)Ljava/lang/String; public static final fun remove (Ljava/lang/String;[Ljava/lang/String;Z)Ljava/lang/String; public static synthetic fun remove$default (Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Ljava/lang/String; public static synthetic fun remove$default (Ljava/lang/String;[Ljava/lang/String;ZILjava/lang/Object;)Ljava/lang/String; - public static final fun removeDuplicateEmptyLines (Ljava/lang/String;)Ljava/lang/String; public static final fun removeIf (Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Ljava/lang/String; public static synthetic fun removeIf$default (Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/String; public static final fun replace (Ljava/lang/String;[Lkotlin/Pair;)Ljava/lang/String; diff --git a/kotlin-stdlib/api/kotlin-stdlib.api b/kotlin-stdlib/api/kotlin-stdlib.api deleted file mode 100644 index 79b38de0..00000000 --- a/kotlin-stdlib/api/kotlin-stdlib.api +++ /dev/null @@ -1,585 +0,0 @@ -public abstract class com/javiersc/kotlin/stdlib/AnsiColor { - public abstract fun getValue ()Ljava/lang/String; - public fun toString ()Ljava/lang/String; -} - -public abstract class com/javiersc/kotlin/stdlib/AnsiColor$Background : com/javiersc/kotlin/stdlib/AnsiColor { -} - -public final class com/javiersc/kotlin/stdlib/AnsiColor$Background$Black : com/javiersc/kotlin/stdlib/AnsiColor$Background { - public static final field INSTANCE Lcom/javiersc/kotlin/stdlib/AnsiColor$Background$Black; - public fun getValue ()Ljava/lang/String; -} - -public final class com/javiersc/kotlin/stdlib/AnsiColor$Background$Blue : com/javiersc/kotlin/stdlib/AnsiColor$Background { - public static final field INSTANCE Lcom/javiersc/kotlin/stdlib/AnsiColor$Background$Blue; - public fun getValue ()Ljava/lang/String; -} - -public final class com/javiersc/kotlin/stdlib/AnsiColor$Background$Cyan : com/javiersc/kotlin/stdlib/AnsiColor$Background { - public static final field INSTANCE Lcom/javiersc/kotlin/stdlib/AnsiColor$Background$Cyan; - public fun getValue ()Ljava/lang/String; -} - -public final class com/javiersc/kotlin/stdlib/AnsiColor$Background$Gray : com/javiersc/kotlin/stdlib/AnsiColor$Background { - public static final field INSTANCE Lcom/javiersc/kotlin/stdlib/AnsiColor$Background$Gray; - public fun getValue ()Ljava/lang/String; -} - -public final class com/javiersc/kotlin/stdlib/AnsiColor$Background$Green : com/javiersc/kotlin/stdlib/AnsiColor$Background { - public static final field INSTANCE Lcom/javiersc/kotlin/stdlib/AnsiColor$Background$Green; - public fun getValue ()Ljava/lang/String; -} - -public final class com/javiersc/kotlin/stdlib/AnsiColor$Background$Purple : com/javiersc/kotlin/stdlib/AnsiColor$Background { - public static final field INSTANCE Lcom/javiersc/kotlin/stdlib/AnsiColor$Background$Purple; - public fun getValue ()Ljava/lang/String; -} - -public final class com/javiersc/kotlin/stdlib/AnsiColor$Background$Red : com/javiersc/kotlin/stdlib/AnsiColor$Background { - public static final field INSTANCE Lcom/javiersc/kotlin/stdlib/AnsiColor$Background$Red; - public fun getValue ()Ljava/lang/String; -} - -public final class com/javiersc/kotlin/stdlib/AnsiColor$Background$Yellow : com/javiersc/kotlin/stdlib/AnsiColor$Background { - public static final field INSTANCE Lcom/javiersc/kotlin/stdlib/AnsiColor$Background$Yellow; - public fun getValue ()Ljava/lang/String; -} - -public abstract class com/javiersc/kotlin/stdlib/AnsiColor$Foreground : com/javiersc/kotlin/stdlib/AnsiColor { -} - -public final class com/javiersc/kotlin/stdlib/AnsiColor$Foreground$Black : com/javiersc/kotlin/stdlib/AnsiColor$Foreground { - public static final field INSTANCE Lcom/javiersc/kotlin/stdlib/AnsiColor$Foreground$Black; - public fun getValue ()Ljava/lang/String; -} - -public final class com/javiersc/kotlin/stdlib/AnsiColor$Foreground$Blue : com/javiersc/kotlin/stdlib/AnsiColor$Foreground { - public static final field INSTANCE Lcom/javiersc/kotlin/stdlib/AnsiColor$Foreground$Blue; - public fun getValue ()Ljava/lang/String; -} - -public final class com/javiersc/kotlin/stdlib/AnsiColor$Foreground$BrightBlack : com/javiersc/kotlin/stdlib/AnsiColor$Foreground { - public static final field INSTANCE Lcom/javiersc/kotlin/stdlib/AnsiColor$Foreground$BrightBlack; - public fun getValue ()Ljava/lang/String; -} - -public final class com/javiersc/kotlin/stdlib/AnsiColor$Foreground$BrightBlue : com/javiersc/kotlin/stdlib/AnsiColor$Foreground { - public static final field INSTANCE Lcom/javiersc/kotlin/stdlib/AnsiColor$Foreground$BrightBlue; - public fun getValue ()Ljava/lang/String; -} - -public final class com/javiersc/kotlin/stdlib/AnsiColor$Foreground$BrightCyan : com/javiersc/kotlin/stdlib/AnsiColor$Foreground { - public static final field INSTANCE Lcom/javiersc/kotlin/stdlib/AnsiColor$Foreground$BrightCyan; - public fun getValue ()Ljava/lang/String; -} - -public final class com/javiersc/kotlin/stdlib/AnsiColor$Foreground$BrightGreen : com/javiersc/kotlin/stdlib/AnsiColor$Foreground { - public static final field INSTANCE Lcom/javiersc/kotlin/stdlib/AnsiColor$Foreground$BrightGreen; - public fun getValue ()Ljava/lang/String; -} - -public final class com/javiersc/kotlin/stdlib/AnsiColor$Foreground$BrightPurple : com/javiersc/kotlin/stdlib/AnsiColor$Foreground { - public static final field INSTANCE Lcom/javiersc/kotlin/stdlib/AnsiColor$Foreground$BrightPurple; - public fun getValue ()Ljava/lang/String; -} - -public final class com/javiersc/kotlin/stdlib/AnsiColor$Foreground$BrightRed : com/javiersc/kotlin/stdlib/AnsiColor$Foreground { - public static final field INSTANCE Lcom/javiersc/kotlin/stdlib/AnsiColor$Foreground$BrightRed; - public fun getValue ()Ljava/lang/String; -} - -public final class com/javiersc/kotlin/stdlib/AnsiColor$Foreground$BrightWhite : com/javiersc/kotlin/stdlib/AnsiColor$Foreground { - public static final field INSTANCE Lcom/javiersc/kotlin/stdlib/AnsiColor$Foreground$BrightWhite; - public fun getValue ()Ljava/lang/String; -} - -public final class com/javiersc/kotlin/stdlib/AnsiColor$Foreground$BrightYellow : com/javiersc/kotlin/stdlib/AnsiColor$Foreground { - public static final field INSTANCE Lcom/javiersc/kotlin/stdlib/AnsiColor$Foreground$BrightYellow; - public fun getValue ()Ljava/lang/String; -} - -public final class com/javiersc/kotlin/stdlib/AnsiColor$Foreground$Cyan : com/javiersc/kotlin/stdlib/AnsiColor$Foreground { - public static final field INSTANCE Lcom/javiersc/kotlin/stdlib/AnsiColor$Foreground$Cyan; - public fun getValue ()Ljava/lang/String; -} - -public final class com/javiersc/kotlin/stdlib/AnsiColor$Foreground$Green : com/javiersc/kotlin/stdlib/AnsiColor$Foreground { - public static final field INSTANCE Lcom/javiersc/kotlin/stdlib/AnsiColor$Foreground$Green; - public fun getValue ()Ljava/lang/String; -} - -public final class com/javiersc/kotlin/stdlib/AnsiColor$Foreground$Purple : com/javiersc/kotlin/stdlib/AnsiColor$Foreground { - public static final field INSTANCE Lcom/javiersc/kotlin/stdlib/AnsiColor$Foreground$Purple; - public fun getValue ()Ljava/lang/String; -} - -public final class com/javiersc/kotlin/stdlib/AnsiColor$Foreground$Red : com/javiersc/kotlin/stdlib/AnsiColor$Foreground { - public static final field INSTANCE Lcom/javiersc/kotlin/stdlib/AnsiColor$Foreground$Red; - public fun getValue ()Ljava/lang/String; -} - -public final class com/javiersc/kotlin/stdlib/AnsiColor$Foreground$White : com/javiersc/kotlin/stdlib/AnsiColor$Foreground { - public static final field INSTANCE Lcom/javiersc/kotlin/stdlib/AnsiColor$Foreground$White; - public fun getValue ()Ljava/lang/String; -} - -public final class com/javiersc/kotlin/stdlib/AnsiColor$Foreground$Yellow : com/javiersc/kotlin/stdlib/AnsiColor$Foreground { - public static final field INSTANCE Lcom/javiersc/kotlin/stdlib/AnsiColor$Foreground$Yellow; - public fun getValue ()Ljava/lang/String; -} - -public final class com/javiersc/kotlin/stdlib/AnsiColor$Reset : com/javiersc/kotlin/stdlib/AnsiColor { - public static final field INSTANCE Lcom/javiersc/kotlin/stdlib/AnsiColor$Reset; - public fun getValue ()Ljava/lang/String; -} - -public final class com/javiersc/kotlin/stdlib/AnsiColorsKt { - public static final fun ansiColor (Ljava/lang/String;Lcom/javiersc/kotlin/stdlib/AnsiColor;)Ljava/lang/String; -} - -public final class com/javiersc/kotlin/stdlib/BooleanKt { - public static final fun ifFalse (ZLkotlin/jvm/functions/Function0;)Z - public static final fun ifTrue (ZLkotlin/jvm/functions/Function0;)Z -} - -public final class com/javiersc/kotlin/stdlib/CollectionsKt { - public static final fun capitalize (Ljava/lang/String;)Ljava/lang/String; - public static final fun decapitalize (Ljava/lang/String;)Ljava/lang/String; - public static final fun eighth (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun eighthOrNull (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun fifth (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun fifthOrNull (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun forth (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun forthOrNull (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun getIndex (Ljava/lang/Iterable;I)Ljava/lang/Object; - public static final fun getIndexOrNull (Ljava/lang/Iterable;I)Ljava/lang/Object; - public static final fun ninth (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun ninthOrNull (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun penultimate (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun penultimateOrNull (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun removeDuplicateEmptyLines (Ljava/util/List;)Ljava/lang/String; - public static final fun second (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun secondOrNull (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun seventh (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun seventhOrNull (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun sixth (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun sixthOrNull (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun tenth (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun tenthOrNull (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun third (Ljava/lang/Iterable;)Ljava/lang/Object; - public static final fun thirdOrNull (Ljava/lang/Iterable;)Ljava/lang/Object; -} - -public class com/javiersc/kotlin/stdlib/DirScope : com/javiersc/kotlin/stdlib/FileScope { - public fun (Ljava/io/File;)V - public final fun dir (Ljava/lang/String;Lkotlin/jvm/functions/Function1;)Lcom/javiersc/kotlin/stdlib/DirScope; - public static synthetic fun dir$default (Lcom/javiersc/kotlin/stdlib/DirScope;Ljava/lang/String;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lcom/javiersc/kotlin/stdlib/DirScope; -} - -public abstract class com/javiersc/kotlin/stdlib/Either { - public final fun fold (Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; - public final fun getOrNull ()Ljava/lang/Object; - public final fun isLeft ()Z - public final fun isLeft (Lkotlin/jvm/functions/Function1;)Z - public final fun isRight ()Z - public final fun isRight (Lkotlin/jvm/functions/Function1;)Z - public final fun leftOrNull ()Ljava/lang/Object; - public final fun map (Lkotlin/jvm/functions/Function1;)Lcom/javiersc/kotlin/stdlib/Either; - public final fun mapLeft (Lkotlin/jvm/functions/Function1;)Lcom/javiersc/kotlin/stdlib/Either; - public final fun onLeft (Lkotlin/jvm/functions/Function1;)Lcom/javiersc/kotlin/stdlib/Either; - public final fun onRight (Lkotlin/jvm/functions/Function1;)Lcom/javiersc/kotlin/stdlib/Either; - public final fun swap ()Lcom/javiersc/kotlin/stdlib/Either; - public fun toString ()Ljava/lang/String; -} - -public final class com/javiersc/kotlin/stdlib/Either$Left : com/javiersc/kotlin/stdlib/Either { - public static final field Companion Lcom/javiersc/kotlin/stdlib/Either$Left$Companion; - public fun (Ljava/lang/Object;)V - public final fun component1 ()Ljava/lang/Object; - public final fun copy (Ljava/lang/Object;)Lcom/javiersc/kotlin/stdlib/Either$Left; - public static synthetic fun copy$default (Lcom/javiersc/kotlin/stdlib/Either$Left;Ljava/lang/Object;ILjava/lang/Object;)Lcom/javiersc/kotlin/stdlib/Either$Left; - public fun equals (Ljava/lang/Object;)Z - public final fun getValue ()Ljava/lang/Object; - public fun hashCode ()I - public fun toString ()Ljava/lang/String; -} - -public final class com/javiersc/kotlin/stdlib/Either$Left$Companion { -} - -public final class com/javiersc/kotlin/stdlib/Either$Right : com/javiersc/kotlin/stdlib/Either { - public static final field Companion Lcom/javiersc/kotlin/stdlib/Either$Right$Companion; - public fun (Ljava/lang/Object;)V - public final fun component1 ()Ljava/lang/Object; - public final fun copy (Ljava/lang/Object;)Lcom/javiersc/kotlin/stdlib/Either$Right; - public static synthetic fun copy$default (Lcom/javiersc/kotlin/stdlib/Either$Right;Ljava/lang/Object;ILjava/lang/Object;)Lcom/javiersc/kotlin/stdlib/Either$Right; - public fun equals (Ljava/lang/Object;)Z - public final fun getValue ()Ljava/lang/Object; - public fun hashCode ()I - public fun toString ()Ljava/lang/String; -} - -public final class com/javiersc/kotlin/stdlib/Either$Right$Companion { -} - -public final class com/javiersc/kotlin/stdlib/EitherKt { - public static final fun combine (Lcom/javiersc/kotlin/stdlib/Either;Lcom/javiersc/kotlin/stdlib/Either;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;)Lcom/javiersc/kotlin/stdlib/Either; - public static final fun compareTo (Lcom/javiersc/kotlin/stdlib/Either;Lcom/javiersc/kotlin/stdlib/Either;)I - public static final fun flatMap (Lcom/javiersc/kotlin/stdlib/Either;Lkotlin/jvm/functions/Function1;)Lcom/javiersc/kotlin/stdlib/Either; - public static final fun flatten (Lcom/javiersc/kotlin/stdlib/Either;)Lcom/javiersc/kotlin/stdlib/Either; - public static final fun getOrElse (Lcom/javiersc/kotlin/stdlib/Either;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; - public static final fun handleErrorWith (Lcom/javiersc/kotlin/stdlib/Either;Lkotlin/jvm/functions/Function1;)Lcom/javiersc/kotlin/stdlib/Either; - public static final fun left (Ljava/lang/Object;)Lcom/javiersc/kotlin/stdlib/Either; - public static final fun leftNel (Ljava/lang/Object;)Lcom/javiersc/kotlin/stdlib/Either; - public static final fun merge (Lcom/javiersc/kotlin/stdlib/Either;)Ljava/lang/Object; - public static final fun right (Ljava/lang/Object;)Lcom/javiersc/kotlin/stdlib/Either; - public static final fun toEitherNel (Lcom/javiersc/kotlin/stdlib/Either;)Lcom/javiersc/kotlin/stdlib/Either; -} - -public class com/javiersc/kotlin/stdlib/FileScope : java/io/File { - public fun (Ljava/io/File;)V - public final fun file (Ljava/lang/String;Lkotlin/jvm/functions/Function1;)Lcom/javiersc/kotlin/stdlib/FileScope; - public static synthetic fun file$default (Lcom/javiersc/kotlin/stdlib/FileScope;Ljava/lang/String;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lcom/javiersc/kotlin/stdlib/FileScope; -} - -public abstract interface annotation class com/javiersc/kotlin/stdlib/FileScopeMarker : java/lang/annotation/Annotation { -} - -public final class com/javiersc/kotlin/stdlib/FilesKt { - public static final fun getChildren (Ljava/io/File;)Lkotlin/sequences/Sequence; - public static final fun resource (Ljava/lang/String;)Ljava/io/File; - public static final fun resourceOrNull (Ljava/lang/String;)Ljava/io/File; - public static final fun root (Ljava/io/File;Ljava/lang/String;Lkotlin/jvm/functions/Function1;)Lcom/javiersc/kotlin/stdlib/DirScope; - public static synthetic fun root$default (Ljava/io/File;Ljava/lang/String;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lcom/javiersc/kotlin/stdlib/DirScope; -} - -public final class com/javiersc/kotlin/stdlib/IdentityKt { - public static final fun identity (Ljava/lang/Object;)Ljava/lang/Object; -} - -public final class com/javiersc/kotlin/stdlib/StringsKt { - public static final fun endWithNewLine (Ljava/lang/String;)Ljava/lang/String; - public static final fun getEmpty (Lkotlin/jvm/internal/StringCompanionObject;)Ljava/lang/String; - public static final fun isNotNullNorBlank (Ljava/lang/CharSequence;)Z - public static final fun isNotNullNorBlank (Ljava/lang/String;)Z - public static final fun isNotNullNorEmpty (Ljava/lang/CharSequence;)Z - public static final fun isNotNullNorEmpty (Ljava/lang/String;)Z - public static final fun notContain (Ljava/lang/CharSequence;Ljava/lang/CharSequence;Z)Z - public static final fun notContain (Ljava/lang/CharSequence;Lkotlin/text/Regex;)Z - public static synthetic fun notContain$default (Ljava/lang/CharSequence;Ljava/lang/CharSequence;ZILjava/lang/Object;)Z - public static final fun remove (Ljava/lang/String;Ljava/lang/String;Z)Ljava/lang/String; - public static final fun remove (Ljava/lang/String;[Ljava/lang/String;Z)Ljava/lang/String; - public static synthetic fun remove$default (Ljava/lang/String;Ljava/lang/String;ZILjava/lang/Object;)Ljava/lang/String; - public static synthetic fun remove$default (Ljava/lang/String;[Ljava/lang/String;ZILjava/lang/Object;)Ljava/lang/String; - public static final fun removeDuplicateEmptyLines (Ljava/lang/String;)Ljava/lang/String; - public static final fun removeIf (Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;)Ljava/lang/String; - public static synthetic fun removeIf$default (Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/lang/String; - public static final fun replace (Ljava/lang/String;[Lkotlin/Pair;)Ljava/lang/String; -} - -public final class com/javiersc/kotlin/stdlib/StringsTransformKt { - public static final fun TRANSFORMSTRING (Ljava/lang/String;)Ljava/lang/String; - public static final fun TRANSFORM_HYPHEN_STRING (Ljava/lang/String;)Ljava/lang/String; - public static final fun TRANSFORM_STRING (Ljava/lang/String;)Ljava/lang/String; - public static final fun TransformString (Ljava/lang/String;)Ljava/lang/String; - public static final fun tRaNsFoRmStRiNg (Ljava/lang/String;)Ljava/lang/String; - public static final fun transformString (Ljava/lang/String;)Ljava/lang/String; - public static final fun transform_hyphen_string (Ljava/lang/String;)Ljava/lang/String; - public static final fun transform_string (Ljava/lang/String;)Ljava/lang/String; - public static final fun transformstring (Ljava/lang/String;)Ljava/lang/String; -} - -public final class com/javiersc/kotlin/stdlib/TKt { - public static final fun ifNotNull (Ljava/lang/Object;Lkotlin/jvm/functions/Function0;)Ljava/lang/Object; - public static final fun ifNull (Ljava/lang/Object;Lkotlin/jvm/functions/Function0;)Ljava/lang/Object; - public static final fun or (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public static final fun or (Ljava/lang/Object;Lkotlin/jvm/functions/Function0;)Ljava/lang/Object; -} - -public abstract interface class com/javiersc/kotlin/stdlib/graph/Graph : java/util/Map, kotlin/jvm/internal/markers/KMappedMarker { - public abstract fun asString ()Ljava/lang/String; - public abstract fun contains (Ljava/lang/Object;)Z - public abstract fun contains (Ljava/lang/Object;Lkotlin/jvm/functions/Function1;)Z - public abstract fun containsCircularVertexes (Ljava/lang/Object;)Z - public abstract fun doesNotContainsCircularVertexes (Ljava/lang/Object;)Z - public abstract fun getCircularVertexes ()Ljava/util/Map; - public abstract fun getDuplicatedVertexes ()Ljava/util/Map; - public abstract fun getHasCircularVertexes ()Z - public abstract fun getHasDuplicatedVertexes ()Z - public abstract fun getHasMissingVertexes ()Z - public abstract fun getMissingVertexes ()Ljava/util/Set; - public abstract fun getRenderer ()Lkotlin/jvm/functions/Function1; - public abstract fun renderer (Lkotlin/jvm/functions/Function1;)V - public abstract fun setRenderer (Lkotlin/jvm/functions/Function1;)V - public abstract fun toGraphSortedByEdges ()Lcom/javiersc/kotlin/stdlib/graph/Graph; - public abstract fun vertexesFor (Ljava/lang/Object;Lkotlin/jvm/functions/Function1;)Ljava/util/List; - public abstract fun vertexesFor ([Ljava/lang/Object;)Ljava/util/List; -} - -public final class com/javiersc/kotlin/stdlib/graph/Graph$DefaultImpls { - public static fun asString (Lcom/javiersc/kotlin/stdlib/graph/Graph;)Ljava/lang/String; - public static fun contains (Lcom/javiersc/kotlin/stdlib/graph/Graph;Ljava/lang/Object;)Z - public static fun contains (Lcom/javiersc/kotlin/stdlib/graph/Graph;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;)Z - public static fun containsCircularVertexes (Lcom/javiersc/kotlin/stdlib/graph/Graph;Ljava/lang/Object;)Z - public static fun doesNotContainsCircularVertexes (Lcom/javiersc/kotlin/stdlib/graph/Graph;Ljava/lang/Object;)Z - public static fun getCircularVertexes (Lcom/javiersc/kotlin/stdlib/graph/Graph;)Ljava/util/Map; - public static fun getDuplicatedVertexes (Lcom/javiersc/kotlin/stdlib/graph/Graph;)Ljava/util/Map; - public static fun getHasCircularVertexes (Lcom/javiersc/kotlin/stdlib/graph/Graph;)Z - public static fun getHasDuplicatedVertexes (Lcom/javiersc/kotlin/stdlib/graph/Graph;)Z - public static fun getHasMissingVertexes (Lcom/javiersc/kotlin/stdlib/graph/Graph;)Z - public static fun renderer (Lcom/javiersc/kotlin/stdlib/graph/Graph;Lkotlin/jvm/functions/Function1;)V - public static fun toGraphSortedByEdges (Lcom/javiersc/kotlin/stdlib/graph/Graph;)Lcom/javiersc/kotlin/stdlib/graph/Graph; - public static fun vertexesFor (Lcom/javiersc/kotlin/stdlib/graph/Graph;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;)Ljava/util/List; - public static fun vertexesFor (Lcom/javiersc/kotlin/stdlib/graph/Graph;[Ljava/lang/Object;)Ljava/util/List; - public static synthetic fun vertexesFor$default (Lcom/javiersc/kotlin/stdlib/graph/Graph;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Ljava/util/List; -} - -public final class com/javiersc/kotlin/stdlib/graph/Graph$Edge { - public fun (Lcom/javiersc/kotlin/stdlib/graph/Graph$Vertex;Lcom/javiersc/kotlin/stdlib/graph/Graph$Vertex;)V - public fun (Lkotlin/Pair;Lkotlin/Pair;)V - public final fun component1 ()Lcom/javiersc/kotlin/stdlib/graph/Graph$Vertex; - public final fun component2 ()Lcom/javiersc/kotlin/stdlib/graph/Graph$Vertex; - public final fun copy (Lcom/javiersc/kotlin/stdlib/graph/Graph$Vertex;Lcom/javiersc/kotlin/stdlib/graph/Graph$Vertex;)Lcom/javiersc/kotlin/stdlib/graph/Graph$Edge; - public static synthetic fun copy$default (Lcom/javiersc/kotlin/stdlib/graph/Graph$Edge;Lcom/javiersc/kotlin/stdlib/graph/Graph$Vertex;Lcom/javiersc/kotlin/stdlib/graph/Graph$Vertex;ILjava/lang/Object;)Lcom/javiersc/kotlin/stdlib/graph/Graph$Edge; - public fun equals (Ljava/lang/Object;)Z - public final fun getDestination ()Lcom/javiersc/kotlin/stdlib/graph/Graph$Vertex; - public final fun getSource ()Lcom/javiersc/kotlin/stdlib/graph/Graph$Vertex; - public fun hashCode ()I - public fun toString ()Ljava/lang/String; -} - -public final class com/javiersc/kotlin/stdlib/graph/Graph$Vertex { - public fun (ILjava/lang/Object;)V - public final fun component1 ()I - public final fun component2 ()Ljava/lang/Object; - public final fun copy (ILjava/lang/Object;)Lcom/javiersc/kotlin/stdlib/graph/Graph$Vertex; - public static synthetic fun copy$default (Lcom/javiersc/kotlin/stdlib/graph/Graph$Vertex;ILjava/lang/Object;ILjava/lang/Object;)Lcom/javiersc/kotlin/stdlib/graph/Graph$Vertex; - public fun equals (Ljava/lang/Object;)Z - public final fun getIndex ()I - public final fun getValue ()Ljava/lang/Object; - public fun hashCode ()I - public fun toString ()Ljava/lang/String; -} - -public final class com/javiersc/kotlin/stdlib/graph/GraphKt { - public static final fun buildGraph (Lkotlin/jvm/functions/Function1;)Lcom/javiersc/kotlin/stdlib/graph/Graph; - public static synthetic fun buildGraph$default (Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lcom/javiersc/kotlin/stdlib/graph/Graph; - public static final fun mutableGraphOf (Lkotlin/jvm/functions/Function1;)Lcom/javiersc/kotlin/stdlib/graph/MutableGraph; - public static synthetic fun mutableGraphOf$default (Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lcom/javiersc/kotlin/stdlib/graph/MutableGraph; -} - -public final class com/javiersc/kotlin/stdlib/graph/MutableGraph : com/javiersc/kotlin/stdlib/graph/Graph { - public final fun addEdge (Ljava/lang/Object;Ljava/lang/Object;)V - public final fun addVertex (Ljava/lang/Object;)Ljava/lang/Object; - public fun asString ()Ljava/lang/String; - public fun clear ()V - public fun compute (Lcom/javiersc/kotlin/stdlib/graph/Graph$Vertex;Ljava/util/function/BiFunction;)Ljava/util/List; - public synthetic fun compute (Ljava/lang/Object;Ljava/util/function/BiFunction;)Ljava/lang/Object; - public fun computeIfAbsent (Lcom/javiersc/kotlin/stdlib/graph/Graph$Vertex;Ljava/util/function/Function;)Ljava/util/List; - public synthetic fun computeIfAbsent (Ljava/lang/Object;Ljava/util/function/Function;)Ljava/lang/Object; - public fun computeIfPresent (Lcom/javiersc/kotlin/stdlib/graph/Graph$Vertex;Ljava/util/function/BiFunction;)Ljava/util/List; - public synthetic fun computeIfPresent (Ljava/lang/Object;Ljava/util/function/BiFunction;)Ljava/lang/Object; - public fun contains (Ljava/lang/Object;)Z - public fun contains (Ljava/lang/Object;Lkotlin/jvm/functions/Function1;)Z - public fun containsCircularVertexes (Ljava/lang/Object;)Z - public fun containsKey (Lcom/javiersc/kotlin/stdlib/graph/Graph$Vertex;)Z - public final fun containsKey (Ljava/lang/Object;)Z - public final fun containsValue (Ljava/lang/Object;)Z - public fun containsValue (Ljava/util/List;)Z - public fun doesNotContainsCircularVertexes (Ljava/lang/Object;)Z - public final fun entrySet ()Ljava/util/Set; - public fun get (Lcom/javiersc/kotlin/stdlib/graph/Graph$Vertex;)Ljava/util/List; - public final synthetic fun get (Ljava/lang/Object;)Ljava/lang/Object; - public final fun get (Ljava/lang/Object;)Ljava/util/List; - public fun getCircularVertexes ()Ljava/util/Map; - public fun getDuplicatedVertexes ()Ljava/util/Map; - public fun getEntries ()Ljava/util/Set; - public fun getHasCircularVertexes ()Z - public fun getHasDuplicatedVertexes ()Z - public fun getHasMissingVertexes ()Z - public fun getKeys ()Ljava/util/Set; - public fun getMissingVertexes ()Ljava/util/Set; - public fun getRenderer ()Lkotlin/jvm/functions/Function1; - public fun getSize ()I - public fun getValues ()Ljava/util/Collection; - public fun isEmpty ()Z - public final fun keySet ()Ljava/util/Set; - public fun merge (Lcom/javiersc/kotlin/stdlib/graph/Graph$Vertex;Ljava/util/List;Ljava/util/function/BiFunction;)Ljava/util/List; - public synthetic fun merge (Ljava/lang/Object;Ljava/lang/Object;Ljava/util/function/BiFunction;)Ljava/lang/Object; - public fun put (Lcom/javiersc/kotlin/stdlib/graph/Graph$Vertex;Ljava/util/List;)Ljava/util/List; - public synthetic fun put (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public fun putAll (Ljava/util/Map;)V - public fun putIfAbsent (Lcom/javiersc/kotlin/stdlib/graph/Graph$Vertex;Ljava/util/List;)Ljava/util/List; - public synthetic fun putIfAbsent (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public synthetic fun remove (Ljava/lang/Object;)Ljava/lang/Object; - public fun remove (Ljava/lang/Object;)Ljava/util/List; - public fun remove (Ljava/lang/Object;Ljava/lang/Object;)Z - public fun renderer (Lkotlin/jvm/functions/Function1;)V - public fun replace (Lcom/javiersc/kotlin/stdlib/graph/Graph$Vertex;Ljava/util/List;)Ljava/util/List; - public fun replace (Lcom/javiersc/kotlin/stdlib/graph/Graph$Vertex;Ljava/util/List;Ljava/util/List;)Z - public synthetic fun replace (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; - public synthetic fun replace (Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Z - public fun replaceAll (Ljava/util/function/BiFunction;)V - public fun setRenderer (Lkotlin/jvm/functions/Function1;)V - public final fun size ()I - public fun toGraphSortedByEdges ()Lcom/javiersc/kotlin/stdlib/graph/Graph; - public fun toString ()Ljava/lang/String; - public final fun values ()Ljava/util/Collection; - public fun vertexesFor (Ljava/lang/Object;Lkotlin/jvm/functions/Function1;)Ljava/util/List; - public fun vertexesFor ([Ljava/lang/Object;)Ljava/util/List; -} - -public abstract interface class com/javiersc/kotlin/stdlib/tree/ChildDeclarationInterface { - public abstract synthetic fun child (Ljava/lang/Object;Lkotlin/jvm/functions/Function1;)Lcom/javiersc/kotlin/stdlib/tree/TreeNode; -} - -public final class com/javiersc/kotlin/stdlib/tree/ChildDeclarationInterface$DefaultImpls { - public static synthetic fun child$default (Lcom/javiersc/kotlin/stdlib/tree/ChildDeclarationInterface;Ljava/lang/Object;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lcom/javiersc/kotlin/stdlib/tree/TreeNode; -} - -public final class com/javiersc/kotlin/stdlib/tree/LevelOrderTreeIterator : java/util/Iterator, kotlin/jvm/internal/markers/KMappedMarker { - public fun (Lcom/javiersc/kotlin/stdlib/tree/TreeNode;)V - public fun hasNext ()Z - public fun next ()Lcom/javiersc/kotlin/stdlib/tree/TreeNode; - public synthetic fun next ()Ljava/lang/Object; - public fun remove ()V -} - -public final class com/javiersc/kotlin/stdlib/tree/PostOrderTreeIterator : java/util/Iterator, kotlin/jvm/internal/markers/KMappedMarker { - public fun (Lcom/javiersc/kotlin/stdlib/tree/TreeNode;)V - public fun hasNext ()Z - public fun next ()Lcom/javiersc/kotlin/stdlib/tree/TreeNode; - public synthetic fun next ()Ljava/lang/Object; - public fun remove ()V -} - -public final class com/javiersc/kotlin/stdlib/tree/PreOrderTreeIterator : java/util/Iterator, kotlin/jvm/internal/markers/KMappedMarker { - public fun (Lcom/javiersc/kotlin/stdlib/tree/TreeNode;)V - public fun hasNext ()Z - public fun next ()Lcom/javiersc/kotlin/stdlib/tree/TreeNode; - public synthetic fun next ()Ljava/lang/Object; - public fun remove ()V -} - -public class com/javiersc/kotlin/stdlib/tree/TreeNode : com/javiersc/kotlin/stdlib/tree/ChildDeclarationInterface, java/lang/Iterable, kotlin/jvm/internal/markers/KMappedMarker { - public fun (Ljava/lang/Object;)V - public final fun addChild (Lcom/javiersc/kotlin/stdlib/tree/TreeNode;)V - public synthetic fun child (Ljava/lang/Object;Lkotlin/jvm/functions/Function1;)Lcom/javiersc/kotlin/stdlib/tree/TreeNode; - public final fun clear ()V - public final fun getChildren ()Ljava/util/List; - public final fun getDefaultIterator ()Lcom/javiersc/kotlin/stdlib/tree/TreeNodeIterators; - public final fun getDepth ()I - public final fun getHeight ()I - public final fun getNodeCount ()I - public final fun getParent ()Lcom/javiersc/kotlin/stdlib/tree/TreeNode; - public final fun getRoot ()Lcom/javiersc/kotlin/stdlib/tree/TreeNode; - public final fun getValue ()Ljava/lang/Object; - public final fun isRoot ()Z - public fun iterator ()Ljava/util/Iterator; - public final fun path (Lcom/javiersc/kotlin/stdlib/tree/TreeNode;)Ljava/util/List; - public final fun prettyString ()Ljava/lang/String; - public final fun removeChild (Lcom/javiersc/kotlin/stdlib/tree/TreeNode;)Z - public final fun setDefaultIterator (Lcom/javiersc/kotlin/stdlib/tree/TreeNodeIterators;)V - public fun toString ()Ljava/lang/String; -} - -public final class com/javiersc/kotlin/stdlib/tree/TreeNodeException : java/lang/RuntimeException { - public fun ()V - public fun (Ljava/lang/String;)V - public fun (Ljava/lang/String;Ljava/lang/Throwable;)V - public synthetic fun (Ljava/lang/String;Ljava/lang/Throwable;ILkotlin/jvm/internal/DefaultConstructorMarker;)V -} - -public final class com/javiersc/kotlin/stdlib/tree/TreeNodeIterators : java/lang/Enum { - public static final field LevelOrder Lcom/javiersc/kotlin/stdlib/tree/TreeNodeIterators; - public static final field PostOrder Lcom/javiersc/kotlin/stdlib/tree/TreeNodeIterators; - public static final field PreOrder Lcom/javiersc/kotlin/stdlib/tree/TreeNodeIterators; - public static fun getEntries ()Lkotlin/enums/EnumEntries; - public static fun valueOf (Ljava/lang/String;)Lcom/javiersc/kotlin/stdlib/tree/TreeNodeIterators; - public static fun values ()[Lcom/javiersc/kotlin/stdlib/tree/TreeNodeIterators; -} - -public final class com/javiersc/kotlin/stdlib/validate/Validator { - public static final field Companion Lcom/javiersc/kotlin/stdlib/validate/Validator$Companion; - public fun (Ljava/lang/String;Lkotlin/jvm/functions/Function2;)V - public final fun getBlock ()Lkotlin/jvm/functions/Function2; - public final fun getName ()Ljava/lang/String; -} - -public final class com/javiersc/kotlin/stdlib/validate/Validator$Companion { -} - -public final class com/javiersc/kotlin/stdlib/validate/ValidatorKt { - public static final field EmptyProperty Ljava/lang/String; - public static final field InvalidProperty Ljava/lang/String; - public static final field MultipleEmptyProperties Ljava/lang/String; - public static final field MultipleInvalidProperties Ljava/lang/String; -} - -public final class com/javiersc/kotlin/stdlib/validate/ValidatorScope { - public fun ()V - public fun (Ljava/util/List;)V - public synthetic fun (Ljava/util/List;ILkotlin/jvm/internal/DefaultConstructorMarker;)V - public final fun and (Lcom/javiersc/kotlin/stdlib/validate/ValidatorScope$ValidatableList;Ljava/lang/Object;)Lcom/javiersc/kotlin/stdlib/validate/ValidatorScope$ValidatableList; - public final fun and (Ljava/lang/Object;Ljava/lang/Object;)Lcom/javiersc/kotlin/stdlib/validate/ValidatorScope$ValidatableList; - public final fun getValidatables ()Ljava/util/List; - public final fun invalid (Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function0;)V - public final fun invalidIf (Lkotlin/jvm/functions/Function0;)V - public final fun invalidIfIsEmpty (Ljava/lang/String;Lkotlin/jvm/functions/Function0;)V - public static synthetic fun invalidIfIsEmpty$default (Lcom/javiersc/kotlin/stdlib/validate/ValidatorScope;Ljava/lang/String;Lkotlin/jvm/functions/Function0;ILjava/lang/Object;)V - public final fun invoke (Ljava/lang/Object;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object; - public final fun valid (Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function0;)V - public final fun validIf (Lkotlin/jvm/functions/Function0;)V - public final fun validationOf ([Ljava/lang/Object;Lkotlin/jvm/functions/Function1;)V -} - -public final class com/javiersc/kotlin/stdlib/validate/ValidatorScope$Validatable { - public fun (Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function0;)V - public final fun component1 ()Lkotlin/jvm/functions/Function0; - public final fun component2 ()Lkotlin/jvm/functions/Function0; - public final fun copy (Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function0;)Lcom/javiersc/kotlin/stdlib/validate/ValidatorScope$Validatable; - public static synthetic fun copy$default (Lcom/javiersc/kotlin/stdlib/validate/ValidatorScope$Validatable;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function0;ILjava/lang/Object;)Lcom/javiersc/kotlin/stdlib/validate/ValidatorScope$Validatable; - public fun equals (Ljava/lang/Object;)Z - public final fun getOtherwise ()Lkotlin/jvm/functions/Function0; - public final fun getPredicate ()Lkotlin/jvm/functions/Function0; - public fun hashCode ()I - public fun toString ()Ljava/lang/String; -} - -public final class com/javiersc/kotlin/stdlib/validate/ValidatorScope$ValidatableList : java/util/List, kotlin/jvm/internal/markers/KMappedMarker { - public fun (Ljava/util/List;)V - public fun add (ILjava/lang/Object;)V - public fun add (Ljava/lang/Object;)Z - public fun addAll (ILjava/util/Collection;)Z - public fun addAll (Ljava/util/Collection;)Z - public fun addFirst (Ljava/lang/Object;)V - public fun addLast (Ljava/lang/Object;)V - public fun clear ()V - public fun contains (Ljava/lang/Object;)Z - public fun containsAll (Ljava/util/Collection;)Z - public fun get (I)Ljava/lang/Object; - public fun getSize ()I - public final fun getValues ()Ljava/util/List; - public fun indexOf (Ljava/lang/Object;)I - public final fun invoke (Lkotlin/jvm/functions/Function1;)V - public fun isEmpty ()Z - public fun iterator ()Ljava/util/Iterator; - public fun lastIndexOf (Ljava/lang/Object;)I - public fun listIterator ()Ljava/util/ListIterator; - public fun listIterator (I)Ljava/util/ListIterator; - public fun remove (I)Ljava/lang/Object; - public fun remove (Ljava/lang/Object;)Z - public fun removeAll (Ljava/util/Collection;)Z - public fun removeFirst ()Ljava/lang/Object; - public fun removeLast ()Ljava/lang/Object; - public fun replaceAll (Ljava/util/function/UnaryOperator;)V - public fun retainAll (Ljava/util/Collection;)Z - public fun set (ILjava/lang/Object;)Ljava/lang/Object; - public final fun size ()I - public fun sort (Ljava/util/Comparator;)V - public fun subList (II)Ljava/util/List; - public fun toArray ()[Ljava/lang/Object; - public fun toArray ([Ljava/lang/Object;)[Ljava/lang/Object; -} - diff --git a/kotlin-stdlib/common/main/kotlin/com/javiersc/kotlin/stdlib/CharSequence.kt b/kotlin-stdlib/common/main/kotlin/com/javiersc/kotlin/stdlib/CharSequence.kt new file mode 100644 index 00000000..31ba3ac2 --- /dev/null +++ b/kotlin-stdlib/common/main/kotlin/com/javiersc/kotlin/stdlib/CharSequence.kt @@ -0,0 +1,30 @@ +@file:Suppress("NOTHING_TO_INLINE") + +package com.javiersc.kotlin.stdlib + +import kotlin.contracts.contract + +public inline fun CharSequence?.isNotNullNorBlank(): Boolean { + contract { returns(true) implies (this@isNotNullNorBlank != null) } + return !isNullOrBlank() +} + +public inline fun CharSequence?.isNotNullNorEmpty(): Boolean { + contract { returns(true) implies (this@isNotNullNorEmpty != null) } + return !isNullOrEmpty() +} + +public inline fun CharSequence.notContain( + other: CharSequence, + ignoreCase: Boolean = false, +): Boolean = !contains(other, ignoreCase) + +public inline fun CharSequence.notContain(regex: Regex): Boolean = !contains(regex) + +/** Remove all consecutive line breaks in a `CharSequence` */ +public fun CharSequence.removeDuplicateEmptyLines(): CharSequence = + lines().removeDuplicateEmptyLines() + +/** Add an empty line as last item if it is not empty */ +public fun CharSequence.endWithNewLine(): CharSequence = + if (lines().lastOrNull().isNullOrBlank()) this else "$this\n" diff --git a/kotlin-stdlib/common/main/kotlin/com/javiersc/kotlin/stdlib/Collections.kt b/kotlin-stdlib/common/main/kotlin/com/javiersc/kotlin/stdlib/Iterable.kt similarity index 80% rename from kotlin-stdlib/common/main/kotlin/com/javiersc/kotlin/stdlib/Collections.kt rename to kotlin-stdlib/common/main/kotlin/com/javiersc/kotlin/stdlib/Iterable.kt index ef069c3e..ca38da8c 100644 --- a/kotlin-stdlib/common/main/kotlin/com/javiersc/kotlin/stdlib/Collections.kt +++ b/kotlin-stdlib/common/main/kotlin/com/javiersc/kotlin/stdlib/Iterable.kt @@ -1,25 +1,7 @@ -@file:Suppress("MagicNumber") +@file:Suppress("MagicNumber", "TooManyFunctions", "NOTHING_TO_INLINE") package com.javiersc.kotlin.stdlib -/** - * Returns a copy of this string having its first letter title-cased using the rules of the default - * locale, or the original string if it's empty or already starts with a title case letter. - * - * The title case of a character is usually the same as its upper case with several exceptions. The - * particular list of characters with the special title case form depends on the underlying - * platform. - */ -public inline fun String.capitalize(): String = replaceFirstChar { - if (it.isLowerCase()) it.titlecase() else it.toString() -} - -/** - * Returns a copy of this string having its first letter lowercased using the rules of the default - * locale, or the original string if it's empty or already starts with a lower case letter. - */ -public inline fun String.decapitalize(): String = replaceFirstChar { it.lowercase() } - /** * Returns second element. * @@ -189,11 +171,3 @@ internal inline fun Iterable.getIndexOrNull(index: Int): T? { } } } - -/** Remove all consecutive line breaks in a list of `String` */ -public fun List.removeDuplicateEmptyLines(): String = - if (isNotEmpty()) { - reduce { acc: String, b: String -> - if (acc.lines().lastOrNull().isNullOrBlank() && b.isBlank()) acc else "$acc\n$b" - } - } else "" diff --git a/kotlin-stdlib/common/main/kotlin/com/javiersc/kotlin/stdlib/List.kt b/kotlin-stdlib/common/main/kotlin/com/javiersc/kotlin/stdlib/List.kt new file mode 100644 index 00000000..94b854b9 --- /dev/null +++ b/kotlin-stdlib/common/main/kotlin/com/javiersc/kotlin/stdlib/List.kt @@ -0,0 +1,9 @@ +package com.javiersc.kotlin.stdlib + +/** Remove all consecutive line breaks in a list of `String` */ +public fun List.removeDuplicateEmptyLines(): String = + if (isNotEmpty()) { + reduce { acc: String, b: String -> + if (acc.lines().lastOrNull().isNullOrBlank() && b.isBlank()) acc else "$acc\n$b" + } + } else "" diff --git a/kotlin-stdlib/common/main/kotlin/com/javiersc/kotlin/stdlib/Strings.kt b/kotlin-stdlib/common/main/kotlin/com/javiersc/kotlin/stdlib/Strings.kt index 5c72635a..7c3d7035 100644 --- a/kotlin-stdlib/common/main/kotlin/com/javiersc/kotlin/stdlib/Strings.kt +++ b/kotlin-stdlib/common/main/kotlin/com/javiersc/kotlin/stdlib/Strings.kt @@ -1,6 +1,6 @@ -package com.javiersc.kotlin.stdlib +@file:Suppress("NOTHING_TO_INLINE") -import kotlin.contracts.contract +package com.javiersc.kotlin.stdlib public fun String.replace(vararg oldToNewValues: Pair): String { var result = this @@ -30,39 +30,23 @@ public fun String.removeIf( block: (String) -> Boolean, ): String = if (block(this)) remove(value = value, ignoreCase = ignoreCase) else this -public inline fun CharSequence?.isNotNullNorBlank(): Boolean { - contract { returns(true) implies (this@isNotNullNorBlank != null) } - return !isNullOrBlank() -} - -public inline fun CharSequence?.isNotNullNorEmpty(): Boolean { - contract { returns(true) implies (this@isNotNullNorEmpty != null) } - return !isNullOrEmpty() -} - -public inline fun CharSequence.notContain( - other: CharSequence, - ignoreCase: Boolean = false, -): Boolean = !contains(other, ignoreCase) - -public inline fun CharSequence.notContain(regex: Regex): Boolean = !contains(regex) - -public inline fun String?.isNotNullNorBlank(): Boolean { - contract { returns(true) implies (this@isNotNullNorBlank != null) } - return !isNullOrBlank() -} - -public inline fun String?.isNotNullNorEmpty(): Boolean { - contract { returns(true) implies (this@isNotNullNorEmpty != null) } - return !isNullOrEmpty() -} - public inline val String.Companion.Empty: String get() = "" -/** Remove all consecutive line breaks in a `String` */ -public fun String.removeDuplicateEmptyLines(): String = lines().removeDuplicateEmptyLines() +/** + * Returns a copy of this string having its first letter title-cased using the rules of the default + * locale, or the original string if it's empty or already starts with a title case letter. + * + * The title case of a character is usually the same as its upper case with several exceptions. The + * particular list of characters with the special title case form depends on the underlying + * platform. + */ +public inline fun String.capitalize(): String = replaceFirstChar { + if (it.isLowerCase()) it.titlecase() else it.toString() +} -/** Add an empty line as last item if it is not empty */ -public fun String.endWithNewLine(): String = - if (lines().lastOrNull().isNullOrBlank()) this else "$this\n" +/** + * Returns a copy of this string having its first letter lowercased using the rules of the default + * locale, or the original string if it's empty or already starts with a lower case letter. + */ +public inline fun String.decapitalize(): String = replaceFirstChar { it.lowercase() } diff --git a/kotlin-stdlib/common/main/kotlin/com/javiersc/kotlin/stdlib/graph/Graph.kt b/kotlin-stdlib/common/main/kotlin/com/javiersc/kotlin/stdlib/graph/Graph.kt index f8c4cc38..3426e3cc 100644 --- a/kotlin-stdlib/common/main/kotlin/com/javiersc/kotlin/stdlib/graph/Graph.kt +++ b/kotlin-stdlib/common/main/kotlin/com/javiersc/kotlin/stdlib/graph/Graph.kt @@ -72,14 +72,12 @@ public interface Graph : Map, List>> { if (edges.isEmpty()) { sortedGraph.addVertex(vertex.value) vertexesToBeRemoved.add(vertex) - println() } for (edge: Edge in edges) { if (edge.destination.value in sortedGraph.keys.map(Vertex::value)) { sortedGraph.addVertex(edge.source.value) sortedGraph.addEdge(edge.source.value, edge.destination.value) vertexesToBeRemoved.add(edge.source) - println() } } } diff --git a/kotlin-stdlib/common/main/kotlin/com/javiersc/kotlin/stdlib/tree/TreeNode.kt b/kotlin-stdlib/common/main/kotlin/com/javiersc/kotlin/stdlib/tree/TreeNode.kt index 86b55be2..b534429e 100644 --- a/kotlin-stdlib/common/main/kotlin/com/javiersc/kotlin/stdlib/tree/TreeNode.kt +++ b/kotlin-stdlib/common/main/kotlin/com/javiersc/kotlin/stdlib/tree/TreeNode.kt @@ -60,7 +60,6 @@ public open class TreeNode(public val value: T) : * the tree. */ public fun removeChild(child: TreeNode): Boolean { - println(child.value) val removed = child._parent?._children?.remove(child) child._parent = null return removed ?: false diff --git a/kotlin-stdlib/common/test/kotlin/com/javiersc/kotlin/stdlib/CharSequenceTest.kt b/kotlin-stdlib/common/test/kotlin/com/javiersc/kotlin/stdlib/CharSequenceTest.kt new file mode 100644 index 00000000..96446905 --- /dev/null +++ b/kotlin-stdlib/common/test/kotlin/com/javiersc/kotlin/stdlib/CharSequenceTest.kt @@ -0,0 +1,98 @@ +@file:Suppress("RedundantExplicitType") + +package com.javiersc.kotlin.stdlib + +import kotlin.test.Test +import kotlin.test.assertFalse +import kotlin.test.assertTrue + +internal class CharSequenceTest { + + @Test + fun given_a_null_CharSequence_when_isNotNullNorEmpty_is_invoked_then_it_returns_false() { + assertFalse(null.isNotNullNorEmpty()) + } + + @Test + fun given_a_empty_CharSequence_when_isNotNullNorEmpty_is_invoked_then_it_returns_false() { + assertFalse("".isNotNullNorEmpty()) + } + + @Test + fun given_a_blank_CharSequence_when_isNotNullNorEmpty_is_invoked_then_it_returns_true() { + assertTrue(" ".isNotNullNorEmpty()) + assertTrue(" ".isNotNullNorEmpty()) + } + + @Test + fun given_a_not_blank_CharSequence_when_isNotNullNorEmpty_is_invoked_then_it_returns_true() { + assertTrue("foo".isNotNullNorEmpty()) + assertTrue(" f".isNotNullNorEmpty()) + assertTrue("f ".isNotNullNorEmpty()) + assertTrue(" foo ".isNotNullNorEmpty()) + assertTrue(" f o ".isNotNullNorEmpty()) + } + + @Test + fun given_a_null_CharSequence_when_isNotNullNorBlank_is_invoked_then_it_returns_false() { + assertFalse(null.isNotNullNorBlank()) + } + + @Test + fun given_a_empty_CharSequence_when_isNotNullOrBlank_is_invoked_then_it_returns_false() { + assertFalse("".isNotNullNorBlank()) + } + + @Test + fun given_a_blank_CharSequence_when_isNotNullNorBlank_is_invoked_then_it_returns_false() { + assertFalse(" ".isNotNullNorBlank()) + assertFalse(" ".isNotNullNorBlank()) + } + + @Test + fun given_a_not_blank_CharSequence_when_isNotNullOrBlank_is_invoked_then_it_returns_true() { + assertTrue("foo".isNotNullNorBlank()) + assertTrue(" f".isNotNullNorBlank()) + assertTrue("f ".isNotNullNorBlank()) + assertTrue(" foo ".isNotNullNorBlank()) + assertTrue(" f o ".isNotNullNorBlank()) + } + + @Test + fun string_not_contain() { + assertFalse { "Hello World".notContain("Hello") } + assertFalse { "HELLO World".notContain("hello", ignoreCase = true) } + assertTrue { "Hello World".notContain("hello") } + assertTrue { "Hello World".notContain("hello", ignoreCase = false) } + + val regex = Regex("[0-9]+") + assertFalse { "Hello World 1".notContain(regex) } + assertTrue { "Hello World".notContain(regex) } + } + + @Test + fun string_remove_duplicate_empty_lines() { + assertTrue { "a\nb\n\n\nc\n".removeDuplicateEmptyLines() == "a\nb\n\nc\n" } + assertTrue { "a\n\nb\n\n\nc\n".removeDuplicateEmptyLines() == "a\n\nb\n\nc\n" } + assertTrue { "a\n\nb\n\n\nc\n\n".removeDuplicateEmptyLines() == "a\n\nb\n\nc\n" } + assertTrue { "a\n\n\n\n\nb\n\n".removeDuplicateEmptyLines() == "a\n\nb\n" } + } + + @Test + fun string_end_with_new_line() { + assertTrue { "a".endWithNewLine() == "a\n" } + assertTrue { "a\n".endWithNewLine() == "a\n" } + assertTrue { "".endWithNewLine() == "" } + assertTrue { "a\nb".endWithNewLine() == "a\nb\n" } + assertTrue { "".endWithNewLine() == "" } + assertTrue { "\n".endWithNewLine() == "\n" } + + val helloWorld = + """ + |Hello World + | + """ + + assertTrue { helloWorld.trimMargin().endWithNewLine() == helloWorld.trimMargin() } + } +} diff --git a/kotlin-stdlib/common/test/kotlin/com/javiersc/kotlin/stdlib/StringsTest.kt b/kotlin-stdlib/common/test/kotlin/com/javiersc/kotlin/stdlib/StringsTest.kt index 095b5957..8faad43a 100644 --- a/kotlin-stdlib/common/test/kotlin/com/javiersc/kotlin/stdlib/StringsTest.kt +++ b/kotlin-stdlib/common/test/kotlin/com/javiersc/kotlin/stdlib/StringsTest.kt @@ -3,7 +3,6 @@ package com.javiersc.kotlin.stdlib import kotlin.test.Test -import kotlin.test.assertFalse import kotlin.test.assertTrue internal class StringsTest { @@ -13,6 +12,7 @@ internal class StringsTest { assertTrue { "hello".capitalize() == "Hello" } assertTrue { "Hello".capitalize() == "Hello" } assertTrue { "hElLo".capitalize() == "HElLo" } + assertTrue { "".capitalize() == "" } } @Test @@ -20,18 +20,7 @@ internal class StringsTest { assertTrue { "hello".decapitalize() == "hello" } assertTrue { "Hello".decapitalize() == "hello" } assertTrue { "HElLo".decapitalize() == "hElLo" } - } - - @Test - fun string_not_contain() { - assertFalse { "Hello, World".notContain("Hello") } - assertFalse { "HELLO, World".notContain("hello", ignoreCase = true) } - assertTrue { "Hello, World".notContain("hello") } - assertTrue { "Hello, World".notContain("hello", ignoreCase = false) } - - val regex = Regex("[0-9]+") - assertFalse { "Hello, World 1".notContain(regex) } - assertTrue { "Hello, World".notContain(regex) } + assertTrue { "".decapitalize() == "" } } @Test @@ -51,69 +40,8 @@ internal class StringsTest { assertTrue { "Hello, World".replace("ello" to "ELLO", "orld" to "ORLD") == "HELLO, WORLD" } } - @Test - fun string_isNotNullNorEmpty_and_string_isNotNullNorBlank() { - val nullable: String? = null - val nullableCharSequence: CharSequence? = null - val blank: String = " " - val blankCharSequence: CharSequence = " " - val empty: String = "" - val emptyCharSequence: CharSequence = "" - val notBlank: String = "Hello, World" - val notBlankCharSequence: CharSequence = "Hello, World" - - assertFalse { nullable.isNotNullNorEmpty() } - assertFalse { nullableCharSequence.isNotNullNorEmpty() } - assertTrue { blank.isNotNullNorEmpty() } - assertTrue { blankCharSequence.isNotNullNorEmpty() } - assertFalse { empty.isNotNullNorEmpty() } - assertFalse { emptyCharSequence.isNotNullNorEmpty() } - assertTrue { notBlank.isNotNullNorEmpty() } - assertTrue { notBlankCharSequence.isNotNullNorEmpty() } - - assertFalse { nullable.isNotNullNorBlank() } - assertFalse { nullableCharSequence.isNotNullNorBlank() } - assertFalse { blank.isNotNullNorBlank() } - assertFalse { blankCharSequence.isNotNullNorBlank() } - assertFalse { empty.isNotNullNorBlank() } - assertFalse { emptyCharSequence.isNotNullNorBlank() } - assertTrue { notBlank.isNotNullNorBlank() } - assertTrue { notBlankCharSequence.isNotNullNorBlank() } - } - @Test fun empty_string() { assertTrue { String.Empty == "" } } - - @Test - fun string_remove_duplicate_empty_lines() { - assertTrue { "a\nb\n\n\nc\n".removeDuplicateEmptyLines() == "a\nb\n\nc\n" } - assertTrue { "a\n\nb\n\n\nc\n".removeDuplicateEmptyLines() == "a\n\nb\n\nc\n" } - assertTrue { "a\n\nb\n\n\nc\n\n".removeDuplicateEmptyLines() == "a\n\nb\n\nc\n" } - assertTrue { "a\n\n\n\n\nb\n\n".removeDuplicateEmptyLines() == "a\n\nb\n" } - } - - @Test - fun string_end_with_new_line() { - assertTrue { "a".endWithNewLine() == "a\n" } - assertTrue { "a\n".endWithNewLine() == "a\n" } - assertTrue { "".endWithNewLine() == "" } - assertTrue { "a\nb".endWithNewLine() == "a\nb\n" } - assertTrue { "".endWithNewLine() == "" } - assertTrue { "\n".endWithNewLine() == "\n" } - assertTrue { - """ - |Hello, World - | - """ - .trimMargin() - .endWithNewLine() == - """ - |Hello, World - | - """ - .trimMargin() - } - } } diff --git a/kotlin-stdlib/jvm/main/kotlin/com/javiersc/kotlin/stdlib/Files.kt b/kotlin-stdlib/jvm/main/kotlin/com/javiersc/kotlin/stdlib/Files.kt index e55f2a07..b8c02e33 100644 --- a/kotlin-stdlib/jvm/main/kotlin/com/javiersc/kotlin/stdlib/Files.kt +++ b/kotlin-stdlib/jvm/main/kotlin/com/javiersc/kotlin/stdlib/Files.kt @@ -27,8 +27,8 @@ public open class DirScope(file: File) : FileScope(file) { } public fun File.root(name: String, block: DirScope.() -> Unit = {}): DirScope { - val dir = resolve(name).apply { mkdir() } - val scope = object : DirScope(dir) {} + val dir: File = resolve(name).apply(File::mkdir) + val scope: DirScope = object : DirScope(dir) {} block(scope) return scope } diff --git a/kotlin-stdlib/jvm/test/kotlin/com/javiersc/kotlin/stdlib/FilesTest.kt b/kotlin-stdlib/jvm/test/kotlin/com/javiersc/kotlin/stdlib/FilesTest.kt index 70687998..e2731ea3 100644 --- a/kotlin-stdlib/jvm/test/kotlin/com/javiersc/kotlin/stdlib/FilesTest.kt +++ b/kotlin-stdlib/jvm/test/kotlin/com/javiersc/kotlin/stdlib/FilesTest.kt @@ -28,11 +28,12 @@ internal class FilesTest { file("file3.txt") { // writeText("3") } + file("file4.txt") } } } assertTrue { projectDir.root("root").isDirectory } - assertTrue { projectDir.walkTopDown().count() == 8 } + assertTrue { projectDir.walkTopDown().count() == 9 } projectDir.resolve("root").apply { assertTrue { exists() } assertTrue { isDirectory } diff --git a/kotlin-test-junit/api/kotlin-test-junit.api b/kotlin-test-junit/api/kotlin-test-junit.api deleted file mode 100644 index 2ca5ad03..00000000 --- a/kotlin-test-junit/api/kotlin-test-junit.api +++ /dev/null @@ -1,75 +0,0 @@ -public abstract interface annotation class com/javiersc/kotlin/test/IgnoreAndroid : java/lang/annotation/Annotation { -} - -public abstract interface annotation class com/javiersc/kotlin/test/IgnoreAndroidNativeArm32 : java/lang/annotation/Annotation { -} - -public abstract interface annotation class com/javiersc/kotlin/test/IgnoreAndroidNativeArm64 : java/lang/annotation/Annotation { -} - -public abstract interface annotation class com/javiersc/kotlin/test/IgnoreAndroidNativeX64 : java/lang/annotation/Annotation { -} - -public abstract interface annotation class com/javiersc/kotlin/test/IgnoreAndroidNativeX86 : java/lang/annotation/Annotation { -} - -public abstract interface annotation class com/javiersc/kotlin/test/IgnoreCommon : java/lang/annotation/Annotation { -} - -public abstract interface annotation class com/javiersc/kotlin/test/IgnoreIosArm64 : java/lang/annotation/Annotation { -} - -public abstract interface annotation class com/javiersc/kotlin/test/IgnoreIosSimulatorArm64 : java/lang/annotation/Annotation { -} - -public abstract interface annotation class com/javiersc/kotlin/test/IgnoreIosX64 : java/lang/annotation/Annotation { -} - -public abstract interface annotation class com/javiersc/kotlin/test/IgnoreJs : java/lang/annotation/Annotation { -} - -public abstract interface annotation class com/javiersc/kotlin/test/IgnoreLinuxArm64 : java/lang/annotation/Annotation { -} - -public abstract interface annotation class com/javiersc/kotlin/test/IgnoreLinuxX64 : java/lang/annotation/Annotation { -} - -public abstract interface annotation class com/javiersc/kotlin/test/IgnoreMacosArm64 : java/lang/annotation/Annotation { -} - -public abstract interface annotation class com/javiersc/kotlin/test/IgnoreMacosX64 : java/lang/annotation/Annotation { -} - -public abstract interface annotation class com/javiersc/kotlin/test/IgnoreMingwX64 : java/lang/annotation/Annotation { -} - -public abstract interface annotation class com/javiersc/kotlin/test/IgnoreSrc : java/lang/annotation/Annotation { -} - -public abstract interface annotation class com/javiersc/kotlin/test/IgnoreTvosArm64 : java/lang/annotation/Annotation { -} - -public abstract interface annotation class com/javiersc/kotlin/test/IgnoreTvosSimulatorArm64 : java/lang/annotation/Annotation { -} - -public abstract interface annotation class com/javiersc/kotlin/test/IgnoreTvosX64 : java/lang/annotation/Annotation { -} - -public abstract interface annotation class com/javiersc/kotlin/test/IgnoreWasmJs : java/lang/annotation/Annotation { -} - -public abstract interface annotation class com/javiersc/kotlin/test/IgnoreWatchosArm32 : java/lang/annotation/Annotation { -} - -public abstract interface annotation class com/javiersc/kotlin/test/IgnoreWatchosArm64 : java/lang/annotation/Annotation { -} - -public abstract interface annotation class com/javiersc/kotlin/test/IgnoreWatchosDeviceArm64 : java/lang/annotation/Annotation { -} - -public abstract interface annotation class com/javiersc/kotlin/test/IgnoreWatchosSimulatorArm64 : java/lang/annotation/Annotation { -} - -public abstract interface annotation class com/javiersc/kotlin/test/IgnoreWatchosX64 : java/lang/annotation/Annotation { -} -