Mercurial > hg > octave-nkf
comparison scripts/java/javamethods.m @ 15772:0f1a143e5002
Overhaul scripts/java directory to conform to Octave core.
Update docstrings. Use Octave coding conventions. Use default arguments
where possible. Match variable names in docstring to variable names in
function.
HG: Enter commit message. Lines beginning with 'HG:' are removed.
HG: Leave message empty to abort commit.
HG: --
HG: user: Rik <rik@octave.org>
HG: branch 'default'
* errordlg.m, helpdlg.m, inputdlg.m, javaArray.m, javaaddpath.m,
javaclasspath.m, javafields.m, javamem.m, javamethods.m, javarmpath.m,
listdlg.m, msgbox.m, questdlg.m, warndlg.m: Overhaul functions.
Update docstrings. Use Octave coding conventions. Use default arguments
where possible. Match variable names in docstring to variable names in
function.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 12 Dec 2012 13:48:47 -0800 |
parents | 54e8c2527a9e |
children |
comparison
equal
deleted
inserted
replaced
15771:4698ea77aa75 | 15772:0f1a143e5002 |
---|---|
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{P} =} javamethods (@var{class}) | 20 ## @deftypefn {Function File} {} javamethods (@var{javaobj}) |
21 ## Return the methods of a Java object in the form of a cell | 21 ## @deftypefnx {Function File} {} javamethods ("@var{classname}") |
22 ## @deftypefnx {Function File} {@var{mtd_names} =} javamethods (@dots{}) | |
23 ## Return the methods of a Java object or Java class in the form of a cell | |
22 ## array of strings. If no output is requested, print the result to the | 24 ## array of strings. If no output is requested, print the result to the |
23 ## standard output. | 25 ## standard output. |
24 ## @seealso{methods} | 26 ## @seealso{javafields, java_invoke, javaMethod, javaObject} |
25 ## @end deftypefn | 27 ## @end deftypefn |
26 | 28 |
27 function retval = javamethods (classname) | 29 function mtd_names = javamethods (classname) |
28 | 30 |
29 if (nargin != 1) | 31 if (nargin != 1) |
30 print_usage (); | 32 print_usage (); |
33 endif | |
34 | |
35 cls_methods = java_invoke ("org.octave.ClassHelper", "getMethods", classname); | |
36 method_list = strsplit (cls_methods, ';'); | |
37 | |
38 if (nargout == 0) | |
39 if (! isempty (method_list)) | |
40 disp (method_list); | |
41 endif | |
31 else | 42 else |
32 c_methods = java_invoke ("org.octave.ClassHelper", "getMethods", classname); | 43 mtd_names = cellstr (method_list); |
33 method_list = strsplit (c_methods, ";"); | |
34 | |
35 switch nargout | |
36 case 0 | |
37 if (! isempty (method_list)) | |
38 disp(method_list); | |
39 endif | |
40 case 1 | |
41 retval = cellstr (method_list); | |
42 endswitch | |
43 endif | 44 endif |
44 | 45 |
45 endfunction | 46 endfunction |
47 |