/* ----------------------------------------------------------------------------
 * 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 IndexFlatCodes extends Index {
  private transient long swigCPtr;

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

  protected static long getCPtr(IndexFlatCodes 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_IndexFlatCodes(swigCPtr);
      }
      swigCPtr = 0;
    }
    super.delete();
  }

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

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

  public void setCodes(ByteVector value) {
    swigfaissJNI.IndexFlatCodes_codes_set(swigCPtr, this, ByteVector.getCPtr(value), value);
  }

  public ByteVector getCodes() {
    long cPtr = swigfaissJNI.IndexFlatCodes_codes_get(swigCPtr, this);
    return (cPtr == 0) ? null : new ByteVector(cPtr, false);
  }

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

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

  public void reconstruct_n(long i0, long ni, SWIGTYPE_p_float recons) {
    swigfaissJNI.IndexFlatCodes_reconstruct_n(swigCPtr, this, i0, ni, SWIGTYPE_p_float.getCPtr(recons));
  }

  public void reconstruct(long key, SWIGTYPE_p_float recons) {
    swigfaissJNI.IndexFlatCodes_reconstruct(swigCPtr, this, key, SWIGTYPE_p_float.getCPtr(recons));
  }

  public long sa_code_size() {
    return swigfaissJNI.IndexFlatCodes_sa_code_size(swigCPtr, this);
  }

  public long remove_ids(IDSelector sel) {
    return swigfaissJNI.IndexFlatCodes_remove_ids(swigCPtr, this, IDSelector.getCPtr(sel), sel);
  }

}
