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

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

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

  public void setOptimization_type(PolysemousTraining.Optimization_type_t value) {
    swigfaissJNI.PolysemousTraining_optimization_type_set(swigCPtr, this, value.swigValue());
  }

  public PolysemousTraining.Optimization_type_t getOptimization_type() {
    return PolysemousTraining.Optimization_type_t.swigToEnum(swigfaissJNI.PolysemousTraining_optimization_type_get(swigCPtr, this));
  }

  public void setNtrain_permutation(int value) {
    swigfaissJNI.PolysemousTraining_ntrain_permutation_set(swigCPtr, this, value);
  }

  public int getNtrain_permutation() {
    return swigfaissJNI.PolysemousTraining_ntrain_permutation_get(swigCPtr, this);
  }

  public void setDis_weight_factor(double value) {
    swigfaissJNI.PolysemousTraining_dis_weight_factor_set(swigCPtr, this, value);
  }

  public double getDis_weight_factor() {
    return swigfaissJNI.PolysemousTraining_dis_weight_factor_get(swigCPtr, this);
  }

  public void setMax_memory(long value) {
    swigfaissJNI.PolysemousTraining_max_memory_set(swigCPtr, this, value);
  }

  public long getMax_memory() {
    return swigfaissJNI.PolysemousTraining_max_memory_get(swigCPtr, this);
  }

  public void setLog_pattern(String value) {
    swigfaissJNI.PolysemousTraining_log_pattern_set(swigCPtr, this, value);
  }

  public String getLog_pattern() {
    return swigfaissJNI.PolysemousTraining_log_pattern_get(swigCPtr, this);
  }

  public PolysemousTraining() {
    this(swigfaissJNI.new_PolysemousTraining(), true);
  }

  public void optimize_pq_for_hamming(ProductQuantizer pq, long n, SWIGTYPE_p_float x) {
    swigfaissJNI.PolysemousTraining_optimize_pq_for_hamming(swigCPtr, this, ProductQuantizer.getCPtr(pq), pq, n, SWIGTYPE_p_float.getCPtr(x));
  }

  public void optimize_ranking(ProductQuantizer pq, long n, SWIGTYPE_p_float x) {
    swigfaissJNI.PolysemousTraining_optimize_ranking(swigCPtr, this, ProductQuantizer.getCPtr(pq), pq, n, SWIGTYPE_p_float.getCPtr(x));
  }

  public void optimize_reproduce_distances(ProductQuantizer pq) {
    swigfaissJNI.PolysemousTraining_optimize_reproduce_distances(swigCPtr, this, ProductQuantizer.getCPtr(pq), pq);
  }

  public long memory_usage_per_thread(ProductQuantizer pq) {
    return swigfaissJNI.PolysemousTraining_memory_usage_per_thread(swigCPtr, this, ProductQuantizer.getCPtr(pq), pq);
  }

  public final static class Optimization_type_t {
    public final static PolysemousTraining.Optimization_type_t OT_None = new PolysemousTraining.Optimization_type_t("OT_None");
    public final static PolysemousTraining.Optimization_type_t OT_ReproduceDistances_affine = new PolysemousTraining.Optimization_type_t("OT_ReproduceDistances_affine");
    public final static PolysemousTraining.Optimization_type_t OT_Ranking_weighted_diff = new PolysemousTraining.Optimization_type_t("OT_Ranking_weighted_diff");

    public final int swigValue() {
      return swigValue;
    }

    public String toString() {
      return swigName;
    }

    public static Optimization_type_t swigToEnum(int swigValue) {
      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
        return swigValues[swigValue];
      for (int i = 0; i < swigValues.length; i++)
        if (swigValues[i].swigValue == swigValue)
          return swigValues[i];
      throw new IllegalArgumentException("No enum " + Optimization_type_t.class + " with value " + swigValue);
    }

    private Optimization_type_t(String swigName) {
      this.swigName = swigName;
      this.swigValue = swigNext++;
    }

    private Optimization_type_t(String swigName, int swigValue) {
      this.swigName = swigName;
      this.swigValue = swigValue;
      swigNext = swigValue+1;
    }

    private Optimization_type_t(String swigName, Optimization_type_t swigEnum) {
      this.swigName = swigName;
      this.swigValue = swigEnum.swigValue;
      swigNext = this.swigValue+1;
    }

    private static Optimization_type_t[] swigValues = { OT_None, OT_ReproduceDistances_affine, OT_Ranking_weighted_diff };
    private static int swigNext = 0;
    private final int swigValue;
    private final String swigName;
  }

}
