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 SparseMatrix implements org.quantlib.helpers.QuantLibJNIHelpers.AutoCloseable { 012 private transient long swigCPtr; 013 private transient boolean swigCMemOwn; 014 015 protected SparseMatrix(long cPtr, boolean cMemoryOwn) { 016 swigCMemOwn = cMemoryOwn; 017 swigCPtr = cPtr; 018 } 019 020 protected static long getCPtr(SparseMatrix obj) { 021 return (obj == null) ? 0 : obj.swigCPtr; 022 } 023 024 protected void swigSetCMemOwn(boolean own) { 025 swigCMemOwn = own; 026 } 027 028 @SuppressWarnings("deprecation") 029 protected void finalize() { 030 delete(); 031 } 032 033 public synchronized void delete() { 034 if (swigCPtr != 0) { 035 if (swigCMemOwn) { 036 swigCMemOwn = false; 037 QuantLibJNI.delete_SparseMatrix(swigCPtr); 038 } 039 swigCPtr = 0; 040 } 041 } 042 043 public void setRow_idx(UnsignedIntVector value) { 044 QuantLibJNI.SparseMatrix_row_idx_set(swigCPtr, this, UnsignedIntVector.getCPtr(value), value); 045 } 046 047 public UnsignedIntVector getRow_idx() { 048 long cPtr = QuantLibJNI.SparseMatrix_row_idx_get(swigCPtr, this); 049 return (cPtr == 0) ? null : new UnsignedIntVector(cPtr, false); 050 } 051 052 public void setCol_idx(UnsignedIntVector value) { 053 QuantLibJNI.SparseMatrix_col_idx_set(swigCPtr, this, UnsignedIntVector.getCPtr(value), value); 054 } 055 056 public UnsignedIntVector getCol_idx() { 057 long cPtr = QuantLibJNI.SparseMatrix_col_idx_get(swigCPtr, this); 058 return (cPtr == 0) ? null : new UnsignedIntVector(cPtr, false); 059 } 060 061 public void setData(DoubleVector value) { 062 QuantLibJNI.SparseMatrix_data_set(swigCPtr, this, DoubleVector.getCPtr(value), value); 063 } 064 065 public DoubleVector getData() { 066 long cPtr = QuantLibJNI.SparseMatrix_data_get(swigCPtr, this); 067 return (cPtr == 0) ? null : new DoubleVector(cPtr, false); 068 } 069 070 public SparseMatrix() { 071 this(QuantLibJNI.new_SparseMatrix(), true); 072 } 073 074}