Convert Js5MasterIndex.Entry to a data class

Spotted by Desetude.

I think this was an accident, as the similar Js5Index.Entry class can't
be a data class (as it contains an array).

Signed-off-by: Graham <gpe@openrs2.org>
pull/132/head
Graham 3 years ago
parent 59b307360b
commit 61d525c542
  1. 24
      cache/src/main/kotlin/org/openrs2/cache/Js5MasterIndex.kt

@ -3,29 +3,7 @@ package org.openrs2.cache
import io.netty.buffer.ByteBuf
public inline class Js5MasterIndex(public val entries: MutableList<Entry> = mutableListOf()) {
public class Entry(public var version: Int, public var checksum: Int) {
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
other as Entry
if (version != other.version) return false
if (checksum != other.checksum) return false
return true
}
override fun hashCode(): Int {
var result = version
result = 31 * result + checksum
return result
}
override fun toString(): String {
return "Entry{version=$version, checksum=$checksum}"
}
}
public data class Entry(public var version: Int, public var checksum: Int)
public fun write(buf: ByteBuf) {
for (entry in entries) {

Loading…
Cancel
Save