Convert more classes to data classes
parent
74ca19a931
commit
ad3b5dde91
@ -1,29 +1,8 @@
|
||||
package org.koitharu.kotatsu.scrobbling.common.domain.model
|
||||
|
||||
class ScrobblerUser(
|
||||
data class ScrobblerUser(
|
||||
val id: Long,
|
||||
val nickname: String,
|
||||
val avatar: String,
|
||||
val service: ScrobblerService,
|
||||
) {
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as ScrobblerUser
|
||||
|
||||
if (id != other.id) return false
|
||||
if (nickname != other.nickname) return false
|
||||
if (avatar != other.avatar) return false
|
||||
return service == other.service
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = id.hashCode()
|
||||
result = 31 * result + nickname.hashCode()
|
||||
result = 31 * result + avatar.hashCode()
|
||||
result = 31 * result + service.hashCode()
|
||||
return result
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
@ -1,51 +1,13 @@
|
||||
package org.koitharu.kotatsu.settings.userdata
|
||||
|
||||
class StorageUsage(
|
||||
data class StorageUsage(
|
||||
val savedManga: Item,
|
||||
val pagesCache: Item,
|
||||
val otherCache: Item,
|
||||
val available: Item,
|
||||
) {
|
||||
|
||||
class Item(
|
||||
data class Item(
|
||||
val bytes: Long,
|
||||
val percent: Float,
|
||||
) {
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as Item
|
||||
|
||||
if (bytes != other.bytes) return false
|
||||
return percent == other.percent
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = bytes.hashCode()
|
||||
result = 31 * result + percent.hashCode()
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as StorageUsage
|
||||
|
||||
if (savedManga != other.savedManga) return false
|
||||
if (pagesCache != other.pagesCache) return false
|
||||
if (otherCache != other.otherCache) return false
|
||||
return available == other.available
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = savedManga.hashCode()
|
||||
result = 31 * result + pagesCache.hashCode()
|
||||
result = 31 * result + otherCache.hashCode()
|
||||
result = 31 * result + available.hashCode()
|
||||
return result
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@ -1,29 +1,8 @@
|
||||
package org.koitharu.kotatsu.sync.domain
|
||||
|
||||
class SyncAuthResult(
|
||||
data class SyncAuthResult(
|
||||
val host: String,
|
||||
val email: String,
|
||||
val password: String,
|
||||
val token: String,
|
||||
) {
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as SyncAuthResult
|
||||
|
||||
if (host != other.host) return false
|
||||
if (email != other.email) return false
|
||||
if (password != other.password) return false
|
||||
return token == other.token
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = host.hashCode()
|
||||
result = 31 * result + email.hashCode()
|
||||
result = 31 * result + password.hashCode()
|
||||
result = 31 * result + token.hashCode()
|
||||
return result
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
Loading…
Reference in New Issue