mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-05 10:49:24 +02:00
library auto-sorting
This commit is contained in:
parent
31075d08a0
commit
f79aaeb132
10 changed files with 97 additions and 60 deletions
|
@ -19,6 +19,8 @@
|
|||
|
||||
package org.geometerplus.fbreader.library;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
public class AuthorTree extends LibraryTree {
|
||||
public final Author Author;
|
||||
|
||||
|
@ -31,8 +33,14 @@ public class AuthorTree extends LibraryTree {
|
|||
Author = author;
|
||||
}
|
||||
|
||||
SeriesTree createSeriesSubTree(String series) {
|
||||
return new SeriesTree(this, series);
|
||||
SeriesTree getSeriesSubTree(String series) {
|
||||
final SeriesTree temp = new SeriesTree(series);
|
||||
int position = Collections.binarySearch(subTrees(), temp);
|
||||
if (position >= 0) {
|
||||
return (SeriesTree)subTrees().get(position);
|
||||
} else {
|
||||
return new SeriesTree(this, series, - position - 1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue