Class AbstractFilter

java.lang.Object
org.miaixz.bus.core.text.bloom.AbstractFilter
All Implemented Interfaces:
Serializable, BloomFilter
Direct Known Subclasses:
FunctionFilter

public abstract class AbstractFilter extends Object implements BloomFilter
抽象Bloom过滤器
Since:
Java 17+
Author:
Kimi Liu
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected int
    容量
  • Constructor Summary

    Constructors
    Constructor
    Description
    AbstractFilter(int size)
    构造
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    add(String text)
    在boolean的bitMap中增加一个字符串 如果存在就返回false .如果不存在.先增加这个字符串.再返回true
    boolean
    否包含字符
    abstract int
    hash(String text)
    自定义Hash方法

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • size

      protected int size
      容量
  • Constructor Details

    • AbstractFilter

      public AbstractFilter(int size)
      构造
      Parameters:
      size - 容量
  • Method Details

    • contains

      public boolean contains(String text)
      Description copied from interface: BloomFilter
      否包含字符
      Specified by:
      contains in interface BloomFilter
      Parameters:
      text - 字符串
      Returns:
      判断一个字符串是否bitMap中存在
    • add

      public boolean add(String text)
      Description copied from interface: BloomFilter
      在boolean的bitMap中增加一个字符串 如果存在就返回false .如果不存在.先增加这个字符串.再返回true
      Specified by:
      add in interface BloomFilter
      Parameters:
      text - 字符串
      Returns:
      是否加入成功,如果存在就返回false .如果不存在返回true
    • hash

      public abstract int hash(String text)
      自定义Hash方法
      Parameters:
      text - 字符串
      Returns:
      the int