hellojava 0.0.1-java → 0.0.3-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -1
- data/Rakefile +3 -6
- data/ext/hellojava/JavaCallTest.java +12 -0
- data/lib/hellojava.rb +47 -2
- metadata +2 -3
- data/hellojava.gemspec +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1cffd381d1e1109af675b8cb94187962e67b6dbf3ea6042eb97b5a9f073eb3ec
|
4
|
+
data.tar.gz: 46b0dd75a091b2102b8749a13b9875d9cc6ca0dbb5de8e8a29c14d9c983bff75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38a4c1b06b61727bd80a75ef5304acbc07f3fd97f3cfd3ab18172e8d7386fe56d44e919dd0b02e25eac5525a600bf0f4ee39db60fbb406b0f72b55798c0edd63
|
7
|
+
data.tar.gz: 564535daf02d2b576adcd9a7af2baa000d0226b2ac1368bc2676a799bb8e07271e1a047c7d5e53c87d0cca1ff7dc0f12a9cebaa1ee4a22378d7dbe34f96abb22
|
data/CHANGELOG.md
CHANGED
@@ -2,7 +2,17 @@
|
|
2
2
|
|
3
3
|
## Unreleased
|
4
4
|
|
5
|
-
## [0.0.
|
5
|
+
## [0.0.3] - 2023-10-21
|
6
|
+
|
7
|
+
### Added
|
8
|
+
- Add test parameter of A two-dimensional array
|
9
|
+
|
10
|
+
## [0.0.2] - 2023-09-27
|
11
|
+
|
12
|
+
### Added
|
13
|
+
- Add yardoc
|
14
|
+
|
15
|
+
## [0.0.1] - 2023-09-05
|
6
16
|
|
7
17
|
### Fixed
|
8
18
|
- fix first fixed.
|
data/Rakefile
CHANGED
@@ -1,9 +1,6 @@
|
|
1
|
-
require
|
1
|
+
require 'rake/javaextensiontask'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
ext.source_version = '11'
|
6
|
-
ext.target_version = '11'
|
3
|
+
Rake::JavaExtensionTask.new(name='hellojava') do | ext |
|
4
|
+
ext.release = '11'
|
7
5
|
end
|
8
|
-
|
9
6
|
task :default => [:compile]
|
@@ -1,3 +1,5 @@
|
|
1
|
+
import java.util.ArrayList;
|
2
|
+
|
1
3
|
public class JavaCallTest {
|
2
4
|
public static String str1() {
|
3
5
|
return "str1";
|
@@ -5,5 +7,15 @@ public class JavaCallTest {
|
|
5
7
|
public String str2() {
|
6
8
|
return "str2";
|
7
9
|
}
|
10
|
+
public static void sub1(String fname, double[][] vals) {
|
11
|
+
System.out.printf("fname:%s size:%d\n", fname, vals.length);
|
12
|
+
for (int i = 0; i < vals.length; i++) {
|
13
|
+
System.out.printf("vals[%d] size:%d\n", i, vals[i].length);
|
14
|
+
for (int j = 0; j < vals[i].length; j++) {
|
15
|
+
System.out.printf(" %f", vals[i][j]);
|
16
|
+
}
|
17
|
+
System.out.println();
|
18
|
+
}
|
19
|
+
}
|
8
20
|
}
|
9
21
|
|
data/lib/hellojava.rb
CHANGED
@@ -5,22 +5,67 @@ java_import 'JavaCallTest'
|
|
5
5
|
java_import 'Hoge'
|
6
6
|
|
7
7
|
module HelloJavaLib
|
8
|
-
|
8
|
+
# Systemクラス使用
|
9
|
+
#
|
10
|
+
# @overload func_a
|
11
|
+
# @return [void]
|
12
|
+
# @example
|
13
|
+
# HelloJavaLib::func_a() => 'Hello, JRuby'
|
9
14
|
def func_a()
|
10
15
|
System.out.println("Hello, JRuby")
|
11
16
|
end
|
17
|
+
# 標準クラス以外の使用
|
18
|
+
#
|
19
|
+
# @overload func_b
|
20
|
+
# @return [void]
|
21
|
+
# @example
|
22
|
+
# HelloJavaLib::func_b() => 'str1'
|
12
23
|
def func_b()
|
13
24
|
p JavaCallTest.str1
|
25
|
+
return
|
14
26
|
end
|
27
|
+
# 戻り値がオブジェクトの場合
|
28
|
+
#
|
29
|
+
# @overload func_c(value1, value2)
|
30
|
+
# @param [int] value1 value1の値
|
31
|
+
# @param [int] value2 value2の値
|
32
|
+
# @return [void]
|
33
|
+
# @example
|
34
|
+
# HelloJavaLib::func_c(1, 2) => 3
|
15
35
|
def func_c(value1, value2)
|
16
36
|
hoge = Hoge.new
|
17
37
|
calc = hoge.getCalc(value1, value2)
|
18
38
|
p calc.add
|
39
|
+
return
|
40
|
+
end
|
41
|
+
# 引数に二次元配列の場合
|
42
|
+
#
|
43
|
+
# @overload func_d(fname, vals)
|
44
|
+
# @param [String] fname 文字列
|
45
|
+
# @param [Array] vals 二次元の配列(double[][])
|
46
|
+
# @return [void]
|
47
|
+
# @example
|
48
|
+
# vals = [
|
49
|
+
# [12.3, 22.5, 33.7, 44.6],
|
50
|
+
# [12.3, 22.5, 33.7, 44.6, 55.8],
|
51
|
+
# ]
|
52
|
+
# HelloJavaLib::func_d("fname.jpg", vals)
|
53
|
+
# =>
|
54
|
+
# fname:fname.jpg size:2
|
55
|
+
# vals[0] size:4
|
56
|
+
# 12.300000 22.500000 33.700000 44.600000
|
57
|
+
# vals[1] size:5
|
58
|
+
# 12.300000 22.500000 33.700000 44.600000 55.800000
|
59
|
+
def func_d(fname, vals)
|
60
|
+
p JavaCallTest.sub1(
|
61
|
+
fname, vals.to_java(Java::double[])
|
62
|
+
);
|
63
|
+
return
|
19
64
|
end
|
20
|
-
|
21
65
|
module_function :func_a
|
22
66
|
module_function :func_b
|
23
67
|
module_function :func_c
|
68
|
+
module_function :func_d
|
24
69
|
|
25
70
|
end
|
26
71
|
|
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
|
+
version: 0.0.3
|
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
|
+
date: 2023-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -64,7 +64,6 @@ files:
|
|
64
64
|
- ext/hellojava/Calc.java
|
65
65
|
- ext/hellojava/Hoge.java
|
66
66
|
- ext/hellojava/JavaCallTest.java
|
67
|
-
- hellojava.gemspec
|
68
67
|
- lib/hellojava.rb
|
69
68
|
homepage: http://github.com/siranovel/stdy4act
|
70
69
|
licenses:
|
data/hellojava.gemspec
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
Gem::Specification.new do |s|
|
2
|
-
s.name = 'hellojava'
|
3
|
-
s.version = '0.0.1'
|
4
|
-
s.date = '2023-09-02'
|
5
|
-
s.summary = "hello jruby"
|
6
|
-
s.description = "call from jruby to java."
|
7
|
-
s.platform = 'java'
|
8
|
-
s.authors = ["siranovel"]
|
9
|
-
s.email = "siranovel@gmail.com"
|
10
|
-
s.homepage = "http://github.com/siranovel/stdy4act"
|
11
|
-
s.license = "MIT"
|
12
|
-
s.files = ["LICENSE", "Gemfile", "CHANGELOG.md"]
|
13
|
-
s.files += ["hellojava.gemspec"]
|
14
|
-
s.files += Dir.glob("{lib,ext}/**/*")
|
15
|
-
s.extensions = %w[Rakefile]
|
16
|
-
s.add_development_dependency 'rake', '~> 12.3', '>= 12.3.3'
|
17
|
-
s.add_development_dependency 'rake-compiler', '~> 1.2', '>= 1.2.5'
|
18
|
-
end
|
19
|
-
|