You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mahout.apache.org by ot...@apache.org on 2009/04/15 17:34:46 UTC

svn commit: r765244 - /lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/common/RefreshHelper.java

Author: otis
Date: Wed Apr 15 15:34:46 2009
New Revision: 765244

URL: http://svn.apache.org/viewvc?rev=765244&view=rev
Log:
- A bit of javadoc and a bit of logging to make things more transparent

Modified:
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/common/RefreshHelper.java

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/common/RefreshHelper.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/common/RefreshHelper.java?rev=765244&r1=765243&r2=765244&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/common/RefreshHelper.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/common/RefreshHelper.java Wed Apr 15 15:34:46 2009
@@ -78,15 +78,28 @@
     }
   }
 
+  /**
+   * Creates a new and empty {@link FastSet} of size 3 if the method parameter is <code>null</code>.
+   * @param currentAlreadyRefreshed {@link Refreshable}s to refresh later on
+   * @return an empty {@link FastSet} if the method param was <code>null</code> or the unmodified method param. 
+   */
   public static Collection<Refreshable> buildRefreshed(Collection<Refreshable> currentAlreadyRefreshed) {
     return currentAlreadyRefreshed == null ? new FastSet<Refreshable>(3) : currentAlreadyRefreshed;
   }
 
+  /**
+   * Adds the specified {@link Refreshable} to the given collection of {@link Refreshable}s if it is not
+   * already there and immediately refreshes it.
+   * @param alreadyRefreshed the collection of {@link Refreshable}s
+   * @param refreshable the {@link Refreshable} to potentially add and refresh
+   */
   public static void maybeRefresh(Collection<Refreshable> alreadyRefreshed, Refreshable refreshable) {
+    log.debug("In Maybe refresh: " + refreshable);
     if (!alreadyRefreshed.contains(refreshable)) {
       alreadyRefreshed.add(refreshable);
+      log.info("Added refreshable: " + refreshable);
       refreshable.refresh(alreadyRefreshed);
+      log.info("Refreshed: " + alreadyRefreshed);
     }
   }
-
 }