-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain_tnumber.go
178 lines (147 loc) · 6.79 KB
/
main_tnumber.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
package gomeos
/*
#include "meos.h"
#include <stdio.h>
#include <stdlib.h>
#include "cast.h"
*/
import "C"
// TNumberToTBox Return a temporal number converted to a temporal box
func TNumberToTBox[TN TNumber](tn TN) *TBox {
return &TBox{_inner: C.tnumber_to_tbox(tn.Inner())}
}
// TNumberIntegral Return the integral (area under the curve) of a temporal number
func TNumberIntegral[TN TNumber](tn TN) float64 {
return float64(C.tnumber_integral(tn.Inner()))
}
// TNumberTwavg Return the time-weighted average of a temporal number
func TNumberTwavg[TN TNumber](temp TN) float64 {
res := C.tnumber_twavg(temp.Inner())
return float64(res)
}
// TNumberAtSpan Return a temporal value restricted to a span of base values
func TNumberAtSpan[TN TNumber, S Span](tn TN, span S) Temporal {
c_temp := C.tnumber_at_span(tn.Inner(), span.Inner())
return CreateTemporal(c_temp)
}
// TNumberAtSpanSet Return a temporal value restricted to an array of spans of base values
func TNumberAtSpanSet[TN TNumber, SS SpanSet](tn TN, spanset SS) Temporal {
c_temp := C.tnumber_at_spanset(tn.Inner(), spanset.Inner())
return CreateTemporal(c_temp)
}
// TNumberAtTBox Return a temporal number restricted to a temporal box
func TNumberAtTBox[TN TNumber](tn TN, tbox *TBox) Temporal {
c_temp := C.tnumber_at_tbox(tn.Inner(), tbox._inner)
return CreateTemporal(c_temp)
}
// TNumberMinusSpan Return a temporal value restricted to the complement of a span of base values
func TNumberMinusSpan[TN TNumber, S Span](tn TN, span S) Temporal {
c_temp := C.tnumber_minus_span(tn.Inner(), span.Inner())
return CreateTemporal(c_temp)
}
// TNumberMinusSpanSet Return a temporal value restricted to the complement of an array of spans of base values
func TNumberMinusSpanSet[TN TNumber, SS SpanSet](tn TN, spanset SS) Temporal {
c_temp := C.tnumber_minus_spanset(tn.Inner(), spanset.Inner())
return CreateTemporal(c_temp)
}
// TNumberMinusTBox Return a temporal number restricted to a temporal box
func TNumberMinusTBox[TN TNumber](tn TN, tbox *TBox) Temporal {
c_temp := C.tnumber_minus_tbox(tn.Inner(), tbox._inner)
return CreateTemporal(c_temp)
}
// LeftTNumberTBox Return true if a temporal number is to the left of a temporal box
func LeftTNumberTBox[TN TNumber](tn TN, tbox *TBox) bool {
return bool(C.left_tnumber_tbox(tn.Inner(), tbox._inner))
}
// LeftTNumberNumspan Return true if a temporal number is to the left of a number span
func LeftTNumberNumspan[TN TNumber, NS NumSpan](tn TN, ns NS) bool {
return bool(C.left_tnumber_numspan(tn.Inner(), ns.Inner()))
}
// LeftTNumberTNumber Return true if the first temporal number is to the left of the second one
func LeftTNumberTNumber[TN1 TNumber, TN2 TNumber](tn TN1, tn2 TNumber) bool {
return bool(C.left_tnumber_tnumber(tn.Inner(), tn2.Inner()))
}
// OverLeftTNumberNumspan returns true if a temporal number is overleft of a number span.
func OverLeftTNumberNumspan[TN TNumber, NS NumSpan](tn TN, ns NS) bool {
return bool(C.overleft_tnumber_numspan(tn.Inner(), ns.Inner()))
}
// OverLeftTNumberTBox returns true if a temporal number is overleft of a temporal box.
func OverLeftTNumberTBox[TN TNumber](tn TN, tbox *TBox) bool {
return bool(C.overleft_tnumber_tbox(tn.Inner(), tbox._inner))
}
// OverLeftTNumberTNumber returns true if the first temporal number is overleft of the second one.
func OverLeftTNumberTNumber[TN1 TNumber, TN2 TNumber](tn1 TN1, tn2 TN2) bool {
return bool(C.overleft_tnumber_tnumber(tn1.Inner(), tn2.Inner()))
}
// RightTNumberTBox Return true if a temporal number is to the right of a temporal box
func RightTNumberTBox[TN TNumber](tn TN, tbox *TBox) bool {
return bool(C.right_tnumber_tbox(tn.Inner(), tbox._inner))
}
// RightTNumberNumspan Return true if a temporal number is to the right of a number span
func RightTNumberNumspan[TN TNumber, NS NumSpan](tn TN, ns NS) bool {
return bool(C.right_tnumber_numspan(tn.Inner(), ns.Inner()))
}
// RightTNumberTNumber Return true if the first temporal number is to the right of the second one
func RightTNumberTNumber[TN1 TNumber, TN2 TNumber](tn TN1, tn2 TNumber) bool {
return bool(C.right_tnumber_tnumber(tn.Inner(), tn2.Inner()))
}
// OverRightTNumberNumspan returns true if a temporal number is overright of a number span.
func OverRightTNumberNumspan[TN TNumber, NS NumSpan](tn TN, ns NS) bool {
return bool(C.overright_tnumber_numspan(tn.Inner(), ns.Inner()))
}
// OverRightTNumberTBox returns true if a temporal number is overright of a temporal box.
func OverRightTNumberTBox[TN TNumber](tn TN, tbox *TBox) bool {
return bool(C.overright_tnumber_tbox(tn.Inner(), tbox._inner))
}
// OverRightTNumberTNumber returns true if the first temporal number is overright of the second one.
func OverRightTNumberTNumber[TN1 TNumber, TN2 TNumber](tn1 TN1, tn2 TN2) bool {
return bool(C.overright_tnumber_tnumber(tn1.Inner(), tn2.Inner()))
}
// AddTNumberTNumber Return the temporal addition of the temporal numbers
func AddTNumberTNumber[TN1 TNumber, TN2 TNumber](tn1 TN1, tn2 TN2) Temporal {
c_temp := C.add_tnumber_tnumber(tn1.Inner(), tn2.Inner())
return CreateTemporal(c_temp)
}
// SubTNumberTNumber returns the temporal subtraction of two temporal numbers.
func SubTNumberTNumber[TN1 TNumber, TN2 TNumber](tn1 TN1, tn2 TN2) Temporal {
c_temp := C.sub_tnumber_tnumber(tn1.Inner(), tn2.Inner())
return CreateTemporal(c_temp)
}
// MultTNumberTNumber returns the temporal multiplication of two temporal numbers.
func MultTNumberTNumber[TN1 TNumber, TN2 TNumber](tn1 TN1, tn2 TN2) Temporal {
c_temp := C.mult_tnumber_tnumber(tn1.Inner(), tn2.Inner())
return CreateTemporal(c_temp)
}
// DivTNumberTNumber returns the temporal division of two temporal numbers.
func DivTNumberTNumber[TN1 TNumber, TN2 TNumber](tn1 TN1, tn2 TN2) Temporal {
c_temp := C.div_tnumber_tnumber(tn1.Inner(), tn2.Inner())
return CreateTemporal(c_temp)
}
// TNumberAbs Return the absolute value of a temporal number
func TNumberAbs[TN TNumber](tn TN, output TN) TN {
c_temp := C.tnumber_abs(tn.Inner())
output.Init(c_temp)
return output
}
// TNumberDeltaValue Return the delta value of a temporal number
func TNumberDeltaValue[TN TNumber](tn TN) Temporal {
c_temp := C.tnumber_delta_value(tn.Inner())
return CreateTemporal(c_temp)
}
// DistanceTNumberTNumber returns the temporal distance between two temporal numbers.
func DistanceTNumberTNumber[TN1 TNumber, TN2 TNumber](tn1 TN1, tn2 TN2) Temporal {
c_temp := C.distance_tnumber_tnumber(tn1.Inner(), tn2.Inner())
return CreateTemporal(c_temp)
}
// TNumberToSpan Return the value span of a temporal number
func TNumberToSpan[TN TNumber, S Span](tn TN, output S) S {
span := C.tnumber_to_span(tn.Inner())
output.Init(span)
return output
}
// TNumberValueSpans Return the base values of a temporal number as a span set
func TNumberValueSpans[TN TNumber, SS SpanSet](tn TN, ss SS) SS {
spanset := C.tnumber_valuespans(tn.Inner())
ss.Init(spanset)
return ss
}