Class CacheTransferSource<T extends FeatureInput>

Object
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 Details

    • CacheTransferSource

      public CacheTransferSource(CacheSupplier<T,OperationFailedException> cacheToSearch, Set<ChildCacheName> specificChildren)
      Creates a new CacheTransferSource 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

      public boolean containsChild(ChildCacheName name)
      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 corresponding FeatureCalculationInput for an input, 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

      public Set<ChildCacheName> 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).