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

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

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

  public IndexShards(boolean threaded, boolean successive_ids) {
    this(swigfaissJNI.new_IndexShards__SWIG_0(threaded, successive_ids), true);
  }

  public IndexShards(boolean threaded) {
    this(swigfaissJNI.new_IndexShards__SWIG_1(threaded), true);
  }

  public IndexShards() {
    this(swigfaissJNI.new_IndexShards__SWIG_2(), true);
  }

  public IndexShards(int d, boolean threaded, boolean successive_ids) {
    this(swigfaissJNI.new_IndexShards__SWIG_3(d, threaded, successive_ids), true);
  }

  public IndexShards(int d, boolean threaded) {
    this(swigfaissJNI.new_IndexShards__SWIG_4(d, threaded), true);
  }

  public IndexShards(int d) {
    this(swigfaissJNI.new_IndexShards__SWIG_5(d), true);
  }

  public void add_shard(Index index) {
    swigfaissJNI.IndexShards_add_shard(swigCPtr, this, Index.getCPtr(index), index);
  }

  public void remove_shard(Index index) {
    swigfaissJNI.IndexShards_remove_shard(swigCPtr, this, Index.getCPtr(index), index);
  }

  public void add(long n, SWIGTYPE_p_float x) {
    swigfaissJNI.IndexShards_add(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
  }

  public void add_with_ids(long n, SWIGTYPE_p_float x, LongVector xids) {
    swigfaissJNI.IndexShards_add_with_ids(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), SWIGTYPE_p_long_long.getCPtr(xids.data()), xids);
  }

  public void search(long n, SWIGTYPE_p_float x, long k, SWIGTYPE_p_float distances, LongVector labels) {
    swigfaissJNI.IndexShards_search(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x), k, SWIGTYPE_p_float.getCPtr(distances), SWIGTYPE_p_long_long.getCPtr(labels.data()), labels);
  }

  public void train(long n, SWIGTYPE_p_float x) {
    swigfaissJNI.IndexShards_train(swigCPtr, this, n, SWIGTYPE_p_float.getCPtr(x));
  }

  public void setSuccessive_ids(boolean value) {
    swigfaissJNI.IndexShards_successive_ids_set(swigCPtr, this, value);
  }

  public boolean getSuccessive_ids() {
    return swigfaissJNI.IndexShards_successive_ids_get(swigCPtr, this);
  }

  public void syncWithSubIndexes() {
    swigfaissJNI.IndexShards_syncWithSubIndexes(swigCPtr, this);
  }

}
