1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-05 10:49:24 +02:00

autosorting for AuthorTree's

This commit is contained in:
Nikolay Pultsin 2011-07-17 14:16:24 +01:00
parent 05365b01d1
commit 31075d08a0
3 changed files with 19 additions and 13 deletions

View file

@ -56,8 +56,14 @@ public abstract class LibraryTree extends FBTree {
return new TitleTree(this, title);
}
AuthorTree createAuthorSubTree(Author author) {
return new AuthorTree(this, author);
AuthorTree getAuthorSubTree(Author author) {
final AuthorTree temp = new AuthorTree(author);
int position = Collections.binarySearch(subTrees(), temp);
if (position >= 0) {
return (AuthorTree)subTrees().get(position);
} else {
return new AuthorTree(this, author, - position - 1);
}
}
BookTree createBookSubTree(Book book, boolean showAuthors) {