Skip to content

Commit

Permalink
new bloom filter class specifically for 160bit arrays, in our case sh…
Browse files Browse the repository at this point in the history
…a1 hashes.
  • Loading branch information
gubatron committed Feb 23, 2015
1 parent 415b1f8 commit 2f1d890
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
Binary file modified libjlibtorrent.dylib
Binary file not shown.
66 changes: 66 additions & 0 deletions src/com/frostwire/jlibtorrent/swig/sha1_bloom_filter.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.4
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */

package com.frostwire.jlibtorrent.swig;

public class sha1_bloom_filter {
private long swigCPtr;
protected boolean swigCMemOwn;

protected sha1_bloom_filter(long cPtr, boolean cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = cPtr;
}

protected static long getCPtr(sha1_bloom_filter obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}

protected void finalize() {
delete();
}

public synchronized void delete() {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
libtorrent_jni.delete_sha1_bloom_filter(swigCPtr);
}
swigCPtr = 0;
}
}

public boolean find(sha1_hash k) {
return libtorrent_jni.sha1_bloom_filter_find(swigCPtr, this, sha1_hash.getCPtr(k), k);
}

public void set(sha1_hash k) {
libtorrent_jni.sha1_bloom_filter_set(swigCPtr, this, sha1_hash.getCPtr(k), k);
}

public String to_string() {
return libtorrent_jni.sha1_bloom_filter_to_string(swigCPtr, this);
}

public void from_string(String str) {
libtorrent_jni.sha1_bloom_filter_from_string(swigCPtr, this, str);
}

public void clear() {
libtorrent_jni.sha1_bloom_filter_clear(swigCPtr, this);
}

public float size() {
return libtorrent_jni.sha1_bloom_filter_size(swigCPtr, this);
}

public sha1_bloom_filter() {
this(libtorrent_jni.new_sha1_bloom_filter(), true);
}

}

0 comments on commit 2f1d890

Please sign in to comment.