mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-21 20:47:03 -05:00
Restore equals/hashCode in ChapterTransition (closes #2461)
This commit is contained in:
parent
ea226a1697
commit
f4f427dd2a
1 changed files with 14 additions and 0 deletions
|
@ -12,6 +12,20 @@ sealed class ChapterTransition {
|
||||||
override val from: ReaderChapter, override val to: ReaderChapter?
|
override val from: ReaderChapter, override val to: ReaderChapter?
|
||||||
) : ChapterTransition()
|
) : ChapterTransition()
|
||||||
|
|
||||||
|
override fun equals(other: Any?): Boolean {
|
||||||
|
if (this === other) return true
|
||||||
|
if (other !is ChapterTransition) return false
|
||||||
|
if (from == other.from && to == other.to) return true
|
||||||
|
if (from == other.to && to == other.from) return true
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun hashCode(): Int {
|
||||||
|
var result = from.hashCode()
|
||||||
|
result = 31 * result + (to?.hashCode() ?: 0)
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
return "${javaClass.simpleName}(from=${from.chapter.url}, to=${to?.chapter?.url})"
|
return "${javaClass.simpleName}(from=${from.chapter.url}, to=${to?.chapter?.url})"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue