Class CacheTransferSource<T extends FeatureInput>
Object
CacheTransferSource<T>
- Type Parameters:
T
- input-type associated with cache
An existing cache that can be used as a source for child-caches elsewhere.
- Author:
- Owen Feehan
-
Constructor Summary
ConstructorsConstructorDescriptionCacheTransferSource
(CacheSupplier<T, OperationFailedException> cacheToSearch, Set<ChildCacheName> specificChildren) Creates a newCacheTransferSource
instance. -
Method Summary
Modifier and TypeMethodDescriptionboolean
containsChild
(ChildCacheName name) Whether a particular child-cache exists in the source?The names of the child-caches that can be used as sources.getInputIfPresent
(T input) Gets correspondingFeatureCalculationInput
for aninput
, if present, but doesn't create any new entry if it's absent.
-
Constructor Details
-
CacheTransferSource
public CacheTransferSource(CacheSupplier<T, OperationFailedException> cacheToSearch, Set<ChildCacheName> specificChildren) Creates a newCacheTransferSource
instance.- Parameters:
cacheToSearch
- The cache that is searched for child caches.specificChildren
- The names of the child-caches that can be used as sources.
-
-
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 OperationFailedException Gets correspondingFeatureCalculationInput
for 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:
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).
-