Class AbstractHashProvider<P extends HashParameters>

    • Constructor Detail

      • AbstractHashProvider

        protected AbstractHashProvider​(java.lang.Class<P> parametersClass)
        Constructs a new AbstractHashProvider with the given base parameters class.
        Parameters:
        parametersClass - the base hash parameters class supported
    • Method Detail

      • querySupport

        public final java.util.EnumSet<HashSupport> querySupport​(HashParameters params)
        Description copied from interface: HashProvider
        Returns information about the available implementations corresponding to the given hash algorithm parameters.
        Specified by:
        querySupport in interface HashProvider
        Parameters:
        params - the hash algorithm parameters
        Returns:
        a set of flags indicating the level of support
      • querySupportTyped

        protected abstract java.util.EnumSet<HashSupport> querySupportTyped​(P params)
        Implemented by subclasses to provide information about the available implementations corresponding to the given hash algorithm parameters. Called by querySupport(com.scurrilous.circe.HashParameters) if the hash parameters match the base type supported by this provider.
        Parameters:
        params - the hash algorithm parameters
        Returns:
        a set of flags indicating the level of support
      • getCacheable

        protected final Hash getCacheable​(P params,
                                          java.util.EnumSet<HashSupport> required)
        Called by implementations that support caching of stateless hash functions when a cached instance is desired. If a cached instance is not available, this method calls createCacheable(P, java.util.EnumSet<com.scurrilous.circe.HashSupport>) to create one, which is then cached (if caching is available).
        Parameters:
        params - the hash algorithm parameters
        required - the required hash support flags
        Returns:
        a hash function
        Throws:
        java.lang.UnsupportedOperationException - if this provider cannot support the given parameters
      • createCacheable

        protected StatelessHash createCacheable​(P params,
                                                java.util.EnumSet<HashSupport> required)
        Called by getCacheable(P, java.util.EnumSet<com.scurrilous.circe.HashSupport>) to create new cacheable stateless hash functions. The default implementation simply throws UnsupportedOperationException.
        Parameters:
        params - the hash algorithm parameters
        required - the required hash support flags
        Returns:
        a stateless hash function
        Throws:
        java.lang.UnsupportedOperationException - if this provider cannot support the given parameters
      • createStateful

        public StatefulHash createStateful​(HashParameters params)
        Description copied from interface: HashProvider
        Creates a stateful hash function using the given parameters.
        Specified by:
        createStateful in interface HashProvider
        Parameters:
        params - the hash algorithm parameters
        Returns:
        a stateful hash function
      • getIncrementalInt

        public IncrementalIntHash getIncrementalInt​(HashParameters params)
        Description copied from interface: HashProvider
        Requests an incremental, stateless, int-width hash function with the given parameters. Note that although an algorithm may be available in incremental form, some potentially more optimized implementations may not support that form, and therefore cannot be provided be this method.
        Specified by:
        getIncrementalInt in interface HashProvider
        Parameters:
        params - the hash algorithm parameters
        Returns:
        a stateful int-width hash function
      • getIncrementalLong

        public IncrementalLongHash getIncrementalLong​(HashParameters params)
        Description copied from interface: HashProvider
        Requests an incremental, stateless, long-width hash function with the given parameters. Note that although an algorithm may be available in incremental form, some potentially more optimized implementations may not support that form, and therefore cannot be provided be this method.

        Also note that this method may return a less efficient hash function than HashProvider.getIncrementalInt(com.scurrilous.circe.HashParameters) for hashes of 32 bits or less.

        Specified by:
        getIncrementalLong in interface HashProvider
        Parameters:
        params - the hash algorithm parameters
        Returns:
        a stateful long-width hash function