forked from kscience/kmath
add Attributes minus
This commit is contained in:
parent
6e24b563b2
commit
3e8f44166c
@ -140,8 +140,18 @@ public fun <A : Attribute<Unit>> Attributes(
|
|||||||
attribute: A,
|
attribute: A,
|
||||||
): Attributes = MapAttributes(mapOf(attribute to Unit))
|
): Attributes = MapAttributes(mapOf(attribute to Unit))
|
||||||
|
|
||||||
public operator fun Attributes.plus(other: Attributes): Attributes = when{
|
/**
|
||||||
|
* Create a new [Attributes] that overlays [other] on top of this set of attributes. New attributes are added.
|
||||||
|
* Existing attribute keys are replaced.
|
||||||
|
*/
|
||||||
|
public operator fun Attributes.plus(other: Attributes): Attributes = when {
|
||||||
isEmpty() -> other
|
isEmpty() -> other
|
||||||
other.isEmpty() -> this
|
other.isEmpty() -> this
|
||||||
else -> MapAttributes(content + other.content)
|
else -> MapAttributes(content + other.content)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new [Attributes] with removed [key] (if it is present).
|
||||||
|
*/
|
||||||
|
public operator fun Attributes.minus(key: Attribute<*>): Attributes =
|
||||||
|
if (content.contains(key)) MapAttributes(content.minus(key)) else this
|
@ -80,7 +80,7 @@ benchmark {
|
|||||||
// Setup configurations
|
// Setup configurations
|
||||||
targets {
|
targets {
|
||||||
register("jvm")
|
register("jvm")
|
||||||
// register("js")
|
register("js")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun kotlinx.benchmark.gradle.BenchmarkConfiguration.commonConfiguration() {
|
fun kotlinx.benchmark.gradle.BenchmarkConfiguration.commonConfiguration() {
|
||||||
|
@ -4,7 +4,20 @@ plugins {
|
|||||||
|
|
||||||
kscience {
|
kscience {
|
||||||
jvm()
|
jvm()
|
||||||
js()
|
js{
|
||||||
|
nodejs {
|
||||||
|
testTask {
|
||||||
|
useMocha().timeout = "0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
browser {
|
||||||
|
useCommonJs()
|
||||||
|
testTask {
|
||||||
|
useMocha().timeout = "0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
native()
|
native()
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@ -18,7 +31,7 @@ kscience {
|
|||||||
|
|
||||||
dependencies(jsMain) {
|
dependencies(jsMain) {
|
||||||
implementation(npm("astring", "1.7.5"))
|
implementation(npm("astring", "1.7.5"))
|
||||||
implementation(npm("binaryen", "101.0.0"))
|
implementation(npm("binaryen", "117.0.0"))
|
||||||
implementation(npm("js-base64", "3.6.1"))
|
implementation(npm("js-base64", "3.6.1"))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29,19 +42,6 @@ kscience {
|
|||||||
}
|
}
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
js {
|
|
||||||
nodejs {
|
|
||||||
testTask {
|
|
||||||
useMocha().timeout = "0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
browser {
|
|
||||||
testTask {
|
|
||||||
useMocha().timeout = "0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
filter { it.name.contains("test", true) }
|
filter { it.name.contains("test", true) }
|
||||||
|
Loading…
Reference in New Issue
Block a user