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

package hep.aida.swig;
 
import hep.aida.jni.AIDAJNIUtil;

public class IHistogram2D extends IHistogram implements hep.aida.IHistogram2D {
  private long swigCPtr;

  public IHistogram2D(long cPtr, boolean cMemoryOwn) {
    super(AIDAJNI.SWIGIHistogram2DUpcast(cPtr), cMemoryOwn);
    swigCPtr = cPtr;
  }

  protected static long getCPtr(hep.aida.IHistogram2D obj) {
    if (obj instanceof IHistogram2D) {
      return (obj == null) ? 0 : ((IHistogram2D)obj).swigCPtr;
    } else {
      long cPtr = AIDAJNI.new_IHistogram2D();
      // FIXME, memory leak if Java class gets finalized, since C++ director is not freed.
      AIDAJNI.IHistogram2D_director_connect(obj, cPtr, true, true);
      return cPtr;
    }
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if(swigCPtr != 0 && swigCMemOwn) {
      swigCMemOwn = false;
      AIDAJNI.delete_IHistogram2D(swigCPtr);
    }
    swigCPtr = 0;
    super.delete();
  }

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

  public void swigReleaseOwnership() {
    swigCMemOwn = false;
    AIDAJNI.IHistogram2D_change_ownership(this, swigCPtr, false);
  }

  public void swigTakeOwnership() {
    swigCMemOwn = true;
    AIDAJNI.IHistogram2D_change_ownership(this, swigCPtr, true);
  }

  public void fill(double x, double y, double weight) {
    AIDAJNI.IHistogram2D_fill__SWIG_0(swigCPtr, this, x, y, weight);
  }

  public void fill(double x, double y) {
    AIDAJNI.IHistogram2D_fill__SWIG_1(swigCPtr, this, x, y);
  }

  public double binMeanX(int indexX, int indexY) {
    return AIDAJNI.IHistogram2D_binMeanX(swigCPtr, this, indexX, indexY);
  }

  public double binMeanY(int indexX, int indexY) {
    return AIDAJNI.IHistogram2D_binMeanY(swigCPtr, this, indexX, indexY);
  }

  public int binEntries(int indexX, int indexY) {
    return AIDAJNI.IHistogram2D_binEntries(swigCPtr, this, indexX, indexY);
  }

  public int binEntriesX(int index) {
    return AIDAJNI.IHistogram2D_binEntriesX(swigCPtr, this, index);
  }

  public int binEntriesY(int index) {
    return AIDAJNI.IHistogram2D_binEntriesY(swigCPtr, this, index);
  }

  public double binHeight(int indexX, int indexY) {
    return AIDAJNI.IHistogram2D_binHeight(swigCPtr, this, indexX, indexY);
  }

  public double binHeightX(int index) {
    return AIDAJNI.IHistogram2D_binHeightX(swigCPtr, this, index);
  }

  public double binHeightY(int index) {
    return AIDAJNI.IHistogram2D_binHeightY(swigCPtr, this, index);
  }

  public double binError(int indexX, int indexY) {
    return AIDAJNI.IHistogram2D_binError(swigCPtr, this, indexX, indexY);
  }

  public double meanX() {
    return AIDAJNI.IHistogram2D_meanX(swigCPtr, this);
  }

  public double meanY() {
    return AIDAJNI.IHistogram2D_meanY(swigCPtr, this);
  }

  public double rmsX() {
    return AIDAJNI.IHistogram2D_rmsX(swigCPtr, this);
  }

  public double rmsY() {
    return AIDAJNI.IHistogram2D_rmsY(swigCPtr, this);
  }

  public hep.aida.IAxis xAxis() {
    return new IAxis(AIDAJNI.IHistogram2D_xAxis(swigCPtr, this), false);
  }

  public hep.aida.IAxis yAxis() {
    return new IAxis(AIDAJNI.IHistogram2D_yAxis(swigCPtr, this), false);
  }

  public int coordToIndexX(double coord) {
    return AIDAJNI.IHistogram2D_coordToIndexX(swigCPtr, this, coord);
  }

  public int coordToIndexY(double coord) {
    return AIDAJNI.IHistogram2D_coordToIndexY(swigCPtr, this, coord);
  }

  public void add(hep.aida.IHistogram2D hist) {
    AIDAJNI.IHistogram2D_add(swigCPtr, this, IHistogram2D.getCPtr(hist), (hep.aida.IHistogram2D)hist);
  }

  public IHistogram2D() {
    this(AIDAJNI.new_IHistogram2D(), true);
    AIDAJNI.IHistogram2D_director_connect(this, swigCPtr, swigCMemOwn, true);
  }

}
