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

commonMain.com.divpundir.mavlink.api.MavEnumValue.kt Maven / Gradle / Ivy

There is a newer version: 1.2.8
Show newest version
package com.divpundir.mavlink.api

/**
 * Wrapper class for a [MavEnum].
 */
public class MavEnumValue private constructor(public val entry: E?, public val value: UInt) {

    public companion object {

        public fun  of(entry: E): MavEnumValue = MavEnumValue(entry, entry.value)

        public fun  fromValue(value: UInt): MavEnumValue = MavEnumValue(null, value)
    }

    override fun equals(other: Any?): Boolean {
        if (this === other) return true
        if (other == null || this::class != other::class) return false

        other as MavEnumValue<*>

        return value == other.value
    }

    override fun hashCode(): Int = value.hashCode()

    override fun toString(): String = "MavEnumValue(entry=$entry, value=$value)"
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy