Mercurial > hg > octave-nkf
comparison scripts/java/javaArray.m @ 15748:54e8c2527a9e
style and doc fixes for newly imported Java package .m files
* java/cell2mlstr.m, java/errordlg.m, java/helpdlg.m, java/inputdlg.m,
java/javaArray.m, java/javaaddpath.m, java/javaclasspath.m,
java/javafields.m, java/javamem.m, java/javamethods.m,
java/javarmpath.m, java/listdlg.m, java/msgbox.m java/questdlg.m,
java/warndlg.m: Style and doc fixes.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 07 Dec 2012 17:21:27 -0500 |
parents | da26f72408a7 |
children | 54f7ef3f7e63 |
comparison
equal
deleted
inserted
replaced
15747:4be890c5527c | 15748:54e8c2527a9e |
---|---|
15 ## You should have received a copy of the GNU General Public License | 15 ## You should have received a copy of the GNU General Public License |
16 ## along with Octave; see the file COPYING. If not, see | 16 ## along with Octave; see the file COPYING. If not, see |
17 ## <http://www.gnu.org/licenses/>. | 17 ## <http://www.gnu.org/licenses/>. |
18 | 18 |
19 ## -*- texinfo -*- | 19 ## -*- texinfo -*- |
20 ## @deftypefn {Function file} {@var{a} =} javaArray (@var{class},@var{[M,N,...]}) | 20 ## @deftypefn {Function file} {@var{a} =} javaArray (@var{class}, @var{[M,N,...]}) |
21 ## @deftypefnx {Function file} {@var{a} =} javaArray (@var{class},@var{M},@var{N},...) | 21 ## @deftypefnx {Function file} {@var{a} =} javaArray (@var{class}, @var{M}, @var{N}, @dots{}) |
22 ## | 22 ## |
23 ## Creates a Java array of size [@var{M},@var{N},...] with elements of | 23 ## Creates a Java array of size @code{[@var{M}, @var{N}, @dots{}]} with |
24 ## class @var{class}. @var{class} can be a Java object representing a class | 24 ## elements of class @var{class}. @var{class} may be a Java object |
25 ## or a string containing the fully qualified class name. | 25 ## representing a class or a string containing the fully qualified class name. |
26 ## | 26 ## |
27 ## The generated array is uninitialized, all elements are set to null | 27 ## The generated array is uninitialized, all elements are set to null |
28 ## if @var{class} is a reference type, or to a default value (usually 0) | 28 ## if @var{class} is a reference type, or to a default value (usually 0) |
29 ## if @var{class} is a primitive type. | 29 ## if @var{class} is a primitive type. |
30 ## | 30 ## |
31 ## @example | 31 ## @example |
32 ## a = javaArray ("java.lang.String", 2, 2); | 32 ## a = javaArray ("java.lang.String", 2, 2); |
33 ## a(1,1) = "Hello"; | 33 ## a(1,1) = "Hello"; |
34 ## @end example | 34 ## @end example |
35 ## | |
36 ## @end deftypefn | 35 ## @end deftypefn |
37 | 36 |
38 function [ ret ] = javaArray (class_name, varargin) | 37 function retval = javaArray (class_name, varargin) |
39 | 38 |
40 switch length (varargin) | 39 switch length (varargin) |
41 case 0 | 40 case 0 |
42 error ("missing array size"); | 41 error ("missing array size"); |
43 case 1 | 42 |
44 dims = varargin{1}; | 43 case 1 |
45 otherwise | 44 dims = varargin{1}; |
46 dims = [varargin{:}]; | 45 |
46 otherwise | |
47 dims = [varargin{:}]; | |
47 endswitch | 48 endswitch |
48 | 49 |
49 ret = java_invoke ("org.octave.ClassHelper", "createArray", class_name, dims); | 50 retval = java_invoke ("org.octave.ClassHelper", "createArray", |
51 class_name, dims); | |
50 | 52 |
51 endfunction | 53 endfunction |