remove unnecessary type limitations in actions

This commit is contained in:
Alexander Nozik 2024-02-18 18:43:33 +03:00
parent e850ca4145
commit aa4c745819
5 changed files with 11 additions and 11 deletions

View File

@ -21,7 +21,7 @@ internal fun MutableMap<Name, *>.removeWhatStartsWith(name: Name) {
/**
* An action that caches results on-demand and recalculates them on source push
*/
public abstract class AbstractAction<T : Any, R : Any>(
public abstract class AbstractAction<T, R>(
public val outputType: KType,
) : Action<T, R> {

View File

@ -50,7 +50,7 @@ public class MapActionBuilder<T, R>(
}
@PublishedApi
internal class MapAction<T : Any, R : Any>(
internal class MapAction<T, R>(
outputType: KType,
private val block: MapActionBuilder<T, R>.() -> Unit,
) : AbstractAction<T, R>(outputType) {
@ -96,7 +96,7 @@ internal class MapAction<T : Any, R : Any>(
* A one-to-one mapping action
*/
@DFExperimental
public inline fun <T : Any, reified R : Any> Action.Companion.mapping(
public inline fun <T, reified R> Action.Companion.mapping(
noinline builder: MapActionBuilder<T, R>.() -> Unit,
): Action<T, R> = MapAction(typeOf<R>(), builder)

View File

@ -12,7 +12,7 @@ import kotlin.reflect.KType
import kotlin.reflect.typeOf
public class JoinGroup<T : Any, R : Any>(
public class JoinGroup<T, R>(
public var name: String,
internal val set: DataTree<T>,
@PublishedApi internal var outputType: KType,
@ -35,7 +35,7 @@ public class JoinGroup<T : Any, R : Any>(
}
@DFBuilder
public class ReduceGroupBuilder<T : Any, R : Any>(
public class ReduceGroupBuilder<T, R>(
public val actionMeta: Meta,
private val outputType: KType,
) {
@ -79,7 +79,7 @@ public class ReduceGroupBuilder<T : Any, R : Any>(
}
@PublishedApi
internal class ReduceAction<T : Any, R : Any>(
internal class ReduceAction<T, R>(
outputType: KType,
private val action: ReduceGroupBuilder<T, R>.() -> Unit,
) : AbstractAction<T, R>(outputType) {

View File

@ -13,9 +13,9 @@ import kotlin.reflect.KType
import kotlin.reflect.typeOf
public class SplitBuilder<T : Any, R : Any>(public val name: Name, public val meta: Meta) {
public class SplitBuilder<T, R>(public val name: Name, public val meta: Meta) {
public class FragmentRule<T : Any, R : Any>(
public class FragmentRule<T, R>(
public val name: Name,
public var meta: MutableMeta,
@PublishedApi internal var outputType: KType,
@ -44,7 +44,7 @@ public class SplitBuilder<T : Any, R : Any>(public val name: Name, public val me
* Action that splits each incoming element into a number of fragments defined in builder
*/
@PublishedApi
internal class SplitAction<T : Any, R : Any>(
internal class SplitAction<T, R>(
outputType: KType,
private val action: SplitBuilder<T, R>.() -> Unit,
) : AbstractAction<T, R>(outputType) {

View File

@ -20,7 +20,7 @@ import space.kscience.dataforge.meta.string
import space.kscience.dataforge.misc.DFInternal
public interface GroupRule {
public fun <T : Any> gather(set: DataTree<T>): Map<String, DataTree<T>>
public fun <T> gather(set: DataTree<T>): Map<String, DataTree<T>>
public companion object {
/**
@ -37,7 +37,7 @@ public interface GroupRule {
defaultTagValue: String,
): GroupRule = object : GroupRule {
override fun <T : Any> gather(
override fun <T> gather(
set: DataTree<T>,
): Map<String, DataTree<T>> {
val map = HashMap<String, DataTreeBuilder<T>>()