package org.yaz4j;

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;
        }
    }
}

@@ -98,16 +98,56 @@
 _p_int;%0A
+import org.yaz4j.jni.SWIGTYPE_p_size_t;%0A
 import o
@@ -583,18 +583,21 @@
 GTYPE_p_
-in
+size_
 t occ = 
@@ -601,34 +601,37 @@
  = yaz4jlib.new_
-in
+size_
 tp();%0A        SW
@@ -639,18 +639,21 @@
 GTYPE_p_
-in
+size_
 t length
@@ -668,18 +668,21 @@
 lib.new_
-in
+size_
 tp();%0A  
@@ -773,19 +773,20 @@
         
-int
+long
  occuren
@@ -800,18 +800,21 @@
 az4jlib.
-in
+size_
 tp_value
@@ -844,18 +844,21 @@
 .delete_
-in
+size_
 tp(occ);
@@ -882,18 +882,21 @@
 .delete_
-in
+size_
 tp(lengt

Update for ZOOM_scanset_term's size_t parameter