aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils/NEUInternalName.kt
blob: 8e9b8efc28aabf1351bc7e20c8face4937c88cac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package at.hannibal2.skyhanni.utils

class NEUInternalName private constructor(private val internalName: String) {

    companion object {
        private val map = mutableMapOf<String, NEUInternalName>()

        fun from(name: String): NEUInternalName {
            val internalName = name.uppercase()
            return map.getOrPut(internalName) { NEUInternalName(internalName) }
        }
    }

    fun asString() = internalName

    override fun equals(other: Any?): Boolean {
        if (other is NEUInternalName) {
            return internalName == other.internalName
        }
        return super.equals(other)
    }

    override fun toString(): String {
        return "internalName:$internalName"
    }

//    fun equals(other: String) = internalName == other
}