001/* ----------------------------------------------------------------------------
002 * This file was automatically generated by SWIG (https://www.swig.org).
003 * Version 4.1.1
004 *
005 * Do not make changes to this file unless you know what you are doing - modify
006 * the SWIG interface file instead.
007 * ----------------------------------------------------------------------------- */
008
009package org.quantlib;
010
011public class SampledCurve implements org.quantlib.helpers.QuantLibJNIHelpers.AutoCloseable {
012  private transient long swigCPtr;
013  protected transient boolean swigCMemOwn;
014
015  protected SampledCurve(long cPtr, boolean cMemoryOwn) {
016    swigCMemOwn = cMemoryOwn;
017    swigCPtr = cPtr;
018  }
019
020  protected static long getCPtr(SampledCurve obj) {
021    return (obj == null) ? 0 : obj.swigCPtr;
022  }
023
024  protected static long swigRelease(SampledCurve obj) {
025    long ptr = 0;
026    if (obj != null) {
027      if (!obj.swigCMemOwn)
028        throw new RuntimeException("Cannot release ownership as memory is not owned");
029      ptr = obj.swigCPtr;
030      obj.swigCMemOwn = false;
031      obj.delete();
032    }
033    return ptr;
034  }
035
036  @SuppressWarnings("deprecation")
037  protected void finalize() {
038    delete();
039  }
040
041  public synchronized void delete() {
042    if (swigCPtr != 0) {
043      if (swigCMemOwn) {
044        swigCMemOwn = false;
045        QuantLibJNI.delete_SampledCurve(swigCPtr);
046      }
047      swigCPtr = 0;
048    }
049  }
050
051  public SampledCurve() {
052    this(QuantLibJNI.new_SampledCurve__SWIG_0(), true);
053  }
054
055  public SampledCurve(Array arg0) {
056    this(QuantLibJNI.new_SampledCurve__SWIG_1(Array.getCPtr(arg0), arg0), true);
057  }
058
059  public Array grid() {
060    return new Array(QuantLibJNI.SampledCurve_grid(swigCPtr, this), false);
061  }
062
063  public Array values() {
064    return new Array(QuantLibJNI.SampledCurve_values(swigCPtr, this), false);
065  }
066
067  public double gridValue(long i) {
068    return QuantLibJNI.SampledCurve_gridValue(swigCPtr, this, i);
069  }
070
071  public double value(long i) {
072    return QuantLibJNI.SampledCurve_value(swigCPtr, this, i);
073  }
074
075  public long size() {
076    return QuantLibJNI.SampledCurve_size(swigCPtr, this);
077  }
078
079  public boolean empty() {
080    return QuantLibJNI.SampledCurve_empty(swigCPtr, this);
081  }
082
083  public void setGrid(Array arg0) {
084    QuantLibJNI.SampledCurve_setGrid(swigCPtr, this, Array.getCPtr(arg0), arg0);
085  }
086
087  public void setValues(Array arg0) {
088    QuantLibJNI.SampledCurve_setValues(swigCPtr, this, Array.getCPtr(arg0), arg0);
089  }
090
091  public void swap(SampledCurve arg0) {
092    QuantLibJNI.SampledCurve_swap(swigCPtr, this, SampledCurve.getCPtr(arg0), arg0);
093  }
094
095  public void setLogGrid(double min, double max) {
096    QuantLibJNI.SampledCurve_setLogGrid(swigCPtr, this, min, max);
097  }
098
099  public void regridLogGrid(double min, double max) {
100    QuantLibJNI.SampledCurve_regridLogGrid(swigCPtr, this, min, max);
101  }
102
103  public void shiftGrid(double s) {
104    QuantLibJNI.SampledCurve_shiftGrid(swigCPtr, this, s);
105  }
106
107  public void scaleGrid(double s) {
108    QuantLibJNI.SampledCurve_scaleGrid(swigCPtr, this, s);
109  }
110
111  public void regrid(Array arg0) {
112    QuantLibJNI.SampledCurve_regrid(swigCPtr, this, Array.getCPtr(arg0), arg0);
113  }
114
115}