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

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

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

  public Clustering1D(int k) {
    this(swigfaissJNI.new_Clustering1D__SWIG_0(k), true);
  }

  public Clustering1D(int k, ClusteringParameters cp) {
    this(swigfaissJNI.new_Clustering1D__SWIG_1(k, ClusteringParameters.getCPtr(cp), cp), true);
  }

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

}
