Skip to content

Commit

Permalink
Simplified the code a bit to use foreach loops and generics
Browse files Browse the repository at this point in the history
  • Loading branch information
rictic committed Aug 23, 2008
1 parent 73c1977 commit 5f9128d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 20 deletions.
5 changes: 4 additions & 1 deletion src/MainView.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import java.io.InputStream;
import java.util.logging.LogManager;
import java.util.prefs.Preferences;
import javax.swing.JRootPane;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

Expand All @@ -45,6 +44,10 @@ public class MainView extends javax.swing.JFrame {
// depending on the URL and/or other settings.

/**
*
*/
private static final long serialVersionUID = 1L;
/**
* initializes the Dialog and sets the dialog-values according to the
* user's preferences (the last values entered).
* @param args java arguments passed to the main method. The first parameter
Expand Down
10 changes: 2 additions & 8 deletions src/org/codeswarm/repository/svn/AbstractSVNHistoryVisitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
package org.codeswarm.repository.svn;

import java.util.Collection;
import java.util.Iterator;

import org.codeswarm.repository.RepositoryHistoryVisitor;
import org.tmatesoft.svn.core.SVNException;
Expand Down Expand Up @@ -128,7 +127,7 @@ public void run(String url, Long pStartrevision, Long pEndrevision, String name,
}
}

Collection logEntries = null;
Collection<SVNLogEntry> logEntries = null;
try {
/*
* Collects SVNLogEntry objects for all revisions in the range
Expand Down Expand Up @@ -168,12 +167,7 @@ public void run(String url, Long pStartrevision, Long pEndrevision, String name,
} catch (SVNException svne) {
handleCollectingLogInformationException(svne,url);
}
for (Iterator entries = logEntries.iterator(); entries.hasNext();) {

/*
* gets a next SVNLogEntry
*/
SVNLogEntry logEntry = (SVNLogEntry) entries.next();
for (SVNLogEntry logEntry : logEntries) {
handleLogEntry(logEntry);
}
finishLogEntries();
Expand Down
16 changes: 5 additions & 11 deletions src/org/codeswarm/repository/svn/SVNHistory.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.codeswarm.repositoryevents.CodeSwarmEventsSerializer;
import org.codeswarm.repositoryevents.Event;
import java.io.IOException;
import java.util.Iterator;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
Expand Down Expand Up @@ -105,10 +104,8 @@ public boolean handleFetchingLatestRepositoryRevision(Long pRevision) {
* @param logEntry the entry to process
*/
public void handleLogEntry(SVNLogEntry logEntry) {
Set keySet = logEntry.getChangedPaths().keySet();
Iterator i = keySet.iterator();
while(i.hasNext()){
String key = (String)i.next();
Set<String> keySet = logEntry.getChangedPaths().keySet();
for(String key : keySet){
SVNLogEntryPath entryPath = (SVNLogEntryPath) logEntry.getChangedPaths().get(key);
list.addEvent(new Event(entryPath.getPath(),logEntry.getDate().getTime(),logEntry.getAuthor()));
if(LOGGER.isLoggable(Level.FINE)){
Expand All @@ -123,13 +120,10 @@ public void handleLogEntry(SVNLogEntry logEntry) {
/*
* keys are changed paths
*/
Set changedPathsSet = logEntry.getChangedPaths().keySet();
Set<String> changedPathsSet = logEntry.getChangedPaths().keySet();

for (Iterator changedPaths = changedPathsSet.iterator(); changedPaths.hasNext();) {
/*
* obtains a next SVNLogEntryPath
*/
SVNLogEntryPath entryPath = (SVNLogEntryPath) logEntry.getChangedPaths().get(changedPaths.next());
for (String changedPath : changedPathsSet) {
SVNLogEntryPath entryPath = (SVNLogEntryPath) logEntry.getChangedPaths().get(changedPath);
/*
* SVNLogEntryPath.getPath returns the changed path itself;
*
Expand Down

0 comments on commit 5f9128d

Please sign in to comment.