Class FeatureCalculatorCache
Object
org.anchoranalysis.feature.session.calculator.FeatureCalculatorCache
public class FeatureCalculatorCache extends Object
Adds a cache to a
FeatureCalculatorSingle or FeatureCalculatorMulti.
This caches the results created by the calculators. It is not an internal cache used within the feature-calculation itself.
- Author:
- Owen Feehan
-
Method Summary
Modifier and Type Method Description static <T extends FeatureInput>
FeatureCalculatorMulti<T>cache(FeatureCalculatorMulti<T> calculator)Creates a cached version of aFeatureCalculatorMultiwith a default cache-size.static <T extends FeatureInput>
FeatureCalculatorMulti<T>cache(FeatureCalculatorMulti<T> calculator, int cacheSize)Creates a cached version of aFeatureCalculatorMultiwith a particular cache-size.static <T extends FeatureInput>
FeatureCalculatorSingle<T>cache(FeatureCalculatorSingle<T> calculator)Creates a cached version of aFeatureCalculatorSinglewith a default cache-size.static <T extends FeatureInput>
FeatureCalculatorSingle<T>cache(FeatureCalculatorSingle<T> calculator, int cacheSize)Creates a cached version of aFeatureCalculatorSinglewith a particular cache-size.
-
Method Details
-
cache
public static <T extends FeatureInput> FeatureCalculatorSingle<T> cache(FeatureCalculatorSingle<T> calculator)Creates a cached version of aFeatureCalculatorSinglewith a default cache-size.- Type Parameters:
T- feature-input type- Parameters:
calculator- the calculator to cache.- Returns:
- a calculator that caches
FeatureCalculatorSingle.
-
cache
public static <T extends FeatureInput> FeatureCalculatorSingle<T> cache(FeatureCalculatorSingle<T> calculator, int cacheSize)Creates a cached version of aFeatureCalculatorSinglewith a particular cache-size.- Type Parameters:
T- feature-input type- Parameters:
calculator- the calculator to cache.cacheSize- how many items are retained maximally in the cache.- Returns:
- a calculator that caches
FeatureCalculatorSingle.
-
cache
public static <T extends FeatureInput> FeatureCalculatorMulti<T> cache(FeatureCalculatorMulti<T> calculator)Creates a cached version of aFeatureCalculatorMultiwith a default cache-size.- Type Parameters:
T- feature-input type- Parameters:
calculator- the calculator to cache.- Returns:
- a calculator that caches
FeatureCalculatorMulti.
-
cache
public static <T extends FeatureInput> FeatureCalculatorMulti<T> cache(FeatureCalculatorMulti<T> calculator, int cacheSize)Creates a cached version of aFeatureCalculatorMultiwith a particular cache-size.- Type Parameters:
T- feature-input type- Parameters:
calculator- the calculator to cache.cacheSize- how many items are retained maximally in the cache.- Returns:
- a calculator that caches
FeatureCalculatorMulti.
-