Add toString to models

pull/168/head
Koitharu 3 years ago
parent 413f4a2f10
commit fc53b19915
No known key found for this signature in database
GPG Key ID: 8E861F8CE6E7CE27

@ -155,4 +155,8 @@ class Manga(
result = 31 * result + source.hashCode() result = 31 * result + source.hashCode()
return result return result
} }
override fun toString(): String {
return "Manga($id - \"$title\" [$url] - $source)"
}
} }

@ -67,4 +67,8 @@ class MangaChapter(
result = 31 * result + source.hashCode() result = 31 * result + source.hashCode()
return result return result
} }
override fun toString(): String {
return "MangaChapter($id - #$number [$url] - $source)"
}
} }

@ -3,49 +3,45 @@ package org.koitharu.kotatsu.parsers.model
import org.koitharu.kotatsu.parsers.MangaParser import org.koitharu.kotatsu.parsers.MangaParser
class MangaPage( class MangaPage(
/** /**
* Unique identifier for manga * Unique identifier for manga
*/ */
val id: Long, val id: Long,
/** /**
* Relative url to page (**without** a domain) or any other uri. * Relative url to page (**without** a domain) or any other uri.
* Used principally in parsers. * Used principally in parsers.
* May contain link to image or html page. * May contain link to image or html page.
* @see MangaParser.getPageUrl * @see MangaParser.getPageUrl
*/ */
val url: String, val url: String,
/** /**
* Absolute link to the chapter or website home page. * Absolute url of the small page image if exists, null otherwise
* Used in Referer header */
*/ val preview: String?,
@Deprecated("Referer header should be added based on source domain") val source: MangaSource,
val referer: String,
/**
* Absolute url of the small page image if exists, null otherwise
*/
val preview: String?,
val source: MangaSource,
) { ) {
override fun equals(other: Any?): Boolean { override fun equals(other: Any?): Boolean {
if (this === other) return true if (this === other) return true
if (javaClass != other?.javaClass) return false if (javaClass != other?.javaClass) return false
other as MangaPage other as MangaPage
if (id != other.id) return false if (id != other.id) return false
if (url != other.url) return false if (url != other.url) return false
if (referer != other.referer) return false if (preview != other.preview) return false
if (preview != other.preview) return false return source == other.source
return source == other.source }
}
override fun hashCode(): Int { override fun hashCode(): Int {
var result = id.hashCode() var result = id.hashCode()
result = 31 * result + url.hashCode() result = 31 * result + url.hashCode()
result = 31 * result + referer.hashCode() result = 31 * result + (preview?.hashCode() ?: 0)
result = 31 * result + (preview?.hashCode() ?: 0) result = 31 * result + source.hashCode()
result = 31 * result + source.hashCode() return result
return result }
}
override fun toString(): String {
return "MangaPage($id [$url] - $source)"
}
} }

@ -34,4 +34,8 @@ class MangaTag(
result = 31 * result + source.hashCode() result = 31 * result + source.hashCode()
return result return result
} }
override fun toString(): String {
return "MangaTag($key \"$title\" - $source)"
}
} }
Loading…
Cancel
Save