优化
This commit is contained in:
@@ -1,18 +1,17 @@
|
||||
package io.legado.app.ui.book.read.page.entities
|
||||
|
||||
@Suppress("unused")
|
||||
@Suppress("unused", "MemberVisibilityCanBePrivate")
|
||||
data class TextParagraph(
|
||||
var num: Int,
|
||||
val textLines: ArrayList<TextLine> = arrayListOf(),
|
||||
) : Iterable<TextLine> {
|
||||
) {
|
||||
val text: String get() = textLines.joinToString("") { it.text }
|
||||
val length: Int get() = text.length
|
||||
val chapterIndices: IntRange get() = first().chapterPosition..last().chapterPosition + last().charSize
|
||||
val chapterPosition: Int get() = first().chapterPosition
|
||||
val realNum: Int get() = first().paragraphNum
|
||||
val isParagraphEnd: Boolean get() = last().isParagraphEnd
|
||||
val firstLine: TextLine get() = textLines.first()
|
||||
val lastLine: TextLine get() = textLines.last()
|
||||
val chapterIndices: IntRange get() = firstLine.chapterPosition..lastLine.chapterPosition + lastLine.charSize
|
||||
val chapterPosition: Int get() = firstLine.chapterPosition
|
||||
val realNum: Int get() = firstLine.paragraphNum
|
||||
val isParagraphEnd: Boolean get() = lastLine.isParagraphEnd
|
||||
|
||||
override fun iterator(): Iterator<TextLine> {
|
||||
return textLines.iterator()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user