0
0
mirror of https://github.com/ankidroid/Anki-Android.git synced 2024-09-20 12:02:16 +02:00

refactor: convert Finder to Kotlin

com.ichi2.libanki.Finder

Note: migrate.sh failed on this one
This commit is contained in:
David Allison 2022-08-21 16:44:26 +01:00 committed by Mike Hardy
parent b5706047c8
commit 0c89553592
3 changed files with 627 additions and 738 deletions

View File

@ -43,7 +43,7 @@ permission notice:
// Example of class name: "/com/ichi2/anki/UIUtils.kt"
// Ensure that it starts with '/' (slash)
def source = Source.MAIN
def className = "/com/ichi2/libanki/Finder.kt"
def className = ""
enum Source {
MAIN("/src/main/java"),

View File

@ -1324,7 +1324,7 @@ open class Collection(
/** Return a list of card ids */
@RustCleanup("Remove in V16.") // Not in libAnki
fun findOneCardByNote(query: String?): List<Long> {
return Finder(this).findOneCardByNote(query)
return Finder(this).findOneCardByNote(query!!)
}
/** Return a list of note ids
@ -1336,15 +1336,15 @@ open class Collection(
}
fun findReplace(nids: List<Long?>?, src: String?, dst: String?): Int {
return Finder.findReplace(this, nids, src, dst)
return Finder.findReplace(this, nids!!, src!!, dst!!)
}
fun findReplace(nids: List<Long?>?, src: String?, dst: String?, regex: Boolean): Int {
return Finder.findReplace(this, nids, src, dst, regex)
return Finder.findReplace(this, nids!!, src!!, dst!!, regex)
}
fun findReplace(nids: List<Long?>?, src: String?, dst: String?, field: String?): Int {
return Finder.findReplace(this, nids, src, dst, field)
return Finder.findReplace(this, nids!!, src!!, dst!!, field = field)
}
@KotlinCleanup("JvmOverloads")
@ -1357,7 +1357,7 @@ open class Collection(
field: String?,
fold: Boolean
): Int {
return Finder.findReplace(this, nids, src, dst, regex, field, fold)
return Finder.findReplace(this, nids!!, src!!, dst!!, regex, field, fold)
}
fun findDupes(fieldName: String?): List<Pair<String, List<Long>>> {

File diff suppressed because it is too large Load Diff