hellojava 0.0.4-java → 0.0.5-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 85d5257583e5e4c9fe0f8cfdc6670731efc2c60a615f69c4f4aebb6cec3d072a
4
- data.tar.gz: f52eaef3c17a67b13a7ba569f11a94ab06947073b22f82e753e2127bf653ad41
3
+ metadata.gz: cd8720bbd199d2a6550935f31fcb287c4a34c56989c37423e21b75e0a2c105fc
4
+ data.tar.gz: c7d9b01cfc2c859b8b22d2ee96d1a0aa4104bec9426d12c9d771aa9cb995235b
5
5
  SHA512:
6
- metadata.gz: 7c7e85c556980fbdae896014869b9dd7e2cbe811ab2912fc40fd555c85d39e3a6b2063378df5ba4d798adc87948f4a40fc8220aa711c64784f5a263c802ef010
7
- data.tar.gz: d6fc7296259986a9bb8e32205cdf1dcfc28b3160decb7da3ed1ffc10213a2c34e49bd8ba1d945f20fb6174b0d2ceafee53c29575547a486421a00953d4471164
6
+ metadata.gz: 97a9371b1ea24d09271d19ea2e3a3d89c170a997370ef1c0e52dbcb653f0b316113b1b9e6990f318871f99be6d83f4a9e4fb16fe31980117a412f7383b3dc440
7
+ data.tar.gz: d51e36fb15912e52fa54d3859b1e826f9470833eec0b422a887c8f49ef262451ddbed1d86ccd7725ccb66cb389607c55eb410068ca04d3d5c081f5e1c6bf3487
data/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## [0.0.5] - 2023-12-31
6
+
7
+ ### Added
8
+ - Add parameter test of Hash Type.
9
+
10
+ ### change
11
+ - chg function name from func_d to func_v.
12
+
5
13
  ## [0.0.4] - 2023-11-03
6
14
 
7
15
  ### Added
@@ -1,4 +1,5 @@
1
1
  import java.util.ArrayList;
2
+ import java.util.Map;
2
3
 
3
4
  public class JavaCallTest {
4
5
  public static String str1() {
@@ -16,6 +17,17 @@ public class JavaCallTest {
16
17
  }
17
18
  System.out.println();
18
19
  }
19
- }
20
+ }
21
+ public static void hash(Map<String, double[]> vals) {
22
+ System.out.println("hash in");
23
+ for(Map.Entry<String, double[]> entry : vals.entrySet()) {
24
+ System.out.print(entry.getKey());
25
+ double[] v = entry.getValue();
26
+ for(int i = 0; i < v.length; i++) {
27
+ System.out.printf(" %f", v[i]);
28
+ }
29
+ System.out.println();
30
+ }
31
+ }
20
32
  }
21
33
 
data/lib/hellojava.rb CHANGED
@@ -4,6 +4,7 @@ java_import 'java.lang.System'
4
4
  java_import 'JavaCallTest'
5
5
  java_import 'JavaCallTest2'
6
6
  java_import 'Hoge'
7
+ java_import 'java.util.HashMap'
7
8
 
8
9
  # jrubyからjavaの呼び出し
9
10
  module HelloJavaLib
@@ -42,7 +43,7 @@ module HelloJavaLib
42
43
  end
43
44
  # 引数に二次元配列の場合
44
45
  #
45
- # @overload func_d(fname, vals)
46
+ # @overload func_v(fname, vals)
46
47
  # @param [String] fname 文字列
47
48
  # @param [Array] vals 二次元の配列(double[][])
48
49
  # @return [void]
@@ -51,19 +52,41 @@ module HelloJavaLib
51
52
  # [12.3, 22.5, 33.7, 44.6],
52
53
  # [12.3, 22.5, 33.7, 44.6, 55.8],
53
54
  # ]
54
- # HelloJavaLib::func_d("fname.jpg", vals)
55
+ # HelloJavaLib::func_v("fname.jpg", vals)
55
56
  # =>
56
57
  # fname:fname.jpg size:2
57
58
  # vals[0] size:4
58
59
  # 12.300000 22.500000 33.700000 44.600000
59
60
  # vals[1] size:5
60
61
  # 12.300000 22.500000 33.700000 44.600000 55.800000
61
- def func_d(fname, vals)
62
+ def func_v(fname, vals)
62
63
  JavaCallTest.sub1(
63
64
  fname, vals.to_java(Java::double[])
64
65
  );
65
66
  return
66
67
  end
68
+ # 引数にHashの場合
69
+ #
70
+ # @overload func_h(vals)
71
+ # @param [Hash] vals Hash(String, double[])
72
+ # @return [void]
73
+ # @example
74
+ # vals = {
75
+ # "dt1" => [12.3, 22.5, 33.7, 44.6],
76
+ # "dt2" => [12.3, 22.5, 33.7, 44.6, 55.8],
77
+ # }
78
+ # HelloJavaLib::func_h(vals)
79
+ # =>
80
+ # hash in
81
+ # dt1 12.300000 22.500000 33.700000 44.600000
82
+ # dt2 12.300000 22.500000 33.700000 44.600000 55.800000
83
+ def func_h(vals)
84
+ o = HashMap.new
85
+ vals.each{|k, v|
86
+ o[k] = v.to_java(Java::double)
87
+ }
88
+ JavaCallTest.hash(o)
89
+ end
67
90
  # 引数に関数型の場合
68
91
  class FuncTypes
69
92
  class << self
@@ -119,7 +142,7 @@ module HelloJavaLib
119
142
  module_function :func_a
120
143
  module_function :func_b
121
144
  module_function :func_c
122
- module_function :func_d
123
-
145
+ module_function :func_v
146
+ module_function :func_h
124
147
  end
125
148
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hellojava
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: java
6
6
  authors:
7
7
  - siranovel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-03 00:00:00.000000000 Z
11
+ date: 2023-12-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -20,8 +20,8 @@ dependencies:
20
20
  - !ruby/object:Gem::Version
21
21
  version: 12.3.3
22
22
  name: rake
23
- prerelease: false
24
23
  type: :development
24
+ prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - "~>"
@@ -40,8 +40,8 @@ dependencies:
40
40
  - !ruby/object:Gem::Version
41
41
  version: 1.2.5
42
42
  name: rake-compiler
43
- prerelease: false
44
43
  type: :development
44
+ prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - "~>"