/* ----------------------------------------------------------------------------
 * 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 InvertedLists {
  private transient long swigCPtr;
  protected transient boolean swigCMemOwn;

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

  protected static long getCPtr(InvertedLists 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_InvertedLists(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public void setNlist(long value) {
    swigfaissJNI.InvertedLists_nlist_set(swigCPtr, this, value);
  }

  public long getNlist() {
    return swigfaissJNI.InvertedLists_nlist_get(swigCPtr, this);
  }

  public void setCode_size(long value) {
    swigfaissJNI.InvertedLists_code_size_set(swigCPtr, this, value);
  }

  public long getCode_size() {
    return swigfaissJNI.InvertedLists_code_size_get(swigCPtr, this);
  }

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

  public SWIGTYPE_p_unsigned_char get_codes(long list_no) {
    long cPtr = swigfaissJNI.InvertedLists_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.InvertedLists_get_ids(swigCPtr, this, list_no), false);
}

  public void release_codes(long list_no, SWIGTYPE_p_unsigned_char codes) {
    swigfaissJNI.InvertedLists_release_codes(swigCPtr, this, list_no, SWIGTYPE_p_unsigned_char.getCPtr(codes));
  }

  public void release_ids(long list_no, LongVector ids) {
    swigfaissJNI.InvertedLists_release_ids(swigCPtr, this, list_no, SWIGTYPE_p_long_long.getCPtr(ids.data()), ids);
  }

  public long get_single_id(long list_no, long offset) {
    return swigfaissJNI.InvertedLists_get_single_id(swigCPtr, this, list_no, offset);
}

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

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

  public long add_entry(long list_no, long theid, SWIGTYPE_p_unsigned_char code) {
    return swigfaissJNI.InvertedLists_add_entry(swigCPtr, this, list_no, theid, SWIGTYPE_p_unsigned_char.getCPtr(code));
  }

  public long add_entries(long list_no, long n_entry, LongVector ids, SWIGTYPE_p_unsigned_char code) {
    return swigfaissJNI.InvertedLists_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_entry(long list_no, long offset, long id, SWIGTYPE_p_unsigned_char code) {
    swigfaissJNI.InvertedLists_update_entry(swigCPtr, this, list_no, offset, id, 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.InvertedLists_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.InvertedLists_resize(swigCPtr, this, list_no, new_size);
  }

  public void reset() {
    swigfaissJNI.InvertedLists_reset(swigCPtr, this);
  }

  public void merge_from(InvertedLists oivf, long add_id) {
    swigfaissJNI.InvertedLists_merge_from(swigCPtr, this, InvertedLists.getCPtr(oivf), oivf, add_id);
  }

  public double imbalance_factor() {
    return swigfaissJNI.InvertedLists_imbalance_factor(swigCPtr, this);
  }

  public void print_stats() {
    swigfaissJNI.InvertedLists_print_stats(swigCPtr, this);
  }

  public long compute_ntotal() {
    return swigfaissJNI.InvertedLists_compute_ntotal(swigCPtr, this);
  }

  static public class ScopedIds {
    private transient long swigCPtr;
    protected transient boolean swigCMemOwn;
  
    protected ScopedIds(long cPtr, boolean cMemoryOwn) {
      swigCMemOwn = cMemoryOwn;
      swigCPtr = cPtr;
    }
  
    protected static long getCPtr(ScopedIds 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_InvertedLists_ScopedIds(swigCPtr);
        }
        swigCPtr = 0;
      }
    }
  
    public void setIl(InvertedLists value) {
      swigfaissJNI.InvertedLists_ScopedIds_il_set(swigCPtr, this, InvertedLists.getCPtr(value), value);
    }
  
    public InvertedLists getIl() {
      long cPtr = swigfaissJNI.InvertedLists_ScopedIds_il_get(swigCPtr, this);
      return (cPtr == 0) ? null : new InvertedLists(cPtr, false);
    }
  
    public void setIds(LongVector value) {
      swigfaissJNI.InvertedLists_ScopedIds_ids_set(swigCPtr, this, SWIGTYPE_p_long_long.getCPtr(value.data()), value);
    }
  
    public LongVector getIds() {
      return new LongVector(swigfaissJNI.InvertedLists_ScopedIds_ids_get(swigCPtr, this), false);
  }
  
    public void setList_no(long value) {
      swigfaissJNI.InvertedLists_ScopedIds_list_no_set(swigCPtr, this, value);
    }
  
    public long getList_no() {
      return swigfaissJNI.InvertedLists_ScopedIds_list_no_get(swigCPtr, this);
    }
  
    public ScopedIds(InvertedLists il, long list_no) {
      this(swigfaissJNI.new_InvertedLists_ScopedIds(InvertedLists.getCPtr(il), il, list_no), true);
    }
  
    public LongVector get() {
      return new LongVector(swigfaissJNI.InvertedLists_ScopedIds_get(swigCPtr, this), false);
  }
  
  }

  static public class ScopedCodes {
    private transient long swigCPtr;
    protected transient boolean swigCMemOwn;
  
    protected ScopedCodes(long cPtr, boolean cMemoryOwn) {
      swigCMemOwn = cMemoryOwn;
      swigCPtr = cPtr;
    }
  
    protected static long getCPtr(ScopedCodes 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_InvertedLists_ScopedCodes(swigCPtr);
        }
        swigCPtr = 0;
      }
    }
  
    public void setIl(InvertedLists value) {
      swigfaissJNI.InvertedLists_ScopedCodes_il_set(swigCPtr, this, InvertedLists.getCPtr(value), value);
    }
  
    public InvertedLists getIl() {
      long cPtr = swigfaissJNI.InvertedLists_ScopedCodes_il_get(swigCPtr, this);
      return (cPtr == 0) ? null : new InvertedLists(cPtr, false);
    }
  
    public void setCodes(SWIGTYPE_p_unsigned_char value) {
      swigfaissJNI.InvertedLists_ScopedCodes_codes_set(swigCPtr, this, SWIGTYPE_p_unsigned_char.getCPtr(value));
    }
  
    public SWIGTYPE_p_unsigned_char getCodes() {
      long cPtr = swigfaissJNI.InvertedLists_ScopedCodes_codes_get(swigCPtr, this);
      return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
    }
  
    public void setList_no(long value) {
      swigfaissJNI.InvertedLists_ScopedCodes_list_no_set(swigCPtr, this, value);
    }
  
    public long getList_no() {
      return swigfaissJNI.InvertedLists_ScopedCodes_list_no_get(swigCPtr, this);
    }
  
    public ScopedCodes(InvertedLists il, long list_no) {
      this(swigfaissJNI.new_InvertedLists_ScopedCodes__SWIG_0(InvertedLists.getCPtr(il), il, list_no), true);
    }
  
    public ScopedCodes(InvertedLists il, long list_no, long offset) {
      this(swigfaissJNI.new_InvertedLists_ScopedCodes__SWIG_1(InvertedLists.getCPtr(il), il, list_no, offset), true);
    }
  
    public SWIGTYPE_p_unsigned_char get() {
      long cPtr = swigfaissJNI.InvertedLists_ScopedCodes_get(swigCPtr, this);
      return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
    }
  
  }

  public final static long INVALID_CODE_SIZE = swigfaissJNI.InvertedLists_INVALID_CODE_SIZE_get();
}
