NCCOOS Trac Projects: Top | Web | Platforms | Processing | Viz | Sprints | Sandbox | (Wind)

root/gliderproc/trunk/MATLAB/util/describe.m

Revision 495 (checked in by cbc, 12 years ago)

Initial import of Stark code.

Line 
1 function status = describe(theItem, howMuch)
2
3 % describe -- Explanation of an item.
4 %  describe('theFunction') shows help for 'theFunction'.
5 %  describe(theObject) describes theObject itself, but not
6 %   its inherited parts.
7 %  describe(theObject, 'full') describes theObject fully.
8 %  describe(theNonObject, ...) describes theNonObject.
9
10 % Copyright (C) 1996 Dr. Charles R. Denham, ZYDECO.
11 %  All Rights Reserved.
12 %   Disclosure without written consent from the
13 %    copyright owner does not constitute publication.
14
15 if nargin < 1, describe('describe'), return, end
16 if nargin < 2, howMuch = ''; end
17
18 theName = inputname(1);
19
20 if isstr(theItem)
21    help(theItem)
22   elseif isobject(theItem)
23    disp(' ')
24    if ~isempty(theName)
25       disp([' ## Name: ' theName])
26    end
27    if isobject(theItem)
28       disp([' ## Public Class: ' class(theItem)])
29       s = super(theItem);
30       while isobject(s)
31          disp([' ## Public SuperClass: ' class(s)])
32          s = super(s);
33       end
34       disp([' ## Protected Methods:'])
35       theMethods = methods(class(theItem));
36       for i = 1:length(theMethods)
37          if strcmp(class(theItem), theMethods{i})
38             disp(['    ' class(theItem) '/' theMethods{i} '() // Constructor'])
39            else
40             disp(['    ' class(theItem) '/' theMethods{i} '()'])
41          end
42       end
43       disp([' ## Private Fields:']), disp(struct(theItem))
44       if strcmp(lower(howMuch), 'full')
45          if isobject(super(theItem))
46             disp([' ## Inherited by ' class(theItem) ':'])
47             describe(super(theItem), 'full')
48             theItem = super(theItem);
49          end
50       end
51    end
52   else
53    disp([' ## Name: ' theName])
54    disp([' ## Class: ' class(theItem)])
55    disp([' ## Value:'])
56    disp(theItem)
57 end
Note: See TracBrowser for help on using the browser.