|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.mahout.cf.taste.impl.common.RefreshHelper
public final class RefreshHelper
A helper class for implementing Refreshable. This object is typically included in an implementation
Refreshable to implement Refreshable.refresh(Collection). It execute the class's own
supplied update logic, after updating all the object's dependencies. This also ensures that dependencies
are not updated multiple times.
| Constructor Summary | |
|---|---|
RefreshHelper(Callable<?> refreshRunnable)
|
|
| Method Summary | |
|---|---|
void |
addDependency(Refreshable refreshable)
Add a dependency to be refreshed first when the encapsulating object does. |
static Collection<Refreshable> |
buildRefreshed(Collection<Refreshable> currentAlreadyRefreshed)
Creates a new and empty Collection if the method parameter is null. |
static void |
maybeRefresh(Collection<Refreshable> alreadyRefreshed,
Refreshable refreshable)
Adds the specified Refreshable to the given collection of Refreshables if it is not
already there and immediately refreshes it. |
void |
refresh(Collection<Refreshable> alreadyRefreshed)
Typically this is called in Refreshable.refresh(java.util.Collection) and is the entire body of
that method. |
void |
removeDependency(Refreshable refreshable)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public RefreshHelper(Callable<?> refreshRunnable)
refreshRunnable - encapsulates the containing object's own refresh logic| Method Detail |
|---|
public void addDependency(Refreshable refreshable)
public void removeDependency(Refreshable refreshable)
public void refresh(Collection<Refreshable> alreadyRefreshed)
Refreshable.refresh(java.util.Collection) and is the entire body of
that method.
refresh in interface RefreshablealreadyRefreshed - Refreshables that are known to have already been
refreshed as a result of an initial call to a Refreshable.refresh(Collection) method on some
object. This ensure that objects in a refresh dependency graph aren't refreshed twice
needlessly.public static Collection<Refreshable> buildRefreshed(Collection<Refreshable> currentAlreadyRefreshed)
Collection if the method parameter is null.
currentAlreadyRefreshed - Refreshables to refresh later on
Collection if the method param was null or the unmodified method
param.
public static void maybeRefresh(Collection<Refreshable> alreadyRefreshed,
Refreshable refreshable)
Refreshable to the given collection of Refreshables if it is not
already there and immediately refreshes it.
alreadyRefreshed - the collection of Refreshablesrefreshable - the Refreshable to potentially add and refresh
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||