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 ChebyshevInterpolation implements org.quantlib.helpers.QuantLibJNIHelpers.AutoCloseable { 012 private transient long swigCPtr; 013 protected transient boolean swigCMemOwn; 014 015 protected ChebyshevInterpolation(long cPtr, boolean cMemoryOwn) { 016 swigCMemOwn = cMemoryOwn; 017 swigCPtr = cPtr; 018 } 019 020 protected static long getCPtr(ChebyshevInterpolation obj) { 021 return (obj == null) ? 0 : obj.swigCPtr; 022 } 023 024 protected static long swigRelease(ChebyshevInterpolation 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_ChebyshevInterpolation(swigCPtr); 046 } 047 swigCPtr = 0; 048 } 049 } 050 051 public ChebyshevInterpolation(Array f, ChebyshevInterpolation.PointsType pointsType) { 052 this(QuantLibJNI.new_ChebyshevInterpolation__SWIG_0(Array.getCPtr(f), f, pointsType.swigValue()), true); 053 } 054 055 public ChebyshevInterpolation(Array f) { 056 this(QuantLibJNI.new_ChebyshevInterpolation__SWIG_1(Array.getCPtr(f), f), true); 057 } 058 059 public ChebyshevInterpolation(long n, UnaryFunctionDelegate fct, ChebyshevInterpolation.PointsType pointsType) { 060 this(QuantLibJNI.new_ChebyshevInterpolation__SWIG_2(n, UnaryFunctionDelegate.getCPtr(fct), fct, pointsType.swigValue()), true); 061 } 062 063 public ChebyshevInterpolation(long n, UnaryFunctionDelegate fct) { 064 this(QuantLibJNI.new_ChebyshevInterpolation__SWIG_3(n, UnaryFunctionDelegate.getCPtr(fct), fct), true); 065 } 066 067 public double getValue(double z, boolean allowExtrapolation) { 068 return QuantLibJNI.ChebyshevInterpolation_getValue__SWIG_0(swigCPtr, this, z, allowExtrapolation); 069 } 070 071 public double getValue(double z) { 072 return QuantLibJNI.ChebyshevInterpolation_getValue__SWIG_1(swigCPtr, this, z); 073 } 074 075 public static Array nodes(long n, ChebyshevInterpolation.PointsType pointsType) { 076 return new Array(QuantLibJNI.ChebyshevInterpolation_nodes(n, pointsType.swigValue()), true); 077 } 078 079 public final static class PointsType { 080 public final static ChebyshevInterpolation.PointsType FirstKind = new ChebyshevInterpolation.PointsType("FirstKind"); 081 public final static ChebyshevInterpolation.PointsType SecondKind = new ChebyshevInterpolation.PointsType("SecondKind"); 082 083 public final int swigValue() { 084 return swigValue; 085 } 086 087 public String toString() { 088 return swigName; 089 } 090 091 public static PointsType swigToEnum(int swigValue) { 092 if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue) 093 return swigValues[swigValue]; 094 for (int i = 0; i < swigValues.length; i++) 095 if (swigValues[i].swigValue == swigValue) 096 return swigValues[i]; 097 throw new IllegalArgumentException("No enum " + PointsType.class + " with value " + swigValue); 098 } 099 100 private PointsType(String swigName) { 101 this.swigName = swigName; 102 this.swigValue = swigNext++; 103 } 104 105 private PointsType(String swigName, int swigValue) { 106 this.swigName = swigName; 107 this.swigValue = swigValue; 108 swigNext = swigValue+1; 109 } 110 111 private PointsType(String swigName, PointsType swigEnum) { 112 this.swigName = swigName; 113 this.swigValue = swigEnum.swigValue; 114 swigNext = this.swigValue+1; 115 } 116 117 private static PointsType[] swigValues = { FirstKind, SecondKind }; 118 private static int swigNext = 0; 119 private final int swigValue; 120 private final String swigName; 121 } 122 123}