content: package org.aion.zero.impl.core;
  
  import org.aion.crypto.HashUtil;
  import org.aion.base.Bloom;
  import org.aion.types.AionAddress;
  
  public class BloomFilter {
      public static boolean containsAddress(Bloom bloom, AionAddress address) {
          Bloom targetBloom = Bloom.create(HashUtil.h256(address.toByteArray()));
          return bloom.contains(targetBloom);
      }
  
      public static boolean containsEvent(Bloom bloom, byte[] eventHash) {
          Bloom targetBloom = Bloom.create(HashUtil.h256(eventHash));
          return bloom.contains(targetBloom);
      }
  
      // more for testing, not used in production
      public static boolean containsString(Bloom bloom, String s) {
          Bloom targetBloom = Bloom.create(HashUtil.h256(s.getBytes()));
          return bloom.contains(targetBloom);
      }
  
      public static boolean contains(Bloom bloom, Bloom targetBloom) {
          return bloom.contains(targetBloom);
      }
  
      public static Bloom create(byte[]... input) {
          Bloom targetBloom = new Bloom();
  
          for (int i = 0; i < input.length; i++) {
              targetBloom.or(Bloom.create(HashUtil.h256(input[i])));
          }
          return targetBloom;
      }
  }
  