/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 3.0.9
 *
 * Do not make changes to this file unless you know what you are doing--modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */

package org.xapian;

public class ValueWeightPostingSource extends ValuePostingSource {
  private transient long swigCPtr;

  protected ValueWeightPostingSource(long cPtr, boolean cMemoryOwn) {
    super(XapianJNI.ValueWeightPostingSource_SWIGUpcast(cPtr), cMemoryOwn);
    swigCPtr = cPtr;
  }

  protected static long getCPtr(ValueWeightPostingSource obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        XapianJNI.delete_ValueWeightPostingSource(swigCPtr);
      }
      swigCPtr = 0;
    }
    super.delete();
  }

  protected void swigDirectorDisconnect() {
    swigCMemOwn = false;
    delete();
  }

  public void swigReleaseOwnership() {
    swigCMemOwn = false;
    XapianJNI.ValueWeightPostingSource_change_ownership(this, swigCPtr, false);
  }

  public void swigTakeOwnership() {
    swigCMemOwn = true;
    XapianJNI.ValueWeightPostingSource_change_ownership(this, swigCPtr, true);
  }

  public ValueWeightPostingSource(int slot_) {
    this(XapianJNI.new_ValueWeightPostingSource(slot_), true);
    XapianJNI.ValueWeightPostingSource_director_connect(this, swigCPtr, swigCMemOwn, true);
  }

  public double getWeight() {
    return (getClass() == ValueWeightPostingSource.class) ? XapianJNI.ValueWeightPostingSource_getWeight(swigCPtr, this) : XapianJNI.ValueWeightPostingSource_getWeightSwigExplicitValueWeightPostingSource(swigCPtr, this);
  }

  public String name() {
    return (getClass() == ValueWeightPostingSource.class) ? XapianJNI.ValueWeightPostingSource_name(swigCPtr, this) : XapianJNI.ValueWeightPostingSource_nameSwigExplicitValueWeightPostingSource(swigCPtr, this);
  }

  public void init(Database db_) {
    if (getClass() == ValueWeightPostingSource.class) XapianJNI.ValueWeightPostingSource_init(swigCPtr, this, Database.getCPtr(db_), db_); else XapianJNI.ValueWeightPostingSource_initSwigExplicitValueWeightPostingSource(swigCPtr, this, Database.getCPtr(db_), db_);
  }

  public String toString() {
    return (getClass() == ValueWeightPostingSource.class) ? XapianJNI.ValueWeightPostingSource_toString(swigCPtr, this) : XapianJNI.ValueWeightPostingSource_toStringSwigExplicitValueWeightPostingSource(swigCPtr, this);
  }

}
