/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 4.0.2
 *
 * Do not make changes to this file unless you know what you are doing--modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */

package com.twitter.ann.faiss;

public class OnDiskInvertedLists extends InvertedLists {
  private transient long swigCPtr;

  protected OnDiskInvertedLists(long cPtr, boolean cMemoryOwn) {
    super(swigfaissJNI.OnDiskInvertedLists_SWIGUpcast(cPtr), cMemoryOwn);
    swigCPtr = cPtr;
  }

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

  @SuppressWarnings("deprecation")
  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        swigfaissJNI.delete_OnDiskInvertedLists(swigCPtr);
      }
      swigCPtr = 0;
    }
    super.delete();
  }

  public void setLists(SWIGTYPE_p_std__vectorT_faiss__OnDiskOneList_t value) {
    swigfaissJNI.OnDiskInvertedLists_lists_set(swigCPtr, this, SWIGTYPE_p_std__vectorT_faiss__OnDiskOneList_t.getCPtr(value));
  }

  public SWIGTYPE_p_std__vectorT_faiss__OnDiskOneList_t getLists() {
    long cPtr = swigfaissJNI.OnDiskInvertedLists_lists_get(swigCPtr, this);
    return (cPtr == 0) ? null : new SWIGTYPE_p_std__vectorT_faiss__OnDiskOneList_t(cPtr, false);
  }

  static public class Slot {
    private transient long swigCPtr;
    protected transient boolean swigCMemOwn;
  
    protected Slot(long cPtr, boolean cMemoryOwn) {
      swigCMemOwn = cMemoryOwn;
      swigCPtr = cPtr;
    }
  
    protected static long getCPtr(Slot obj) {
      return (obj == null) ? 0 : obj.swigCPtr;
    }
  
    @SuppressWarnings("deprecation")
    protected void finalize() {
      delete();
    }
  
    public synchronized void delete() {
      if (swigCPtr != 0) {
        if (swigCMemOwn) {
          swigCMemOwn = false;
          swigfaissJNI.delete_OnDiskInvertedLists_Slot(swigCPtr);
        }
        swigCPtr = 0;
      }
    }
  
    public void setOffset(long value) {
      swigfaissJNI.OnDiskInvertedLists_Slot_offset_set(swigCPtr, this, value);
    }
  
    public long getOffset() {
      return swigfaissJNI.OnDiskInvertedLists_Slot_offset_get(swigCPtr, this);
    }
  
    public void setCapacity(long value) {
      swigfaissJNI.OnDiskInvertedLists_Slot_capacity_set(swigCPtr, this, value);
    }
  
    public long getCapacity() {
      return swigfaissJNI.OnDiskInvertedLists_Slot_capacity_get(swigCPtr, this);
    }
  
    public Slot(long offset, long capacity) {
      this(swigfaissJNI.new_OnDiskInvertedLists_Slot__SWIG_0(offset, capacity), true);
    }
  
    public Slot() {
      this(swigfaissJNI.new_OnDiskInvertedLists_Slot__SWIG_1(), true);
    }
  
  }

  public void setSlots(SWIGTYPE_p_std__listT_faiss__OnDiskInvertedLists__Slot_t value) {
    swigfaissJNI.OnDiskInvertedLists_slots_set(swigCPtr, this, SWIGTYPE_p_std__listT_faiss__OnDiskInvertedLists__Slot_t.getCPtr(value));
  }

  public SWIGTYPE_p_std__listT_faiss__OnDiskInvertedLists__Slot_t getSlots() {
    long cPtr = swigfaissJNI.OnDiskInvertedLists_slots_get(swigCPtr, this);
    return (cPtr == 0) ? null : new SWIGTYPE_p_std__listT_faiss__OnDiskInvertedLists__Slot_t(cPtr, false);
  }

  public void setFilename(String value) {
    swigfaissJNI.OnDiskInvertedLists_filename_set(swigCPtr, this, value);
  }

  public String getFilename() {
    return swigfaissJNI.OnDiskInvertedLists_filename_get(swigCPtr, this);
  }

  public void setTotsize(long value) {
    swigfaissJNI.OnDiskInvertedLists_totsize_set(swigCPtr, this, value);
  }

  public long getTotsize() {
    return swigfaissJNI.OnDiskInvertedLists_totsize_get(swigCPtr, this);
  }

  public void setPtr(SWIGTYPE_p_unsigned_char value) {
    swigfaissJNI.OnDiskInvertedLists_ptr_set(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(value));
  }

  public SWIGTYPE_p_unsigned_char getPtr() {
    long cPtr = swigfaissJNI.OnDiskInvertedLists_ptr_get(swigCPtr, this);
    return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
  }

  public void setRead_only(boolean value) {
    swigfaissJNI.OnDiskInvertedLists_read_only_set(swigCPtr, this, value);
  }

  public boolean getRead_only() {
    return swigfaissJNI.OnDiskInvertedLists_read_only_get(swigCPtr, this);
  }

  public OnDiskInvertedLists(long nlist, long code_size, String filename) {
    this(swigfaissJNI.new_OnDiskInvertedLists__SWIG_0(nlist, code_size, filename), true);
  }

  public long list_size(long list_no) {
    return swigfaissJNI.OnDiskInvertedLists_list_size(swigCPtr, this, list_no);
  }

  public SWIGTYPE_p_unsigned_char get_codes(long list_no) {
    long cPtr = swigfaissJNI.OnDiskInvertedLists_get_codes(swigCPtr, this, list_no);
    return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
  }

  public LongVector get_ids(long list_no) {
    return new LongVector(swigfaissJNI.OnDiskInvertedLists_get_ids(swigCPtr, this, list_no), false);
}

  public long add_entries(long list_no, long n_entry, LongVector ids, SWIGTYPE_p_unsigned_char code) {
    return swigfaissJNI.OnDiskInvertedLists_add_entries(swigCPtr, this, list_no, n_entry, SWIGTYPE_p_long_long.getCPtr(ids.data()), ids, SWIGTYPE_p_unsigned_char.getCPtr(code));
  }

  public void update_entries(long list_no, long offset, long n_entry, LongVector ids, SWIGTYPE_p_unsigned_char code) {
    swigfaissJNI.OnDiskInvertedLists_update_entries(swigCPtr, this, list_no, offset, n_entry, SWIGTYPE_p_long_long.getCPtr(ids.data()), ids, SWIGTYPE_p_unsigned_char.getCPtr(code));
  }

  public void resize(long list_no, long new_size) {
    swigfaissJNI.OnDiskInvertedLists_resize(swigCPtr, this, list_no, new_size);
  }

  public long merge_from(SWIGTYPE_p_p_faiss__InvertedLists ils, int n_il, boolean verbose) {
    return swigfaissJNI.OnDiskInvertedLists_merge_from__SWIG_0(swigCPtr, this, SWIGTYPE_p_p_faiss__InvertedLists.getCPtr(ils), n_il, verbose);
  }

  public long merge_from(SWIGTYPE_p_p_faiss__InvertedLists ils, int n_il) {
    return swigfaissJNI.OnDiskInvertedLists_merge_from__SWIG_1(swigCPtr, this, SWIGTYPE_p_p_faiss__InvertedLists.getCPtr(ils), n_il);
  }

  public long merge_from_1(InvertedLists il, boolean verbose) {
    return swigfaissJNI.OnDiskInvertedLists_merge_from_1__SWIG_0(swigCPtr, this, InvertedLists.getCPtr(il), il, verbose);
  }

  public long merge_from_1(InvertedLists il) {
    return swigfaissJNI.OnDiskInvertedLists_merge_from_1__SWIG_1(swigCPtr, this, InvertedLists.getCPtr(il), il);
  }

  public void crop_invlists(long l0, long l1) {
    swigfaissJNI.OnDiskInvertedLists_crop_invlists(swigCPtr, this, l0, l1);
  }

  public void prefetch_lists(LongVector list_nos, int nlist) {
    swigfaissJNI.OnDiskInvertedLists_prefetch_lists(swigCPtr, this, SWIGTYPE_p_long_long.getCPtr(list_nos.data()), list_nos, nlist);
  }

  public void setLocks(SWIGTYPE_p_faiss__LockLevels value) {
    swigfaissJNI.OnDiskInvertedLists_locks_set(swigCPtr, this, SWIGTYPE_p_faiss__LockLevels.getCPtr(value));
  }

  public SWIGTYPE_p_faiss__LockLevels getLocks() {
    long cPtr = swigfaissJNI.OnDiskInvertedLists_locks_get(swigCPtr, this);
    return (cPtr == 0) ? null : new SWIGTYPE_p_faiss__LockLevels(cPtr, false);
  }

  public void setPf(SWIGTYPE_p_faiss__OnDiskInvertedLists__OngoingPrefetch value) {
    swigfaissJNI.OnDiskInvertedLists_pf_set(swigCPtr, this, SWIGTYPE_p_faiss__OnDiskInvertedLists__OngoingPrefetch.getCPtr(value));
  }

  public SWIGTYPE_p_faiss__OnDiskInvertedLists__OngoingPrefetch getPf() {
    long cPtr = swigfaissJNI.OnDiskInvertedLists_pf_get(swigCPtr, this);
    return (cPtr == 0) ? null : new SWIGTYPE_p_faiss__OnDiskInvertedLists__OngoingPrefetch(cPtr, false);
  }

  public void setPrefetch_nthread(int value) {
    swigfaissJNI.OnDiskInvertedLists_prefetch_nthread_set(swigCPtr, this, value);
  }

  public int getPrefetch_nthread() {
    return swigfaissJNI.OnDiskInvertedLists_prefetch_nthread_get(swigCPtr, this);
  }

  public void do_mmap() {
    swigfaissJNI.OnDiskInvertedLists_do_mmap(swigCPtr, this);
  }

  public void update_totsize(long new_totsize) {
    swigfaissJNI.OnDiskInvertedLists_update_totsize(swigCPtr, this, new_totsize);
  }

  public void resize_locked(long list_no, long new_size) {
    swigfaissJNI.OnDiskInvertedLists_resize_locked(swigCPtr, this, list_no, new_size);
  }

  public long allocate_slot(long capacity) {
    return swigfaissJNI.OnDiskInvertedLists_allocate_slot(swigCPtr, this, capacity);
  }

  public void free_slot(long offset, long capacity) {
    swigfaissJNI.OnDiskInvertedLists_free_slot(swigCPtr, this, offset, capacity);
  }

  public void set_all_lists_sizes(SWIGTYPE_p_unsigned_long sizes) {
    swigfaissJNI.OnDiskInvertedLists_set_all_lists_sizes(swigCPtr, this, SWIGTYPE_p_unsigned_long.getCPtr(sizes));
  }

  public OnDiskInvertedLists() {
    this(swigfaissJNI.new_OnDiskInvertedLists__SWIG_1(), true);
  }

}
