X-Git-Url: http://lists.indexdata.dk/cgi-bin?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fyaz4j%2FScanSet.java;h=819ac1a902ba2bb223066aa84d886e669d0d5599;hb=refs%2Ftags%2Fv1.0;hp=3e230461c4d53340b8f4b789c7736d8fdcbb63b9;hpb=dc4bd10250b84f2e696adb2d454f6863176c53eb;p=yaz4j-moved-to-github.git diff --git a/src/main/java/org/yaz4j/ScanSet.java b/src/main/java/org/yaz4j/ScanSet.java index 3e23046..819ac1a 100644 --- a/src/main/java/org/yaz4j/ScanSet.java +++ b/src/main/java/org/yaz4j/ScanSet.java @@ -4,47 +4,41 @@ import org.yaz4j.jni.SWIGTYPE_p_ZOOM_scanset_p; import org.yaz4j.jni.SWIGTYPE_p_int; import org.yaz4j.jni.yaz4jlib; -public class ScanSet -{ - private SWIGTYPE_p_ZOOM_scanset_p scanSet = null ; - private Connection connection; - private boolean disposed = false; - - ScanSet(SWIGTYPE_p_ZOOM_scanset_p scanSet, Connection connection) - { - this.connection = connection; - this.scanSet = scanSet; - } - - public void finalize() - { - Dispose(); - } - - public ScanTerm get(long index) - { - SWIGTYPE_p_int occ = yaz4jlib.new_intp(); - SWIGTYPE_p_int length = yaz4jlib.new_intp(); - String term = yaz4jlib.ZOOM_scanset_term( scanSet, (long)index, occ, length ) ; - int occurences = yaz4jlib.intp_value(occ); - yaz4jlib.delete_intp(occ); - yaz4jlib.delete_intp(length); - return new ScanTerm(term, occurences); - } - - public long getSize() - { - return yaz4jlib.ZOOM_scanset_size(scanSet); - } - - public void Dispose() - { - if (! disposed) - { - yaz4jlib.ZOOM_scanset_destroy(scanSet); - connection = null; - scanSet = null; - disposed = true; - } - } +public class ScanSet { + + private SWIGTYPE_p_ZOOM_scanset_p scanSet = null; + private Connection connection; + private boolean disposed = false; + + ScanSet(SWIGTYPE_p_ZOOM_scanset_p scanSet, Connection connection) { + this.connection = connection; + this.scanSet = scanSet; + } + + public void finalize() { + Dispose(); + } + + public ScanTerm get(long index) { + SWIGTYPE_p_int occ = yaz4jlib.new_intp(); + SWIGTYPE_p_int length = yaz4jlib.new_intp(); + String term = yaz4jlib.ZOOM_scanset_term(scanSet, (long) index, occ, length); + int occurences = yaz4jlib.intp_value(occ); + yaz4jlib.delete_intp(occ); + yaz4jlib.delete_intp(length); + return new ScanTerm(term, occurences); + } + + public long getSize() { + return yaz4jlib.ZOOM_scanset_size(scanSet); + } + + public void Dispose() { + if (!disposed) { + yaz4jlib.ZOOM_scanset_destroy(scanSet); + connection = null; + scanSet = null; + disposed = true; + } + } }