    001/*
    002 * Licensed to the Apache Software Foundation (ASF) under one or more
    003 * contributor license agreements.  See the NOTICE file distributed with
    004 * this work for additional information regarding copyright ownership.
    005 * The ASF licenses this file to You under the Apache License, Version 2.0
    006 * (the "License"); you may not use this file except in compliance with
    007 * the License.  You may obtain a copy of the License at
    008 *
    009 *      http://www.apache.org/licenses/LICENSE-2.0
    010 *
    011 * Unless required by applicable law or agreed to in writing, software
    012 * distributed under the License is distributed on an "AS IS" BASIS,
    013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    014 * See the License for the specific language governing permissions and
    015 * limitations under the License.
    016 */
    017package org.apache.commons.collections4.bloomfilter;
    018
    019/**
    020 * A Hasher creates IndexExtractor based on the hash implementation and the
    021 * provided Shape.
    022 *
    023 * @since 4.5
    024 */
    025public interface Hasher {
    026
    027    /**
    028     * Creates an IndexExtractor for this hasher based on the Shape.
    029     *
    030     * <p>The {@code IndexExtractor} will create indices within the range defined by the number of bits in
    031     * the shape. The total number of indices will respect the number of hash functions per item
    032     * defined by the shape. However the count of indices may not be a multiple of the number of
    033     * hash functions if the implementation has removed duplicates.</p>
    034     *
    035     * <p>This IndexExtractor must be deterministic in that it must return the same indices for the
    036     * same Shape.</p>
    037     *
    038     * <p>No guarantee is made as to order of indices.</p>
    039     * <p>Duplicates indices for a single item may be produced.</p>
    040     *
    041     * @param shape the shape of the desired Bloom filter.
    042     * @return the iterator of integers
    043     */
    044    IndexExtractor indices(Shape shape);
    045}