Compare commits

..

No commits in common. "203a350650de23b987d58fe11eadc578a0f2acc8" and "fcb7e2fa7d91667522d681d78c92c7aff181e29c" have entirely different histories.

6 changed files with 9 additions and 26 deletions

View File

@ -14,16 +14,12 @@ public abstract interface class space/kscience/attributes/AttributeWithDefault :
public abstract interface class space/kscience/attributes/Attributes { public abstract interface class space/kscience/attributes/Attributes {
public static final field Companion Lspace/kscience/attributes/Attributes$Companion; public static final field Companion Lspace/kscience/attributes/Attributes$Companion;
public abstract fun equals (Ljava/lang/Object;)Z
public fun get (Lspace/kscience/attributes/Attribute;)Ljava/lang/Object; public fun get (Lspace/kscience/attributes/Attribute;)Ljava/lang/Object;
public abstract fun getContent ()Ljava/util/Map; public abstract fun getContent ()Ljava/util/Map;
public fun getKeys ()Ljava/util/Set; public fun getKeys ()Ljava/util/Set;
public abstract fun hashCode ()I
public abstract fun toString ()Ljava/lang/String;
} }
public final class space/kscience/attributes/Attributes$Companion { public final class space/kscience/attributes/Attributes$Companion {
public final fun equals (Lspace/kscience/attributes/Attributes;Lspace/kscience/attributes/Attributes;)Z
public final fun getEMPTY ()Lspace/kscience/attributes/Attributes; public final fun getEMPTY ()Lspace/kscience/attributes/Attributes;
} }
@ -31,14 +27,11 @@ public final class space/kscience/attributes/AttributesBuilder : space/kscience/
public fun <init> ()V public fun <init> ()V
public final fun add (Lspace/kscience/attributes/SetAttribute;Ljava/lang/Object;)V public final fun add (Lspace/kscience/attributes/SetAttribute;Ljava/lang/Object;)V
public final fun build ()Lspace/kscience/attributes/Attributes; public final fun build ()Lspace/kscience/attributes/Attributes;
public fun equals (Ljava/lang/Object;)Z
public final fun from (Lspace/kscience/attributes/Attributes;)V public final fun from (Lspace/kscience/attributes/Attributes;)V
public fun getContent ()Ljava/util/Map; public fun getContent ()Ljava/util/Map;
public fun hashCode ()I
public final fun invoke (Lspace/kscience/attributes/Attribute;Ljava/lang/Object;)V public final fun invoke (Lspace/kscience/attributes/Attribute;Ljava/lang/Object;)V
public final fun remove (Lspace/kscience/attributes/SetAttribute;Ljava/lang/Object;)V public final fun remove (Lspace/kscience/attributes/SetAttribute;Ljava/lang/Object;)V
public final fun set (Lspace/kscience/attributes/Attribute;Ljava/lang/Object;)V public final fun set (Lspace/kscience/attributes/Attribute;Ljava/lang/Object;)V
public fun toString ()Ljava/lang/String;
} }
public final class space/kscience/attributes/AttributesBuilderKt { public final class space/kscience/attributes/AttributesBuilderKt {

View File

@ -5,8 +5,10 @@
package space.kscience.attributes package space.kscience.attributes
import kotlin.jvm.JvmInline
/** /**
* A set of attributes. The implementation must guarantee that [content] keys correspond to their value types. * A set of attributes. The implementation must guarantee that [content] keys correspond to its value types.
*/ */
public interface Attributes { public interface Attributes {
/** /**
@ -25,22 +27,14 @@ public interface Attributes {
@Suppress("UNCHECKED_CAST") @Suppress("UNCHECKED_CAST")
public operator fun <T> get(attribute: Attribute<T>): T? = content[attribute] as? T public operator fun <T> get(attribute: Attribute<T>): T? = content[attribute] as? T
override fun toString(): String
override fun equals(other: Any?): Boolean
override fun hashCode(): Int
public companion object { public companion object {
public val EMPTY: Attributes = AttributesImpl(emptyMap()) public val EMPTY: Attributes = AttributesImpl(emptyMap())
public fun equals(a1: Attributes, a2: Attributes): Boolean =
a1.keys == a2.keys && a1.keys.all { a1[it] == a2[it] }
} }
} }
internal class AttributesImpl(override val content: Map<out Attribute<*>, Any?>) : Attributes { @JvmInline
internal value class AttributesImpl(override val content: Map<out Attribute<*>, Any?>) : Attributes {
override fun toString(): String = "Attributes(value=${content.entries})" override fun toString(): String = "Attributes(value=${content.entries})"
override fun equals(other: Any?): Boolean = other is Attributes && Attributes.equals(this, other)
override fun hashCode(): Int = content.hashCode()
} }
public fun Attributes.isEmpty(): Boolean = content.isEmpty() public fun Attributes.isEmpty(): Boolean = content.isEmpty()

View File

@ -16,10 +16,6 @@ public class AttributesBuilder<out O> internal constructor(
public constructor() : this(mutableMapOf()) public constructor() : this(mutableMapOf())
override fun toString(): String = "Attributes(value=${content.entries})"
override fun equals(other: Any?): Boolean = other is Attributes && Attributes.equals(this, other)
override fun hashCode(): Int = content.hashCode()
override val content: Map<out Attribute<*>, Any?> get() = map override val content: Map<out Attribute<*>, Any?> get() = map
public operator fun <T> set(attribute: Attribute<T>, value: T?) { public operator fun <T> set(attribute: Attribute<T>, value: T?) {

View File

@ -11,7 +11,7 @@ import kotlin.reflect.KType
import kotlin.reflect.typeOf import kotlin.reflect.typeOf
/** /**
* Safe variant ok Kotlin [KType] that ensures that the type parameter is of the same type as [kType] * Safe variant ok Kotlin [KType] that ensures that the type parameter is of the same type ask [kType]
* *
* @param kType raw [KType] * @param kType raw [KType]
*/ */

View File

@ -14,7 +14,7 @@ allprojects {
} }
group = "space.kscience" group = "space.kscience"
version = "0.4.0" version = "0.4.0-RC2"
} }
subprojects { subprojects {
@ -69,4 +69,4 @@ ksciencePublish {
apiValidation.nonPublicMarkers.add("space.kscience.kmath.UnstableKMathAPI") apiValidation.nonPublicMarkers.add("space.kscience.kmath.UnstableKMathAPI")
val multikVersion by extra("0.2.3") val multikVersion by extra("0.2.2")

View File

@ -6,7 +6,7 @@
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
plugins { plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0" id("org.gradle.toolchains.foojay-resolver-convention") version "0.7.0"
} }
dependencyResolutionManagement { dependencyResolutionManagement {