[Workspace Model] Use custom equals/hashCode for PId

GitOrigin-RevId: 114e71f2126d9056613585c3b90e887f6f5f3376
This commit is contained in:
Alex Plate
2020-05-09 05:25:10 +00:00
committed by intellij-monorepo-bot
parent 285eee7709
commit f34ef6aabf
@@ -79,7 +79,25 @@ internal data class PId<E : TypedEntity>(val arrayId: Int, val clazz: KClass<E>)
if (arrayId < 0) error("ArrayId cannot be negative: $arrayId")
}
override fun toString(): String = clazz.simpleName + "-:-"+ arrayId.toString()
override fun toString(): String = clazz.simpleName + "-:-" + arrayId.toString()
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
other as PId<*>
if (arrayId != other.arrayId) return false
if (clazz.java != other.clazz.java) return false
return true
}
override fun hashCode(): Int {
var result = arrayId
result = 31 * result + clazz.java.hashCode()
return result
}
}
interface PSoftLinkable {