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 IntervalPrice implements org.quantlib.helpers.QuantLibJNIHelpers.AutoCloseable { 012 private transient long swigCPtr; 013 protected transient boolean swigCMemOwn; 014 015 protected IntervalPrice(long cPtr, boolean cMemoryOwn) { 016 swigCMemOwn = cMemoryOwn; 017 swigCPtr = cPtr; 018 } 019 020 protected static long getCPtr(IntervalPrice obj) { 021 return (obj == null) ? 0 : obj.swigCPtr; 022 } 023 024 protected static long swigRelease(IntervalPrice 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_IntervalPrice(swigCPtr); 046 } 047 swigCPtr = 0; 048 } 049 } 050 051 public IntervalPrice(double arg0, double arg1, double arg2, double arg3) { 052 this(QuantLibJNI.new_IntervalPrice(arg0, arg1, arg2, arg3), true); 053 } 054 055 public void setValue(double arg0, IntervalPrice.Type arg1) { 056 QuantLibJNI.IntervalPrice_setValue(swigCPtr, this, arg0, arg1.swigValue()); 057 } 058 059 public void setValues(double arg0, double arg1, double arg2, double arg3) { 060 QuantLibJNI.IntervalPrice_setValues(swigCPtr, this, arg0, arg1, arg2, arg3); 061 } 062 063 public double value(IntervalPrice.Type t) { 064 return QuantLibJNI.IntervalPrice_value(swigCPtr, this, t.swigValue()); 065 } 066 067 public double open() { 068 return QuantLibJNI.IntervalPrice_open(swigCPtr, this); 069 } 070 071 public double closePrice() { 072 return QuantLibJNI.IntervalPrice_closePrice(swigCPtr, this); 073 } 074 075 public double high() { 076 return QuantLibJNI.IntervalPrice_high(swigCPtr, this); 077 } 078 079 public double low() { 080 return QuantLibJNI.IntervalPrice_low(swigCPtr, this); 081 } 082 083 public static IntervalPriceTimeSeries makeSeries(DateVector d, DoubleVector open, DoubleVector close, DoubleVector high, DoubleVector low) { 084 return new IntervalPriceTimeSeries(QuantLibJNI.IntervalPrice_makeSeries(DateVector.getCPtr(d), d, DoubleVector.getCPtr(open), open, DoubleVector.getCPtr(close), close, DoubleVector.getCPtr(high), high, DoubleVector.getCPtr(low), low), true); 085 } 086 087 public static DoubleVector extractValues(IntervalPriceTimeSeries arg0, IntervalPrice.Type t) { 088 return new DoubleVector(QuantLibJNI.IntervalPrice_extractValues(IntervalPriceTimeSeries.getCPtr(arg0), arg0, t.swigValue()), true); 089 } 090 091 public static RealTimeSeries extractComponent(IntervalPriceTimeSeries arg0, IntervalPrice.Type t) { 092 return new RealTimeSeries(QuantLibJNI.IntervalPrice_extractComponent(IntervalPriceTimeSeries.getCPtr(arg0), arg0, t.swigValue()), true); 093 } 094 095 public final static class Type { 096 public final static IntervalPrice.Type Open = new IntervalPrice.Type("Open"); 097 public final static IntervalPrice.Type Close = new IntervalPrice.Type("Close"); 098 public final static IntervalPrice.Type High = new IntervalPrice.Type("High"); 099 public final static IntervalPrice.Type Low = new IntervalPrice.Type("Low"); 100 101 public final int swigValue() { 102 return swigValue; 103 } 104 105 public String toString() { 106 return swigName; 107 } 108 109 public static Type swigToEnum(int swigValue) { 110 if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue) 111 return swigValues[swigValue]; 112 for (int i = 0; i < swigValues.length; i++) 113 if (swigValues[i].swigValue == swigValue) 114 return swigValues[i]; 115 throw new IllegalArgumentException("No enum " + Type.class + " with value " + swigValue); 116 } 117 118 private Type(String swigName) { 119 this.swigName = swigName; 120 this.swigValue = swigNext++; 121 } 122 123 private Type(String swigName, int swigValue) { 124 this.swigName = swigName; 125 this.swigValue = swigValue; 126 swigNext = swigValue+1; 127 } 128 129 private Type(String swigName, Type swigEnum) { 130 this.swigName = swigName; 131 this.swigValue = swigEnum.swigValue; 132 swigNext = this.swigValue+1; 133 } 134 135 private static Type[] swigValues = { Open, Close, High, Low }; 136 private static int swigNext = 0; 137 private final int swigValue; 138 private final String swigName; 139 } 140 141}