Update AnalyzeByJSoup.kt

继续优化代码,避免不必要的操作
pull/1097/head
bushixuanqi 3 years ago committed by GitHub
parent a04e54543c
commit ad22929c38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeByJSoup.kt

@ -236,13 +236,16 @@ class AnalyzeByJSoup(doc: Any) {
else -> {
indexSet.indexs.add( //压入以下值,为保证查找顺序,区间和单个索引都添加到同一集合
//为保证查找顺序,区间和单个索引都添加到同一集合
if(curList.isEmpty())indexSet.indexs.add(curInt!!)
else{
if(curList.isEmpty()) curInt!! //区间为空,表明当前是单个索引,单个索引不能空
//列表最后压入的是区间右端,若列表有两位则最先压入的是间隔
indexSet.indexs.add( Triple(curInt, curList.last(), if(curList.size == 2) curList.first() else 1) )
else Triple(curInt, curList.last(), if(curList.size == 2) curList.first() else 1) //否则为区间,列表最后压入的是区间右端,若列表有两位则最先压入了间隔
curList.clear() //重置临时列表,避免影响到下个区间的处理
)
}
if(rl == '!'){
indexSet.split='!'
@ -254,7 +257,6 @@ class AnalyzeByJSoup(doc: Any) {
} //遇到索引边界,返回结果
if(rl != ',') break //非索引结构,跳出
curList.clear() //重置
}
}

Loading…
Cancel
Save