1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-04 02:09:35 +02:00

More custom catalogs constraints: title and sitenames are required to be unique

git-svn-id: https://only.mawhrin.net/repos/FBReaderJ/trunk@1642 6a642e6f-84f6-412e-ac94-c4a38d5a04b0
This commit is contained in:
Vasiliy Bout 2010-08-03 11:49:47 +00:00
parent 427640f0c3
commit 5f6b62b8de
10 changed files with 36 additions and 14 deletions

View file

@ -475,13 +475,13 @@ public class NetworkLibrary {
link.saveLink();
}
public int getCustomLinksNumber() {
/*public int getCustomLinksNumber() {
return myCustomLinks.size();
}
public ICustomNetworkLink getCustomLink(int index) {
return myCustomLinks.get(index);
}
}*/
public void removeCustomLink(ICustomNetworkLink link) {
final int index = Collections.binarySearch(myCustomLinks, link, new LinksComparator());
@ -493,12 +493,21 @@ public class NetworkLibrary {
link.setSaveLinkListener(null);
}
public boolean hasCustomLink(String title, ICustomNetworkLink exeptFor) {
for (ICustomNetworkLink link: myCustomLinks) {
public boolean hasCustomLinkTitle(String title, ICustomNetworkLink exeptFor) {
for (INetworkLink link: myLinks) {
if (link != exeptFor && link.getTitle().equals(title)) {
return true;
}
}
return false;
}
public boolean hasCustomLinkSite(String siteName, ICustomNetworkLink exeptFor) {
for (INetworkLink link: myLinks) {
if (link != exeptFor && link.getSiteName().equals(siteName)) {
return true;
}
}
return false;
}
}