assignment.Assignment.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of experiment-jvm-server Show documentation
Show all versions of experiment-jvm-server Show documentation
Amplitude Experiment server-side SDK for JVM (Java, Kotlin)
package com.amplitude.experiment.assignment
import com.amplitude.experiment.ExperimentUser
import com.amplitude.experiment.Variant
internal const val DAY_MILLIS: Long = 24 * 60 * 60 * 1000
internal data class Assignment(
val user: ExperimentUser,
val results: Map,
val timestamp: Long = System.currentTimeMillis(),
)
internal fun Assignment.canonicalize(): String {
val sb = StringBuilder().append(this.user.userId?.trim(), " ", this.user.deviceId?.trim(), " ")
for (key in this.results.keys.sorted()) {
val value = this.results[key]
sb.append(key.trim(), " ", value?.key?.trim(), " ")
}
return sb.toString()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy