reporting: code cleanup

time-shift
Houtan Bastani 2013-03-13 18:02:29 +01:00
parent 41efff0d7b
commit 46e965f3ec
15 changed files with 47 additions and 65 deletions

View File

@ -3,10 +3,10 @@ function o = createGraph(o)
% Create the graph % Create the graph
% %
% INPUTS % INPUTS
% o - Graph Object % o [graph] graph object
% %
% OUTPUTS % OUTPUTS
% o - Graph Object % o [graph] graph object
% %
% SPECIAL REQUIREMENTS % SPECIAL REQUIREMENTS
% none % none

View File

@ -3,7 +3,7 @@ function display(o)
% Display a Graph object % Display a Graph object
% %
% INPUTS % INPUTS
% none % o [graph] graph object
% %
% OUTPUTS % OUTPUTS
% none % none

View File

@ -3,11 +3,13 @@ function o = graph(varargin)
% Graph Class Constructor % Graph Class Constructor
% %
% INPUTS % INPUTS
% 0 args => empty graph % varargin 0 args : empty graph object
% 1 arg (graph class) => copy object % 1 arg : must be graph object (return a copy of arg)
% > 1 args: option/value pairs (see structure below for
% options)
% %
% OUTPUTS % OUTPUTS
% none % o [graph] graph object
% %
% SPECIAL REQUIREMENTS % SPECIAL REQUIREMENTS
% none % none

View File

@ -3,10 +3,11 @@ function o = write(o, fid)
% Write a Graph object % Write a Graph object
% %
% INPUTS % INPUTS
% fid - int, file id % o [graph] graph object
% fid [integer] file id
% %
% OUTPUTS % OUTPUTS
% o - this % o [graph] graph object
% %
% SPECIAL REQUIREMENTS % SPECIAL REQUIREMENTS
% none % none

View File

@ -19,10 +19,4 @@ function ps = addPage(ps, varargin)
% along with Dynare. If not, see <http://www.gnu.org/licenses/>. % along with Dynare. If not, see <http://www.gnu.org/licenses/>.
ps.objArray = ps.objArray.addObj(page(varargin{:})); ps.objArray = ps.objArray.addObj(page(varargin{:}));
%assert(nargin >= 1 && nargin <= 3)
%if nargin == 1
% ps.objArray = ps.objArray.addObj(page());
%else
% ps.objArray = ps.objArray.addObj(varargin{:});
%end
end end

View File

@ -1,13 +1,13 @@
function o = addGraph(o, varargin) function o = addGraph(o, varargin)
%function o = addGraph(o, varargin) %function o = addGraph(o, varargin)
% Add a section to the current page in the current report % Add a graph to the current section of the current page in the report
% %
% INPUTS % INPUTS
% o - report object % o [report] report object
% varargin - arguments to @section/addGraph.m % varargin arguments to @section/addGraph.m
% %
% OUTPUTS % OUTPUTS
% o - updated report object % o [report] updated report object
% %
% SPECIAL REQUIREMENTS % SPECIAL REQUIREMENTS
% none % none

View File

@ -1,14 +1,13 @@
function o = addPage(o, varargin) function o = addPage(o, varargin)
%function o = addPage(o, varargin) %function o = addPage(o, varargin)
% Add a page to the Cell Array of pages in the report % Add a page to the report
% %
% INPUTS % INPUTS
% 1 args => add empty page % o [report] report object
% 2 args => add given page % varargin arguments to @section/addGraph.m
% 3 args => add page at index
% %
% OUTPUTS % OUTPUTS
% updated report object % o [report] updated report object
% %
% SPECIAL REQUIREMENTS % SPECIAL REQUIREMENTS
% none % none
@ -30,22 +29,6 @@ function o = addPage(o, varargin)
% You should have received a copy of the GNU General Public License % You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>. % along with Dynare. If not, see <http://www.gnu.org/licenses/>.
%assert(nargin >= 1 && nargin <= 3, ['incorrect number of arguments passed ' ... o.pages = o.pages.addPage('orientation', o.orientation, 'paper', o.paper, ...
% 'to addPage']); varargin{:});
%assert(isa(r, 'report'), 'First argument must be a report object');
%if nargin > 1
% assert(isa(varargin{1},'page'), ['Optional 2nd arg to addPage must be a ' ...
% 'Page']);
% if nargin > 2
% assert(isnumeric(varargin{2}), ['Optional 3rd arg to addPage must be ' ...
% 'an index']);
% end
%end
if nargin == 1
o.pages = o.pages.addPage('orientation', o.orientation, 'paper', o.paper);
else
o.pages = o.pages.addPage('orientation', o.orientation, 'paper', ...
o.paper, varargin{:});
end
end end

View File

@ -1,13 +1,13 @@
function o = addSection(o, varargin) function o = addSection(o, varargin)
%function o = addSection(o, varargin) %function o = addSection(o, varargin)
% Add a section to the current page in the current report % Add a section to the current page in the report
% %
% INPUTS % INPUTS
% o - report object % o [report] report object
% varargin - arguments to @page/addSection.m % varargin arguments to @section/addGraph.m
% %
% OUTPUTS % OUTPUTS
% o - updated report object % o [report] updated report object
% %
% SPECIAL REQUIREMENTS % SPECIAL REQUIREMENTS
% none % none

View File

@ -1,13 +1,13 @@
function o = addTable(o, varargin) function o = addTable(o, varargin)
%function o = addTable(o, varargin) %function o = addTable(o, varargin)
% Add a section to the current page in the current report % Add a table to the current section of the current page in the report
% %
% INPUTS % INPUTS
% o - report object % o [report] report object
% varargin - arguments to @section/addTable.m % varargin arguments to @section/addTable.m
% %
% OUTPUTS % OUTPUTS
% o - updated report object % o [report] updated report object
% %
% SPECIAL REQUIREMENTS % SPECIAL REQUIREMENTS
% none % none

View File

@ -3,7 +3,7 @@ function display(o)
% Display a Report object % Display a Report object
% %
% INPUTS % INPUTS
% none % o [report] report object
% %
% OUTPUTS % OUTPUTS
% none % none

View File

@ -1,12 +1,12 @@
function np = numPages(r) function n = numPages(o)
%function np = numPages(r) %function n = numPages(o)
% return the number of pages currently in the report % return the number of pages currently in the report
% %
% INPUTS % INPUTS
% none % o [report] report object
% %
% OUTPUTS % OUTPUTS
% none % n [integer] number of pages in the report object
% %
% SPECIAL REQUIREMENTS % SPECIAL REQUIREMENTS
% none % none
@ -28,5 +28,5 @@ function np = numPages(r)
% You should have received a copy of the GNU General Public License % You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>. % along with Dynare. If not, see <http://www.gnu.org/licenses/>.
np = r.pages.numPages(); n = o.pages.numPages();
end end

View File

@ -3,10 +3,10 @@ function validateOrientation(orientation)
% Validate orientation string % Validate orientation string
% %
% INPUTS % INPUTS
% char : the orientation % orientation [char] orientation (one of 'portrait' or 'landscape')
% %
% OUTPUTS % OUTPUTS
% char : lowercase orientation % none
% %
% SPECIAL REQUIREMENTS % SPECIAL REQUIREMENTS
% none % none
@ -29,5 +29,6 @@ function validateOrientation(orientation)
% along with Dynare. If not, see <http://www.gnu.org/licenses/>. % along with Dynare. If not, see <http://www.gnu.org/licenses/>.
assert(any(strcmpi(orientation, {'portrait', 'landscape'})), ['Valid ' ... assert(any(strcmpi(orientation, {'portrait', 'landscape'})), ['Valid ' ...
'orientation arguments are: ''portrait'' and ''landscape''.']); 'orientation arguments are: ''portrait'' and ' ...
'''landscape''.']);
end end

View File

@ -3,10 +3,10 @@ function validatePaper(paper)
% Validate paper string % Validate paper string
% %
% INPUTS % INPUTS
% char : paper size % paper [char] valid LaTeX paper type
% %
% OUTPUTS % OUTPUTS
% char : lowercase paper % none
% %
% SPECIAL REQUIREMENTS % SPECIAL REQUIREMENTS
% none % none

View File

@ -3,11 +3,12 @@ function o = report(varargin)
% Report Class Constructor % Report Class Constructor
% %
% INPUTS % INPUTS
% 1 report class object => make a copy % varargin 0 args : empty report object
% Otherwise, option/value pairs (see structure below for options) % 1 arg : must be report object (return a copy of arg)
% > 1 args: option/value pairs (see structure below for options)
% %
% OUTPUTS % OUTPUTS
% none % o [report] report object
% %
% SPECIAL REQUIREMENTS % SPECIAL REQUIREMENTS
% none % none

View File

@ -3,10 +3,10 @@ function o = write(o)
% Write Report object % Write Report object
% %
% INPUTS % INPUTS
% o - Report Object % o [report] report object
% %
% OUTPUTS % OUTPUTS
% o - Report Object % o [report] report object
% %
% SPECIAL REQUIREMENTS % SPECIAL REQUIREMENTS
% none % none