1 ## Copyright (C) 2007 Michael Goffioul
3 ## This program is free software; you can redistribute it and/or modify
4 ## it under the terms of the GNU General Public License as published by
5 ## the Free Software Foundation; either version 2 of the License, or
6 ## (at your option) any later version.
8 ## This program is distributed in the hope that it will be useful,
9 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
10 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 ## GNU General Public License for more details.
13 ## You should have received a copy of the GNU General Public License
14 ## along with this program; If not, see <http://www.gnu.org/licenses/>.
17 ## @deftypefn {Function file} {@var{a} =} javaArray (@var{class},@var{[M,N,...]})
18 ## @deftypefnx {Function file} {@var{a} =} javaArray (@var{class},@var{M},@var{N},...)
20 ## Creates a Java array of size [@var{M},@var{N},...] with elements of
21 ## class @var{class}. @var{class} can be a Java object representing a class
22 ## or a string containing the fully qualified class name.
24 ## The generated array is uninitialized, all elements are set to null
25 ## if @var{class} is a reference type, or to a default value (usually 0)
26 ## if @var{class} is a primitive type.
29 ## a = javaArray ("java.lang.String", 2, 2);
35 function [ ret ] = javaArray (class_name, varargin)
37 switch length (varargin)
39 error ("missing array size");
46 ret = java_invoke ("org.octave.ClassHelper", "createArray", class_name, dims);