diff --git a/src/org/geometerplus/android/fbreader/ZLTreeAdapter.java b/src/org/geometerplus/android/fbreader/ZLTreeAdapter.java index 7a91e5025..04a6c0619 100644 --- a/src/org/geometerplus/android/fbreader/ZLTreeAdapter.java +++ b/src/org/geometerplus/android/fbreader/ZLTreeAdapter.java @@ -121,7 +121,7 @@ public abstract class ZLTreeAdapter extends BaseAdapter implements AdapterView.O final int index = indexByPosition(position + 1, myTree) - 1; ZLTree item = myItems[index]; if (item == null) { - item = myTree.getTree(index + 1); + item = myTree.getTreeByParagraphNumber(index + 1); myItems[index] = item; } return item; diff --git a/src/org/geometerplus/fbreader/bookmodel/BookReader.java b/src/org/geometerplus/fbreader/bookmodel/BookReader.java index 99be5486d..d71c7913d 100644 --- a/src/org/geometerplus/fbreader/bookmodel/BookReader.java +++ b/src/org/geometerplus/fbreader/bookmodel/BookReader.java @@ -352,7 +352,7 @@ public class BookReader { public final void setReference(int contentsParagraphNumber, ZLTextWritableModel textModel, int referenceNumber) { final TOCTree contentsTree = Model.TOCTree; if (contentsParagraphNumber < contentsTree.getSize()) { - contentsTree.getTree(contentsParagraphNumber).setReference( + contentsTree.getTreeByParagraphNumber(contentsParagraphNumber).setReference( textModel, referenceNumber ); } diff --git a/src/org/geometerplus/fbreader/network/NetworkBookItem.java b/src/org/geometerplus/fbreader/network/NetworkBookItem.java index 33c91076c..d854e4966 100644 --- a/src/org/geometerplus/fbreader/network/NetworkBookItem.java +++ b/src/org/geometerplus/fbreader/network/NetworkBookItem.java @@ -77,15 +77,8 @@ public class NetworkBookItem extends NetworkLibraryItem { Language = language; Date = date; Price = price; - - List authors2 = new LinkedList(); - authors2.addAll(authors); - Authors = Collections.unmodifiableList(authors2); - - List tags2 = new LinkedList(); - tags2.addAll(tags); - Tags = Collections.unmodifiableList(tags2); - + Authors = new LinkedList(authors); + Tags = new LinkedList(tags); SeriesTitle = seriesTitle; IndexInSeries = indexInSeries; } diff --git a/src/org/geometerplus/fbreader/network/NetworkLibrary.java b/src/org/geometerplus/fbreader/network/NetworkLibrary.java index 90b98ef5d..eda97f1d6 100644 --- a/src/org/geometerplus/fbreader/network/NetworkLibrary.java +++ b/src/org/geometerplus/fbreader/network/NetworkLibrary.java @@ -53,7 +53,7 @@ public class NetworkLibrary { } private void makeUpToDate() { - final List toRemove = new LinkedList(); + final LinkedList toRemove = new LinkedList(); Iterator nodeIterator = myRootTree.iterator(); FBTree currentNode = null; diff --git a/src/org/geometerplus/fbreader/network/atom/ATOMCategory.java b/src/org/geometerplus/fbreader/network/atom/ATOMCategory.java index 98ab62961..577608fcf 100644 --- a/src/org/geometerplus/fbreader/network/atom/ATOMCategory.java +++ b/src/org/geometerplus/fbreader/network/atom/ATOMCategory.java @@ -37,14 +37,14 @@ public class ATOMCategory extends ATOMCommonAttributes { } public final String getTerm() { - return Attributes.get(TERM); + return getAttribute(TERM); } public final String getScheme() { - return Attributes.get(SCHEME); + return getAttribute(SCHEME); } public final String getLabel() { - return Attributes.get(LABEL); + return getAttribute(LABEL); } } diff --git a/src/org/geometerplus/fbreader/network/atom/ATOMCommonAttributes.java b/src/org/geometerplus/fbreader/network/atom/ATOMCommonAttributes.java index 102a8f623..02d4b7679 100644 --- a/src/org/geometerplus/fbreader/network/atom/ATOMCommonAttributes.java +++ b/src/org/geometerplus/fbreader/network/atom/ATOMCommonAttributes.java @@ -26,7 +26,7 @@ abstract class ATOMCommonAttributes { public static final String XML_BASE = "xml:base"; public static final String XML_LANG = "xml:lang"; - public final Map Attributes = new TreeMap(); + private TreeMap myAttributes = null; public void readAttributes(Map source) { readAttribute(XML_BASE, source); @@ -36,15 +36,25 @@ abstract class ATOMCommonAttributes { protected final void readAttribute(String name, Map source) { String value = source.get(name); if (value != null) { - Attributes.put(name, value); + if (myAttributes == null) { + myAttributes = new TreeMap(); + } + myAttributes.put(name, value); } } + public final String getAttribute(String name) { + if (myAttributes == null) { + return null; + } + return myAttributes.get(name); + } + public final String getLang() { - return Attributes.get(XML_LANG); + return getAttribute(XML_LANG); } public final String getBase() { - return Attributes.get(XML_BASE); + return getAttribute(XML_BASE); } } diff --git a/src/org/geometerplus/fbreader/network/atom/ATOMGenerator.java b/src/org/geometerplus/fbreader/network/atom/ATOMGenerator.java index f02ea7d7f..d1e78d426 100644 --- a/src/org/geometerplus/fbreader/network/atom/ATOMGenerator.java +++ b/src/org/geometerplus/fbreader/network/atom/ATOMGenerator.java @@ -41,10 +41,10 @@ public class ATOMGenerator extends ATOMCommonAttributes { } public final String getUri() { - return Attributes.get(URI); + return getAttribute(URI); } public final String getVersion() { - return Attributes.get(VERSION); + return getAttribute(VERSION); } } diff --git a/src/org/geometerplus/fbreader/network/atom/ATOMLink.java b/src/org/geometerplus/fbreader/network/atom/ATOMLink.java index 486f5d5c6..c25c9005e 100644 --- a/src/org/geometerplus/fbreader/network/atom/ATOMLink.java +++ b/src/org/geometerplus/fbreader/network/atom/ATOMLink.java @@ -43,26 +43,26 @@ public class ATOMLink extends ATOMCommonAttributes { } public final String getHref() { - return Attributes.get(HREF); + return getAttribute(HREF); } public final String getRel() { - return Attributes.get(REL); + return getAttribute(REL); } public final String getType() { - return Attributes.get(TYPE); + return getAttribute(TYPE); } public final String getHrefLang() { - return Attributes.get(HREFLANG); + return getAttribute(HREFLANG); } public final String getTitle() { - return Attributes.get(TITLE); + return getAttribute(TITLE); } public final String getLength() { - return Attributes.get(LENGTH); + return getAttribute(LENGTH); } } diff --git a/src/org/geometerplus/zlibrary/core/network/ZLNetworkRequest.java b/src/org/geometerplus/zlibrary/core/network/ZLNetworkRequest.java deleted file mode 100644 index fd5e06a50..000000000 --- a/src/org/geometerplus/zlibrary/core/network/ZLNetworkRequest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2010 Geometer Plus - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. - */ - -package org.geometerplus.zlibrary.core.network; - -import java.io.*; - - -public abstract class ZLNetworkRequest { - - public final String Url; - public String ErrorMessage; - - private String myUserName; - private String myPassword; - private boolean myRedirectionSupported; - - protected ZLNetworkRequest(String url) { - Url = url; - } - - public final void setRedirectionSupported(boolean supported) { - myRedirectionSupported = supported; - } - - public final void setupAuthentication(String userName, String password) { - myUserName = userName; - myPassword = password; - } - - protected abstract boolean handleStream(InputStream stream); -} diff --git a/src/org/geometerplus/zlibrary/core/tree/ZLTree.java b/src/org/geometerplus/zlibrary/core/tree/ZLTree.java index ebe54717f..8804d26b0 100644 --- a/src/org/geometerplus/zlibrary/core/tree/ZLTree.java +++ b/src/org/geometerplus/zlibrary/core/tree/ZLTree.java @@ -60,7 +60,7 @@ public abstract class ZLTree implements Iterable { return mySubTrees; } - public final T getTree(int index) { + public final T getTreeByParagraphNumber(int index) { if ((index < 0) || (index >= mySize)) { // TODO: throw exception? return null; @@ -73,7 +73,7 @@ public abstract class ZLTree implements Iterable { if (subtree.mySize <= index) { index -= subtree.mySize; } else { - return (T)subtree.getTree(index); + return (T)subtree.getTreeByParagraphNumber(index); } } throw new RuntimeException("That's impossible!!!");