org.jetbrains.kotlinx.ggdsl.ir.bindings.mapping.kt Maven / Gradle / Ivy
/*
* Copyright 2020-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
package org.jetbrains.kotlinx.ggdsl.ir.bindings
import kotlinx.serialization.Serializable
import org.jetbrains.kotlinx.ggdsl.ir.aes.AesName
import org.jetbrains.kotlinx.ggdsl.ir.data.ColumnPointer
import org.jetbrains.kotlinx.ggdsl.ir.data.KTypeSerializer
import org.jetbrains.kotlinx.ggdsl.ir.scale.ScaleParameters
import kotlin.reflect.KType
/**
* Mapping base interface
*
* @property aes the aesthetic attribute to be mapped to.
*/
public sealed interface Mapping {
public val aes: AesName
public val domainType: KType
}
/**
* Positional mapping without an individual scale.
*
* @property aes the aesthetic attribute to be mapped to
* @property source the source to which the mapping is applied
* @property domainType the type of domain
*/
@Serializable
public data class NonScalablePositionalMapping(
override val aes: AesName,
val source: ColumnPointer,
@Serializable(KTypeSerializer::class) override val domainType: KType
): Mapping
/**
* Non-positional mapping without an individual scale.
*
* @property aes the aesthetic attribute to be mapped to
* @property source the source to which the mapping is applied
* @property domainType the type of domain
*/
@Serializable
public data class NonScalableNonPositionalMapping(
override val aes: AesName,
val source: ColumnPointer,
@Serializable(KTypeSerializer::class) override val domainType: KType
) : Mapping
/**
* Mapping interface with an individual scale.
*
* @property aes the aesthetic attribute to be mapped to
* @property columnScaled the scaled source to which the mapping is applied
* @property domainType the type of domain
*/
public sealed interface ScaledMapping : Mapping {
override val aes: AesName
public val columnScaled: ColumnScaled
public override val domainType: KType
public var scaleParameters: ScaleParameters?
}
/**
* Positional mapping interface with an individual scale.
*
* @property aes the aesthetic attribute to be mapped to
* @property columnScaled the scaled source to which the mapping is applied
* @property domainType the type of domain
*/
public sealed interface BaseScaledPositionalMapping : ScaledMapping {
override val aes: AesName
override val columnScaled: ColumnScaled
override val domainType: KType
override var scaleParameters: ScaleParameters?
}
/**
* Non-positional mapping interface with an individual scale.
*
* @property aes the aesthetic attribute to be mapped to
* @property columnScaled the scaled source to which the mapping is applied
* @property domainType the type of domain
*/
public sealed interface BaseScaledNonPositionalMapping : ScaledMapping {
override val aes: AesName
override val columnScaled: ColumnScaled
override val domainType: KType
override var scaleParameters: ScaleParameters?
}
/**
* Mapping interface with an unspecified default scale.
*
* @property aes the aesthetic attribute to be mapped to
* @property columnScaled the scaled default unspecified source to which the mapping is applied
* @property domainType type of domain
*/
public sealed interface ScaledUnspecifiedDefaultMapping : ScaledMapping {
override val aes: AesName
override val columnScaled: ColumnScaledUnspecifiedDefault
@Serializable(KTypeSerializer::class) override val domainType: KType
override var scaleParameters: ScaleParameters?
}
/**
* Positional mapping with an unspecified default scale.
*
* @property aes the aesthetic attribute to be mapped to
* @property columnScaled the scaled default unspecified source to which the mapping is applied
* @property domainType type of domain
*/
@Serializable
public data class ScaledUnspecifiedDefaultPositionalMapping(
override val aes: AesName,
override val columnScaled: ColumnScaledUnspecifiedDefault,
@Serializable(KTypeSerializer::class) override val domainType: KType
) : BaseScaledPositionalMapping, ScaledUnspecifiedDefaultMapping {
override var scaleParameters: ScaleParameters? = null
}
/**
* Non-positional mapping with an unspecified default scale.
*
* @property aes the aesthetic attribute to be mapped to
* @property columnScaled the scaled default unspecified source to which the mapping is applied
* @property domainType type of domain
*/
@Serializable
public data class ScaledUnspecifiedDefaultNonPositionalMapping(
override val aes: AesName,
override val columnScaled: ColumnScaledUnspecifiedDefault,
@Serializable(KTypeSerializer::class) override val domainType: KType
) : BaseScaledNonPositionalMapping, ScaledUnspecifiedDefaultMapping {
override var scaleParameters: ScaleParameters? = null
}
/**
* Positional mapping with a default scale.
*
* @property aes the aesthetic attribute to be mapped to
* @property columnScaled the scaled default positional source to which the mapping is applied
* @property domainType type of domain
*/
@Serializable
public data class ScaledPositionalUnspecifiedMapping(
override val aes: AesName,
override val columnScaled: ColumnScaledPositionalUnspecified,
@Serializable(KTypeSerializer::class) override val domainType: KType
) : BaseScaledPositionalMapping {
override var scaleParameters: ScaleParameters? = null
}
/**
* Non-positional mapping with a default scale.
*
* @property aes the aesthetic attribute to be mapped to
* @property columnScaled the scaled default non-positional source to which the mapping is applied
* @property domainType type of domain
*/
@Serializable
public data class ScaledNonPositionalUnspecifiedMapping(
override val aes: AesName,
override val columnScaled: ColumnScaledNonPositionalUnspecified,
@Serializable(KTypeSerializer::class) override val domainType: KType
) : BaseScaledNonPositionalMapping {
override var scaleParameters: ScaleParameters? = null
}
/**
* Positional mapping with an explicit scale.
*
* @property aes the aesthetic attribute to be mapped to
* @property columnScaled the scaled positional source to which the mapping is applied
* @property domainType type of domain
*/
@Serializable
public data class ScaledPositionalMapping(
override val aes: AesName,
override val columnScaled: ColumnScaledPositional,
@Serializable(KTypeSerializer::class) override val domainType: KType
) : BaseScaledPositionalMapping {
override var scaleParameters: ScaleParameters? = null
}
/**
* Non-positional mapping with an explicit scale.
*
* @property aes the aesthetic attribute to be mapped to
* @property columnScaled the scaled non-positional source to which the mapping is applied
* @property domainType type of domain
*/
@Serializable
public data class ScaledNonPositionalMapping(
override val aes: AesName,
override val columnScaled: ColumnScaledNonPositional,
@Serializable(KTypeSerializer::class) override val domainType: KType,
) : BaseScaledNonPositionalMapping {
override var scaleParameters: ScaleParameters? = null
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy