/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 3.0.13
 *
 * 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 ValueMapPostingSource extends ValuePostingSource {
  private transient long swigCPtr;

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

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

  protected void finalize() {
    delete();
  }

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

  public ValueMapPostingSource(int slot_) {
    this(XapianJNI.new_ValueMapPostingSource(slot_), true);
  }

  public void addMapping(String key, double wt) {
    XapianJNI.ValueMapPostingSource_addMapping(swigCPtr, this, key, wt);
  }

  public void clearMappings() {
    XapianJNI.ValueMapPostingSource_clearMappings(swigCPtr, this);
  }

  public void setDefaultWeight(double wt) {
    XapianJNI.ValueMapPostingSource_setDefaultWeight(swigCPtr, this, wt);
  }

  public double getWeight() {
    return XapianJNI.ValueMapPostingSource_getWeight(swigCPtr, this);
  }

  public String name() {
    return XapianJNI.ValueMapPostingSource_name(swigCPtr, this);
  }

  public void init(Database db_) {
    XapianJNI.ValueMapPostingSource_init(swigCPtr, this, Database.getCPtr(db_), db_);
  }

  public String toString() {
    return XapianJNI.ValueMapPostingSource_toString(swigCPtr, this);
  }

}
