All Downloads are FREE. Search and download functionalities are using the official Maven repository.

assignment.Assignment.kt Maven / Gradle / Ivy

There is a newer version: 1.6.1
Show newest version
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