tatara 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +23 -0
- data/Gemfile.lock +2 -2
- data/README.md +4 -0
- data/docs/_config.yml +1 -0
- data/docs/index.md +100 -0
- data/docs/tatara/float.md +425 -0
- data/docs/tatara/float_array.md +256 -0
- data/docs/tatara/float_float_map.md +52 -0
- data/docs/tatara/float_integer_map.md +52 -0
- data/docs/tatara/float_string_map.md +52 -0
- data/docs/tatara/float_vector.md +269 -0
- data/docs/tatara/integer.md +480 -0
- data/docs/tatara/integer_array.md +256 -0
- data/docs/tatara/integer_float_map.md +52 -0
- data/docs/tatara/integer_integer_map.md +52 -0
- data/docs/tatara/integer_string_map.md +52 -0
- data/docs/tatara/integer_vector.md +268 -0
- data/docs/tatara/string.md +223 -0
- data/docs/tatara/string_array.md +254 -0
- data/docs/tatara/string_float_map.md +56 -0
- data/docs/tatara/string_int_map.md +55 -0
- data/docs/tatara/string_string_map.md +55 -0
- data/docs/tatara/string_vector.md +270 -0
- data/ext/tatara/array/array.hpp +60 -0
- data/ext/tatara/float/float.hpp +51 -0
- data/ext/tatara/integer/integer.hpp +67 -0
- data/ext/tatara/string/string.hpp +28 -0
- data/ext/tatara/tatara.cpp +138 -9
- data/ext/tatara/vector/vector.hpp +60 -0
- data/lib/tatara.rb +2 -0
- data/lib/tatara/array/array.rb +37 -0
- data/lib/tatara/tatara_ext.rb +6 -0
- data/lib/tatara/vector/vector.rb +37 -0
- data/lib/tatara/version.rb +1 -1
- metadata +27 -3
@@ -0,0 +1,256 @@
|
|
1
|
+
# Tatara::IntArray
|
2
|
+
## About
|
3
|
+
|
4
|
+
`Tatara::IntArray` is `Array` class like `static type programming lang`.
|
5
|
+
|
6
|
+
`Tatara::IntArray` use `Integer` value.
|
7
|
+
But, you can use `Float` for value.
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
@i = Tatara::IntArray.new
|
11
|
+
@i[0] = 42
|
12
|
+
# => Set value 42 for index of 0.
|
13
|
+
@i[1] = 8.4
|
14
|
+
# => Set value 8 for index of 1.
|
15
|
+
```
|
16
|
+
|
17
|
+
But, can not use `String` for value.
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
@i = Tatara::IntArray.new
|
21
|
+
@i[0] = "42"
|
22
|
+
# => Error!
|
23
|
+
```
|
24
|
+
|
25
|
+
## Methods
|
26
|
+
### Tatara::IntArray#new
|
27
|
+
|
28
|
+
Create new `Tatara::IntArray` instance.
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
@i = Tatara::IntArray.new
|
32
|
+
```
|
33
|
+
|
34
|
+
### Tatara::IntArray#\[\]
|
35
|
+
|
36
|
+
Access by index.
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
@i = Tatara::IntArray.new
|
40
|
+
@i[0] = 42
|
41
|
+
puts @i[0]
|
42
|
+
# => 42
|
43
|
+
```
|
44
|
+
|
45
|
+
|
46
|
+
### Tatara::IntArray#\[\]=
|
47
|
+
|
48
|
+
Set value by index.
|
49
|
+
|
50
|
+
```ruby
|
51
|
+
@i = Tatara::IntArray.new
|
52
|
+
@i[0] = 42
|
53
|
+
# => Set value 42 for index of 0.
|
54
|
+
```
|
55
|
+
|
56
|
+
### Tatara::IntArray#push
|
57
|
+
|
58
|
+
Create new value on end of `Tatara::IntArray`.
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
@i = Tatara::IntArray.new
|
62
|
+
@i.push(42)
|
63
|
+
# => Set value 42 on end of `Tatara::IntArray`
|
64
|
+
```
|
65
|
+
|
66
|
+
### Tatara::IntArray#size
|
67
|
+
|
68
|
+
Size of `Tatara::IntArray`.
|
69
|
+
|
70
|
+
```ruby
|
71
|
+
@i = Tatara::IntArray.new
|
72
|
+
puts @i.size
|
73
|
+
# => 0
|
74
|
+
@i.push(42)
|
75
|
+
puts @i.size
|
76
|
+
# => 1
|
77
|
+
```
|
78
|
+
|
79
|
+
### Tatara::IntArray#clear
|
80
|
+
|
81
|
+
Clear `Tatara::IntArray`.
|
82
|
+
|
83
|
+
```ruby
|
84
|
+
@i = Tatara::IntArray.new
|
85
|
+
@i.push(42)
|
86
|
+
puts @i.size
|
87
|
+
# => 1
|
88
|
+
@i.clear
|
89
|
+
puts @i.size
|
90
|
+
# => 0
|
91
|
+
```
|
92
|
+
|
93
|
+
### Tatara::IntArray#operator<<
|
94
|
+
|
95
|
+
Create new value on end of `Tatara::IntArray`.
|
96
|
+
|
97
|
+
```ruby
|
98
|
+
@i = Tatara::IntArray.new
|
99
|
+
@i << 42
|
100
|
+
# => Set value 42 on end of `Tatara::IntArray`
|
101
|
+
```
|
102
|
+
|
103
|
+
### Tatara::IntArray#map
|
104
|
+
|
105
|
+
`map` method for `Tatara::IntArray`.
|
106
|
+
It's likes `Array#map`
|
107
|
+
|
108
|
+
```ruby
|
109
|
+
@i = Tatara::IntArray.new
|
110
|
+
(1..3).each{|i| @i << i }
|
111
|
+
# => Set new value's
|
112
|
+
@i.map{|i|
|
113
|
+
puts i
|
114
|
+
}
|
115
|
+
# => 1 2 3
|
116
|
+
```
|
117
|
+
|
118
|
+
### Tatara::IntArray#map!
|
119
|
+
|
120
|
+
`map!` method for `Tatara::IntArray`.
|
121
|
+
It's likes `Array#map!`
|
122
|
+
|
123
|
+
```ruby
|
124
|
+
@i = Tatara::IntArray.new
|
125
|
+
(1..3).each{|i| @i << i }
|
126
|
+
# => Set new value's
|
127
|
+
@i.map!{|i| i * 2 }
|
128
|
+
@i.map{|i|
|
129
|
+
puts i
|
130
|
+
}
|
131
|
+
# => 2 4 6
|
132
|
+
```
|
133
|
+
|
134
|
+
### Tatara::IntArray#each
|
135
|
+
|
136
|
+
`each` method for `Tatara::IntArray`.
|
137
|
+
It's likes `Array#each`
|
138
|
+
|
139
|
+
```ruby
|
140
|
+
@i = Tatara::IntArray.new
|
141
|
+
(1..3).each{|i| @i << i }
|
142
|
+
# => Set new value's
|
143
|
+
@i.each{|i|
|
144
|
+
puts i
|
145
|
+
}
|
146
|
+
# => 1 2 3
|
147
|
+
```
|
148
|
+
|
149
|
+
### Tatara::IntArray#each_with_index
|
150
|
+
|
151
|
+
`each_with_index` method for `Tatara::IntArray`.
|
152
|
+
It's likes `Array#each_with_index`
|
153
|
+
|
154
|
+
```ruby
|
155
|
+
@i = Tatara::IntArray.new
|
156
|
+
(1..3).each{|i| @i << i }
|
157
|
+
# => Set new value's
|
158
|
+
@i.each_with_index{|v, i|
|
159
|
+
puts "#{i}:#{v}"
|
160
|
+
}
|
161
|
+
# => 1:1 2:2 3:3
|
162
|
+
```
|
163
|
+
|
164
|
+
### Tatara::IntArray#intersection
|
165
|
+
|
166
|
+
Intersection value's
|
167
|
+
|
168
|
+
```ruby
|
169
|
+
@i1 = Tatara::IntArray.new
|
170
|
+
(1..10).each{|i| @i1 << i}
|
171
|
+
@i2 = Tatara::IntArray.new
|
172
|
+
(10..20).each{|i| @i2 << i}
|
173
|
+
@i = @i1.intersection @i2
|
174
|
+
# => [10]
|
175
|
+
```
|
176
|
+
|
177
|
+
### Tatara::IntArray#operator&
|
178
|
+
|
179
|
+
Intersection value's
|
180
|
+
|
181
|
+
```ruby
|
182
|
+
@i1 = Tatara::IntArray.new
|
183
|
+
(1..10).each{|i| @i1 << i}
|
184
|
+
@i2 = Tatara::IntArray.new
|
185
|
+
(10..20).each{|i| @i2 << i}
|
186
|
+
@i = @i1 & @i2
|
187
|
+
# => [10]
|
188
|
+
```
|
189
|
+
|
190
|
+
### Tatara::IntArray#sort
|
191
|
+
|
192
|
+
Sort value's.
|
193
|
+
|
194
|
+
```ruby
|
195
|
+
@i = Tatara::IntArray.new
|
196
|
+
[9, 1, 4].each{|i| @ << i }
|
197
|
+
@i = @i.sort
|
198
|
+
# => [1, 4, 9]
|
199
|
+
```
|
200
|
+
|
201
|
+
### Tatara::IntArray#sort!
|
202
|
+
|
203
|
+
Sort value's.
|
204
|
+
|
205
|
+
```ruby
|
206
|
+
@i = Tatara::IntArray.new
|
207
|
+
[9, 1, 4].each{|i| @ << i }
|
208
|
+
@i.sort!
|
209
|
+
# => [1, 4, 9]
|
210
|
+
```
|
211
|
+
|
212
|
+
### Tatara::IntArray#reverse
|
213
|
+
|
214
|
+
Reverse value's.
|
215
|
+
|
216
|
+
```ruby
|
217
|
+
@i = Tatara::IntArray.new
|
218
|
+
[9, 1, 4].each{|i| @i << i }
|
219
|
+
@i = @i.reverse
|
220
|
+
# => [4, 1, 9]
|
221
|
+
```
|
222
|
+
|
223
|
+
### Tatara::IntArray#reverse!
|
224
|
+
|
225
|
+
Reverse value's.
|
226
|
+
|
227
|
+
```ruby
|
228
|
+
@i = Tatara::IntArray.new
|
229
|
+
[9, 1, 4].each{|i| @i << i }
|
230
|
+
@i.reverse!
|
231
|
+
# => [4, 1, 9]
|
232
|
+
```
|
233
|
+
|
234
|
+
### Tatara::IntArray#first
|
235
|
+
|
236
|
+
Get first value of `Tatara::IntArray`.
|
237
|
+
|
238
|
+
```ruby
|
239
|
+
@i = Tatara::IntArray.new
|
240
|
+
(1..3).each{|i| @i << i }
|
241
|
+
# => Set new value's
|
242
|
+
puts @i.first
|
243
|
+
# => 1
|
244
|
+
```
|
245
|
+
|
246
|
+
### Tatara::IntArray#last
|
247
|
+
|
248
|
+
Get last value of `Tatara::IntArray`.
|
249
|
+
|
250
|
+
```ruby
|
251
|
+
@i = Tatara::IntArray.new
|
252
|
+
(1..3).each{|i| @i << i }
|
253
|
+
# => Set new value's
|
254
|
+
puts @i.last
|
255
|
+
# => 3
|
256
|
+
```
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# Tatara::IntFloatMap
|
2
|
+
## About
|
3
|
+
|
4
|
+
`Tatara::IntFloatMap` is `Map` class like `static type programming lang`.
|
5
|
+
|
6
|
+
`Tatara::IntFloatMap` used by `Integer` key, and `Float` value.
|
7
|
+
But, you can use `Float` for key & value.
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
@i = Tatara::IntFloatMap.new
|
11
|
+
@i[0] = 42
|
12
|
+
# => Key: 0, Value: 42.0
|
13
|
+
@i[10.0] = 8.4
|
14
|
+
# => Key: 10, Value: 8.4
|
15
|
+
```
|
16
|
+
|
17
|
+
But, can not set `String`.
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
@i = Tatara::IntFloatMap.new
|
21
|
+
@i[0] = "42"
|
22
|
+
# => Error!
|
23
|
+
```
|
24
|
+
|
25
|
+
## Methods
|
26
|
+
### Tatara::IntFloatMap#new
|
27
|
+
|
28
|
+
Create new `Tatara::IntFloatMap` instance.
|
29
|
+
```ruby
|
30
|
+
@i = Tatara::IntFloatMap.new
|
31
|
+
```
|
32
|
+
|
33
|
+
### Tatara::IntFloatMap#\[\]
|
34
|
+
|
35
|
+
Access by key.
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
@i = Tatara::IntFloatMap.new
|
39
|
+
@i[0] = 4.2
|
40
|
+
puts @i[0]
|
41
|
+
# => 4.2
|
42
|
+
```
|
43
|
+
|
44
|
+
### Tatara::IntFloatMap#\[\]=
|
45
|
+
|
46
|
+
Set value by key.
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
@i = Tatara::IntFloatMap.new
|
50
|
+
@i[0] = 4.2
|
51
|
+
# => Set value is 4.2
|
52
|
+
```
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# Tatara::IntIntMap
|
2
|
+
## About
|
3
|
+
|
4
|
+
`Tatara::IntIntMap` is `Map` class like `static type programming lang`.
|
5
|
+
|
6
|
+
`Tatara::IntIntMap` used by `Integer` key, and `Integer` value.
|
7
|
+
But, you can use `Float` for key & value.
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
@i = Tatara::IntIntMap.new
|
11
|
+
@i[0] = 42
|
12
|
+
# => Key: 0, Value: 42.
|
13
|
+
@i[10.0] = 8.4
|
14
|
+
# => Key: 10, Value: 8.
|
15
|
+
```
|
16
|
+
|
17
|
+
But, can not set `String`.
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
@i = Tatara::IntIntMap.new
|
21
|
+
@i[0] = "42"
|
22
|
+
# => Error!
|
23
|
+
```
|
24
|
+
|
25
|
+
## Methods
|
26
|
+
### Tatara::IntIntMap#new
|
27
|
+
|
28
|
+
Create new `Tatara::IntIntMap` instance.
|
29
|
+
```ruby
|
30
|
+
@i = Tatara::IntIntMap.new
|
31
|
+
```
|
32
|
+
|
33
|
+
### Tatara::IntIntMap#\[\]
|
34
|
+
|
35
|
+
Access by key.
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
@i = Tatara::IntIntMap.new
|
39
|
+
@i[0] = 42
|
40
|
+
puts @i[0]
|
41
|
+
# => 42
|
42
|
+
```
|
43
|
+
|
44
|
+
### Tatara::IntIntMap#\[\]=
|
45
|
+
|
46
|
+
Set value by key.
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
@i = Tatara::IntIntMap.new
|
50
|
+
@i[0] = 42
|
51
|
+
# => Set value is 42.
|
52
|
+
```
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# Tatara::IntStringMap
|
2
|
+
## About
|
3
|
+
|
4
|
+
`Tatara::IntStringMap` is `Map` class like `static type programming lang`.
|
5
|
+
|
6
|
+
`Tatara::IntStringMap` used by `Integer` key, and `String` value.
|
7
|
+
But, you can use `Float` for key & value.
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
@i = Tatara::IntStringMap.new
|
11
|
+
@i[0] = "42"
|
12
|
+
# => Key: 0, Value: "42".
|
13
|
+
@i[10.0] = "8.4"
|
14
|
+
# => Key: 10, Value: "8.4".
|
15
|
+
```
|
16
|
+
|
17
|
+
But, can not set `Integer` & `Float` for value.
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
@i = Tatara::IntStringMap.new
|
21
|
+
@i[0] = 42
|
22
|
+
# => Error!
|
23
|
+
```
|
24
|
+
|
25
|
+
## Methods
|
26
|
+
### Tatara::IntStringMap#new
|
27
|
+
|
28
|
+
Create new `Tatara::IntStringMap` instance.
|
29
|
+
```ruby
|
30
|
+
@i = Tatara::IntStringMap.new
|
31
|
+
```
|
32
|
+
|
33
|
+
### Tatara::IntStringMap#\[\]
|
34
|
+
|
35
|
+
Access by key.
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
@i = Tatara::IntStringMap.new
|
39
|
+
@i[0] = "42"
|
40
|
+
puts @i[0]
|
41
|
+
# => "42"
|
42
|
+
```
|
43
|
+
|
44
|
+
### Tatara::IntStringMap#\[\]=
|
45
|
+
|
46
|
+
Set value by key.
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
@i = Tatara::IntStringMap.new
|
50
|
+
@i[0] = "42"
|
51
|
+
# => Set value is "42".
|
52
|
+
```
|
@@ -0,0 +1,268 @@
|
|
1
|
+
# Tatara::IntVector
|
2
|
+
## About
|
3
|
+
|
4
|
+
`Tatara::IntVector` is `Vector` class like `static type programming lang`.
|
5
|
+
|
6
|
+
`Tatara::IntVector` use `Integer` value.
|
7
|
+
But, you can use `Float` for value.
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
@i = Tatara::IntVector.new
|
11
|
+
@i[0] = 42
|
12
|
+
# => Set value 42 for index of 0.
|
13
|
+
@i[1] = 8.4
|
14
|
+
# => Set value 8 for index of 1.
|
15
|
+
```
|
16
|
+
|
17
|
+
But, can not use `String` for value.
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
@i = Tatara::IntVector.new
|
21
|
+
@i[0] = "42"
|
22
|
+
# => Error!
|
23
|
+
```
|
24
|
+
|
25
|
+
## Methods
|
26
|
+
### Tatara::IntVector#new
|
27
|
+
|
28
|
+
Create new `Tatara::IntVector` instance.
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
@i = Tatara::IntVector.new
|
32
|
+
```
|
33
|
+
|
34
|
+
### Tatara::IntVector#\[\]
|
35
|
+
|
36
|
+
Access by index.
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
@i = Tatara::IntVector.new
|
40
|
+
@i[0] = 42
|
41
|
+
puts @i[0]
|
42
|
+
# => 42
|
43
|
+
```
|
44
|
+
|
45
|
+
### Tatara::IntVector#\[\]=
|
46
|
+
|
47
|
+
Set value by index.
|
48
|
+
|
49
|
+
```ruby
|
50
|
+
@i = Tatara::IntVector.new
|
51
|
+
@i[0] = 42
|
52
|
+
# => Set value 42 for index of 0.
|
53
|
+
```
|
54
|
+
|
55
|
+
### Tatara::IntVector#emplace_back
|
56
|
+
|
57
|
+
Create new value on end of `Tatara::intVector`.
|
58
|
+
|
59
|
+
```ruby
|
60
|
+
@i = Tatara::IntVector.new
|
61
|
+
@i.emplace_back(42)
|
62
|
+
# => Set value 42 on end of `Tatara::intVector`
|
63
|
+
```
|
64
|
+
|
65
|
+
### Tatara::IntVector#size
|
66
|
+
|
67
|
+
Size of `Tatara::intVector`.
|
68
|
+
|
69
|
+
```ruby
|
70
|
+
@i = Tatara::IntVector.new
|
71
|
+
puts @i.size
|
72
|
+
# => 0
|
73
|
+
@i.emplace_back(42)
|
74
|
+
puts @i.size
|
75
|
+
# => 1
|
76
|
+
```
|
77
|
+
|
78
|
+
### Tatara::IntVector#clear
|
79
|
+
|
80
|
+
Clear `Tatara::intVector`.
|
81
|
+
|
82
|
+
```ruby
|
83
|
+
@i = Tatara::IntVector.new
|
84
|
+
@i.emplace_back(42)
|
85
|
+
puts @i.size
|
86
|
+
# => 1
|
87
|
+
@i.clear
|
88
|
+
puts @i.size
|
89
|
+
# => 0
|
90
|
+
```
|
91
|
+
|
92
|
+
### Tatara::IntVector#sum
|
93
|
+
|
94
|
+
Sum value's for `Tatara::IntVector`.
|
95
|
+
|
96
|
+
```ruby
|
97
|
+
@i = Tatara::IntVector.new
|
98
|
+
(1..3).each{|i|
|
99
|
+
@i.emplace_back(i)
|
100
|
+
}
|
101
|
+
puts @i.sum
|
102
|
+
# => 6
|
103
|
+
```
|
104
|
+
|
105
|
+
### Tatara::IntVector#operator<<
|
106
|
+
|
107
|
+
Create new value on end of `Tatara::intVector`.
|
108
|
+
|
109
|
+
```ruby
|
110
|
+
@i = Tatara::IntVector.new
|
111
|
+
@i << 42
|
112
|
+
# => Set value 42 on end of `Tatara::intVector`
|
113
|
+
```
|
114
|
+
|
115
|
+
### Tatara::IntVector#map
|
116
|
+
|
117
|
+
`map` method for `Tatara::IntVector`.
|
118
|
+
It's likes `Array#map`
|
119
|
+
|
120
|
+
```ruby
|
121
|
+
@i = Tatara::IntVector.new
|
122
|
+
(1..3).each{|i| @i << i }
|
123
|
+
# => Set new value's
|
124
|
+
@i.map{|i|
|
125
|
+
puts i
|
126
|
+
}
|
127
|
+
# => 1 2 3
|
128
|
+
```
|
129
|
+
|
130
|
+
### Tatara::IntVector#map!
|
131
|
+
|
132
|
+
`map!` method for `Tatara::IntVector`.
|
133
|
+
It's likes `Array#map!`
|
134
|
+
|
135
|
+
```ruby
|
136
|
+
@i = Tatara::IntVector.new
|
137
|
+
(1..3).each{|i| @i << i }
|
138
|
+
# => Set new value's
|
139
|
+
@i.map!{|i| i * 2 }
|
140
|
+
@i.map{|i|
|
141
|
+
puts i
|
142
|
+
}
|
143
|
+
# => 2 4 6
|
144
|
+
```
|
145
|
+
|
146
|
+
### Tatara::IntVector#each
|
147
|
+
|
148
|
+
`each` method for `Tatara::IntVector`.
|
149
|
+
It's likes `Array#each`
|
150
|
+
|
151
|
+
```ruby
|
152
|
+
@i = Tatara::IntVector.new
|
153
|
+
(1..3).each{|i| @i << i }
|
154
|
+
# => Set new value's
|
155
|
+
@i.each{|i|
|
156
|
+
puts i
|
157
|
+
}
|
158
|
+
# => 1 2 3
|
159
|
+
```
|
160
|
+
|
161
|
+
### Tatara::IntVector#each_with_index
|
162
|
+
|
163
|
+
`each_with_index` method for `Tatara::IntVector`.
|
164
|
+
It's likes `Array#each_with_index`
|
165
|
+
|
166
|
+
```ruby
|
167
|
+
@i = Tatara::IntVector.new
|
168
|
+
(1..3).each{|i| @i << i }
|
169
|
+
# => Set new value's
|
170
|
+
@i.each_with_index{|v, i|
|
171
|
+
puts "#{i}:#{v}"
|
172
|
+
}
|
173
|
+
# => 1:1 2:2 3:3
|
174
|
+
```
|
175
|
+
|
176
|
+
### Tatara::Intvector#intersection
|
177
|
+
|
178
|
+
Intersection value's
|
179
|
+
|
180
|
+
```ruby
|
181
|
+
@i1 = Tatara::IntVector.new
|
182
|
+
(1..10).each{|i| @i1 << i}
|
183
|
+
@i2 = Tatara::IntVector.new
|
184
|
+
(10..20).each{|i| @i2 << i}
|
185
|
+
@i = @i1.intersection @i2
|
186
|
+
# => [10]
|
187
|
+
```
|
188
|
+
|
189
|
+
### Tatara::Intvector#operator&
|
190
|
+
|
191
|
+
Intersection value's
|
192
|
+
|
193
|
+
```ruby
|
194
|
+
@i1 = Tatara::IntVector.new
|
195
|
+
(1..10).each{|i| @i1 << i}
|
196
|
+
@i2 = Tatara::IntVector.new
|
197
|
+
(10..20).each{|i| @i2 << i}
|
198
|
+
@i = @i1 & @i2
|
199
|
+
# => [10]
|
200
|
+
```
|
201
|
+
|
202
|
+
### Tatara::IntVector#sort
|
203
|
+
|
204
|
+
Sort value's.
|
205
|
+
|
206
|
+
```ruby
|
207
|
+
@i = Tatara::IntVector.new
|
208
|
+
[9, 1, 4].each{|i| @i << i }
|
209
|
+
@i = @i.sort
|
210
|
+
# => [1, 4, 9]
|
211
|
+
```
|
212
|
+
|
213
|
+
### Tatara::IntVector#sort!
|
214
|
+
|
215
|
+
Sort value's.
|
216
|
+
|
217
|
+
```ruby
|
218
|
+
@i = Tatara::IntVector.new
|
219
|
+
[9, 1, 4].each{|i| @i << i }
|
220
|
+
@i.sort!
|
221
|
+
# => [1, 4, 9]
|
222
|
+
```
|
223
|
+
|
224
|
+
### Tatara::IntVector#reverse
|
225
|
+
|
226
|
+
Reverse value's.
|
227
|
+
|
228
|
+
```ruby
|
229
|
+
@i = Tatara::IntVector.new
|
230
|
+
[9, 1, 4].each{|i| @i << i }
|
231
|
+
@i = @i.reverse
|
232
|
+
# => [4, 1, 9]
|
233
|
+
```
|
234
|
+
|
235
|
+
### Tatara::IntVector#reverse!
|
236
|
+
|
237
|
+
Reverse value's.
|
238
|
+
|
239
|
+
```ruby
|
240
|
+
@i = Tatara::IntVector.new
|
241
|
+
[9, 1, 4].each{|i| @i << i }
|
242
|
+
@i.reverse!
|
243
|
+
# => [4, 1, 9]
|
244
|
+
```
|
245
|
+
|
246
|
+
### Tatara::IntVector#first
|
247
|
+
|
248
|
+
Get first value of `Tatara::IntVector`.
|
249
|
+
|
250
|
+
```ruby
|
251
|
+
@i = Tatara::IntVector.new
|
252
|
+
(1..3).each{|i| @i << i }
|
253
|
+
# => Set new value's
|
254
|
+
puts @i.first
|
255
|
+
# => 1
|
256
|
+
```
|
257
|
+
|
258
|
+
### Tatara::IntVector#last
|
259
|
+
|
260
|
+
Get last value of `Tatara::IntVector`.
|
261
|
+
|
262
|
+
```ruby
|
263
|
+
@i = Tatara::IntVector.new
|
264
|
+
(1..3).each{|i| @i << i }
|
265
|
+
# => Set new value's
|
266
|
+
puts @i.last
|
267
|
+
# => 3
|
268
|
+
```
|