[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[Subclipse-dev] [Patch] isKnownRepository improvement in SVNRepositories.java

From: Laszlo Biczok <biczok_at_freemail.hu>
Date: Thu, 19 Feb 2009 02:12:00 -0800 (PST)

Hi,

If my previous suggestion about the unnecessary iteration in SVNRepositories.java is accepted, then isKnownRepository() can be improved by taking advantage of the improvement of exactMatchExists() by separating the exact match check from the rest.
The suggested modification is below.

Cheers,

Laca

### Eclipse Workspace Patch 1.0
#P org.tigris.subversion.subclipse.core
Index: src/org/tigris/subversion/subclipse/core/repo/SVNRepositories.java
===================================================================
--- src/org/tigris/subversion/subclipse/core/repo/SVNRepositories.java (revision 4302)
+++ src/org/tigris/subversion/subclipse/core/repo/SVNRepositories.java (working copy)
@@ -364,15 +364,19 @@
     * The location string corresponds to the Strin returned by ISVNRepositoryLocation#getLocation()
     */
    public boolean isKnownRepository(String location, boolean requireExactMatch) {
- Set keys = repositories.keySet();
- for(Iterator iter = keys.iterator();iter.hasNext();){
- String checkLocation = (String)iter.next();
- if(!requireExactMatch && location.indexOf(checkLocation)!=-1){
- return true;
- }
- if (location.equals(checkLocation)) return true;
- }
- return false;
+ if(requireExactMatch) {
+ return exactMatchExists(location);
+ }
+ else{
+ Set keys = repositories.keySet();
+ for(Iterator iter = keys.iterator();iter.hasNext();){
+ String checkLocation = (String)iter.next();
+ if(location.indexOf(checkLocation)!=-1){
+ return true;
+ }
+ }
+ return false;
+ }
    }

------------------------------------------------------
http://subclipse.tigris.org/ds/viewMessage.do?dsForumId=1043&dsMessageId=1191152

To unsubscribe from this discussion, e-mail: [dev-unsubscribe_at_subclipse.tigris.org].
Received on 2009-02-19 13:29:30 CET

This is an archived mail posted to the Subclipse Dev mailing list.