-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support locale-independent term ordering on the jvm
- Loading branch information
Showing
9 changed files
with
119 additions
and
46 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
core/src/commonMain/kotlin/it/unibo/tuprolog/core/ComparisonUtils.kt
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,7 @@ | ||
@file:JvmName("ComparisonUtils") | ||
|
||
package it.unibo.tuprolog.core | ||
|
||
import kotlin.jvm.JvmName | ||
|
||
expect fun compareStringsLocaleIndependently(string1: String, string2: String): Int |
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
5 changes: 5 additions & 0 deletions
5
core/src/commonTest/kotlin/it/unibo/tuprolog/core/TestComparisonUtils.kt
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,5 @@ | ||
package it.unibo.tuprolog.core | ||
|
||
import kotlin.collections.List | ||
|
||
expect val orderedTerms: List<Term> |
4 changes: 4 additions & 0 deletions
4
core/src/jsMain/kotlin/it/unibo/tuprolog/core/ComparisonUtils.kt
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,4 @@ | ||
package it.unibo.tuprolog.core | ||
|
||
actual fun compareStringsLocaleIndependently(string1: String, string2: String): Int = | ||
string1.compareTo(string2) |
46 changes: 46 additions & 0 deletions
46
core/src/jsTest/kotlin/it/unibo/tuprolog/core/TestComparisonUtils.kt
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,46 @@ | ||
package it.unibo.tuprolog.core | ||
|
||
import kotlin.collections.List | ||
|
||
actual val orderedTerms: List<Term> = listOf( | ||
Var.of("A"), | ||
Var.of("A"), | ||
Var.of("B"), | ||
Var.of("C"), | ||
Var.anonymous(), | ||
Var.anonymous(), | ||
Real.of(1.1), | ||
Real.of(2.2), | ||
Integer.of(1), | ||
Integer.of(2), | ||
Atom.of(""), | ||
Atom.of("a"), | ||
Atom.of("a b"), | ||
Atom.of("b"), | ||
Struct.of("f", Var.of("A")), | ||
Struct.of("f", Var.of("A")), | ||
Struct.of("f", Var.of("B")), | ||
Struct.of("f", Var.of("C")), | ||
Struct.of("f", Var.anonymous()), | ||
Struct.of("f", Real.of(1.1)), | ||
Struct.of("f", Real.of(2.2)), | ||
Struct.of("f", Integer.of(1)), | ||
Struct.of("f", Integer.of(2)), | ||
Struct.of("f", Atom.of("")), | ||
Struct.of("f", Atom.of("a")), | ||
Struct.of("f", Atom.of("a b")), | ||
Struct.of("f", Atom.of("b")), | ||
Struct.of("g", Var.of("A")), | ||
Struct.of("g", Var.of("A")), | ||
Struct.of("g", Var.of("B")), | ||
Struct.of("g", Var.of("C")), | ||
Struct.of("g", Var.anonymous()), | ||
Struct.of("g", Real.of(1.1)), | ||
Struct.of("g", Real.of(2.2)), | ||
Struct.of("g", Integer.of(1)), | ||
Struct.of("g", Integer.of(2)), | ||
Struct.of("g", Atom.of("")), | ||
Struct.of("g", Atom.of("a")), | ||
Struct.of("g", Atom.of("a b")), | ||
Struct.of("g", Atom.of("b")) | ||
) |
6 changes: 6 additions & 0 deletions
6
core/src/jvmMain/kotlin/it/unibo/tuprolog/core/ComparisonUtils.kt
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,6 @@ | ||
package it.unibo.tuprolog.core | ||
|
||
import java.text.Collator | ||
|
||
actual fun compareStringsLocaleIndependently(string1: String, string2: String): Int = | ||
Collator.getInstance().compare(string1, string2) |
46 changes: 46 additions & 0 deletions
46
core/src/jvmTest/kotlin/it/unibo/tuprolog/core/TestComparisonUtils.kt
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,46 @@ | ||
package it.unibo.tuprolog.core | ||
|
||
import kotlin.collections.List | ||
|
||
actual val orderedTerms: List<Term> = listOf( | ||
Var.anonymous(), | ||
Var.anonymous(), | ||
Var.of("A"), | ||
Var.of("A"), | ||
Var.of("B"), | ||
Var.of("C"), | ||
Real.of(1.1), | ||
Real.of(2.2), | ||
Integer.of(1), | ||
Integer.of(2), | ||
Atom.of(""), | ||
Atom.of("a"), | ||
Atom.of("a b"), | ||
Atom.of("b"), | ||
Struct.of("f", Var.anonymous()), | ||
Struct.of("f", Var.of("A")), | ||
Struct.of("f", Var.of("A")), | ||
Struct.of("f", Var.of("B")), | ||
Struct.of("f", Var.of("C")), | ||
Struct.of("f", Real.of(1.1)), | ||
Struct.of("f", Real.of(2.2)), | ||
Struct.of("f", Integer.of(1)), | ||
Struct.of("f", Integer.of(2)), | ||
Struct.of("f", Atom.of("")), | ||
Struct.of("f", Atom.of("a")), | ||
Struct.of("f", Atom.of("a b")), | ||
Struct.of("f", Atom.of("b")), | ||
Struct.of("g", Var.anonymous()), | ||
Struct.of("g", Var.of("A")), | ||
Struct.of("g", Var.of("A")), | ||
Struct.of("g", Var.of("B")), | ||
Struct.of("g", Var.of("C")), | ||
Struct.of("g", Real.of(1.1)), | ||
Struct.of("g", Real.of(2.2)), | ||
Struct.of("g", Integer.of(1)), | ||
Struct.of("g", Integer.of(2)), | ||
Struct.of("g", Atom.of("")), | ||
Struct.of("g", Atom.of("a")), | ||
Struct.of("g", Atom.of("a b")), | ||
Struct.of("g", Atom.of("b")) | ||
) |
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