Class CacheTransferSource<T extends FeatureInput>
Object
org.anchoranalysis.feature.session.cache.finder.CacheTransferSource<T>
- Type Parameters:
T- input-type associated with cache
public class CacheTransferSource<T extends FeatureInput> extends Object
An existing cache that can be used as a source for child-caches elsewhere.
- Author:
- Owen Feehan
-
Constructor Summary
Constructors Constructor Description CacheTransferSource(CacheSupplier<T,org.anchoranalysis.core.exception.OperationFailedException> cacheToSearch, Set<ChildCacheName> specificChildren) -
Method Summary
Modifier and Type Method Description booleancontainsChild(ChildCacheName name)Whether a particular child-cache exists in the source?Set<ChildCacheName>getCacheNames()The names of the child-caches that can be used as sources.Optional<FeatureCalculationInput<T>>getInputIfPresent(T input)Gets correspondingFeatureCalculationInputfor aninput, if present, but doesn't create any new entry if it's absent.
-
Constructor Details
-
CacheTransferSource
public CacheTransferSource(CacheSupplier<T,org.anchoranalysis.core.exception.OperationFailedException> cacheToSearch, Set<ChildCacheName> specificChildren)
-
-
Method Details
-
containsChild
Whether a particular child-cache exists in the source?- Parameters:
name- the name of the child-cache.- Returns:
- true iff the child-cache exists.
-
getInputIfPresent
public Optional<FeatureCalculationInput<T>> getInputIfPresent(T input) throws org.anchoranalysis.core.exception.OperationFailedExceptionGets correspondingFeatureCalculationInputfor aninput, if present, but doesn't create any new entry if it's absent.- Parameters:
input- the input.- Returns:
- an existing element if present or
Optional.empty()otherwise. - Throws:
org.anchoranalysis.core.exception.OperationFailedException- if unable to get the cache that is searched.
-
getCacheNames
The names of the child-caches that can be used as sources.- Returns:
- the names, as a set, which should not be modified (i.e. treated as read-only).
-