E
- the result type of the algorithm, which is the same as the result
type of the underfyling algorithmpublic class GrphAlgorithmCache<E> extends GrphAlgorithm<E>
Constructor and Description |
---|
GrphAlgorithmCache(Grph graph,
GrphAlgorithm<E> algo) |
Modifier and Type | Method and Description |
---|---|
E |
compute(Grph g) |
long |
getAvgTimeRequiredForComputing() |
GrphAlgorithm<E> |
getCachedAlgorithm()
Returns the underlying algorithm.
|
E |
getCachedValue() |
long |
getNumberOfTimesAComputationWasPerformed() |
long |
getNumberOfTimesTheCacheWasUsed() |
java.lang.String |
getSourceCode() |
long |
getTimeRequiredForComputingIfCacheWereNotUsed() |
long |
getTimeSpentComputing() |
long |
getTotalNumberOfCallsFor() |
void |
invalidateCachedValue() |
boolean |
isCachedValueValid() |
boolean |
isCacheEnabled() |
void |
setCachedValue(E v) |
void |
setCacheEnabled(boolean enabled) |
cacheResultForGraph
public GrphAlgorithmCache(Grph graph, GrphAlgorithm<E> algo)
public E getCachedValue()
public GrphAlgorithm<E> getCachedAlgorithm()
public java.lang.String getSourceCode()
getSourceCode
in class GrphAlgorithm<E>
public void invalidateCachedValue()
public final boolean isCachedValueValid()
public final long getTimeSpentComputing()
public final long getNumberOfTimesTheCacheWasUsed()
public final long getAvgTimeRequiredForComputing()
public final long getTotalNumberOfCallsFor()
public final long getTimeRequiredForComputingIfCacheWereNotUsed()
public final long getNumberOfTimesAComputationWasPerformed()
public boolean isCacheEnabled()
public void setCacheEnabled(boolean enabled)
public E compute(Grph g)
compute
in class GrphAlgorithm<E>
public void setCachedValue(E v)