reporting: centralize/automate display.m

time-shift
Houtan Bastani 2013-05-15 17:11:13 +02:00
parent 965f54884d
commit 7037e2a4bc
13 changed files with 141 additions and 201 deletions

View File

@ -3,7 +3,7 @@ function display(o)
% Display a Elements object
%
% INPUTS
% none
% o [elements] elements object
%
% OUTPUTS
% none
@ -28,9 +28,5 @@ function display(o)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
name = 'report.page.section.elements';
disp(' ');
disp([name ' = ']);
disp(' ');
disp(getElements(o));
reporting_object_display(o);
end

View File

@ -28,39 +28,5 @@ function display(o)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
name = 'report.page.section.graph';
disp(' ');
disp([name '.title = ']);
disp(' ');
disp([' ''' o.title '''']);
disp(' ');
disp([name '.xlabel = ']);
disp(' ');
disp([' ''' o.xlabel '''']);
disp(' ');
disp([name '.ylabel = ']);
disp(' ');
disp([' ''' o.ylabel '''']);
disp(' ');
disp([name '.figname = ']);
disp(' ');
disp([' ''' o.figname '''']);
disp(' ');
disp([name '.legend = ']);
disp(' ');
disp(o.legend);
disp(' ');
disp([name '.shade = ']);
disp(' ');
disp(o.shade);
disp(' ');
disp([name '.seriesElements = ']);
disp(' ');
o.seriesElements.getSeriesElements()
reporting_object_display(o);
end

View File

@ -3,7 +3,7 @@ function display(oa)
% Display an objArray object
%
% INPUTS
% none
% o [objArray] objArray object
%
% OUTPUTS
% none
@ -28,8 +28,5 @@ function display(oa)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
disp(' ');
disp([inputname(1) '.objs = ']);
disp(' ');
disp(oa.objs);
reporting_object_display(o);
end

View File

@ -3,7 +3,7 @@ function display(o)
% Display a Page object
%
% INPUTS
% none
% o [page] page object
%
% OUTPUTS
% none
@ -28,9 +28,5 @@ function display(o)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
name = 'report.page';
disp(' ');
disp([name '.sections = ']);
disp(' ');
disp(o.sections());
reporting_object_display(o);
end

View File

@ -3,7 +3,7 @@ function display(o)
% Display a Pages object
%
% INPUTS
% ps [pages] pages object
% o [pages] pages object
%
% OUTPUTS
% none
@ -28,9 +28,5 @@ function display(o)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
name = 'report.pages';
disp(' ');
disp([name ' = ']);
disp(' ');
disp(getPages(o));
reporting_object_display(o);
end

View File

@ -28,34 +28,5 @@ function display(o)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
name = 'report';
disp(' ');
disp([name '.title = ']);
disp(' ');
disp([' ''' o.title '''']);
disp(' ')
disp([name '.paper = ']);
disp(' ');
disp([' ''' o.paper '''']);
disp(' ')
disp([name '.orientation = ']);
disp(' ');
disp([' ''' o.orientation '''']);
disp(' ')
disp([name '.filename = ']);
disp(' ');
disp([' ''' o.filename '''']);
disp(' ')
disp([name '.numPages() = ']);
disp(' ');
disp([' ' num2str(numPages(o))]);
disp(' ');
disp([name '.pages = ']);
disp(' ');
disp(o.pages.getPages());
reporting_object_display(o);
end

View File

@ -3,7 +3,7 @@ function display(o)
% Display a Section object
%
% INPUTS
% none
% o [section] section object
%
% OUTPUTS
% none
@ -28,15 +28,5 @@ function display(o)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
name = 'report.page.section';
disp(' ');
disp([name '.cols = ']);
disp(' ');
disp(o.cols);
disp(' ');
disp([name '.elements = ']);
disp(' ');
disp(o.elements.getElements());
reporting_object_display(o);
end

View File

@ -3,7 +3,7 @@ function display(o)
% Display a Sections object
%
% INPUTS
% none
% o [sections] sections object
%
% OUTPUTS
% none
@ -28,9 +28,5 @@ function display(o)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
name = 'reports.page';
disp(' ');
disp([name '.sections = ']);
disp(' ');
disp(getSections(o));
reporting_object_display(o);
end

View File

@ -28,65 +28,5 @@ function display(o)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
name = 'report.page.section.graph.series';
disp(' ');
disp([name '.data = ']);
disp(' ');
display(o.data);
disp(' ');
disp([name '.graphLineColor = ']);
disp(' ');
disp([' ''' o.graphLineColor '''']);
disp(' ');
disp([name '.graphLineStyle = ']);
disp(' ');
disp([' ''' o.graphLineStyle '''']);
disp(' ');
disp([name '.graphLineWidth = ']);
disp(' ');
disp([' ''' o.graphLineWidth '''']);
disp(' ');
disp([name '.graphMarker = ']);
disp(' ');
disp([' ''' o.graphMarker '''']);
disp(' ');
disp([name '.graphMarkerEdgeColor = ']);
disp(' ');
disp([' ''' o.graphMarkerEdgeColor '''']);
disp(' ');
disp([name '.graphMarkerFaceColor = ']);
disp(' ');
disp([' ''' o.graphMarkerFaceColor '''']);
disp(' ');
disp([name '.graphMarkerSize = ']);
disp(' ');
disp([' ''' o.graphMarkerSize '''']);
disp(' ');
disp([name '.tableAlignRight = ']);
disp(' ');
disp([' ''' o.tableAlignRight '''']);
disp(' ');
disp([name '.tableNegColor = ']);
disp(' ');
disp([' ''' o.tableNegColor '''']);
disp(' ');
disp([name '.tablePosColor = ']);
disp(' ');
disp([' ''' o.tablePosColor '''']);
disp(' ');
disp([name '.tableShowMarkers = ']);
disp(' ');
disp([' ''' o.tableShowMarkers '''']);
reporting_object_display(o);
end

View File

@ -1,9 +1,9 @@
function display(o)
%function display(o)
% Display a Elements object
% Display a seriesElements object
%
% INPUTS
% none
% o [seriesElements] seriesElements object
%
% OUTPUTS
% none
@ -28,10 +28,5 @@ function display(o)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
name = 'report.page.section.elements.seriesElement';
disp(' ');
disp([name ' = ']);
disp(' ');
disp(getSeriesElements(o));
reporting_object_display(o);
end

View File

@ -3,7 +3,7 @@ function display(o)
% Display a Table object
%
% INPUTS
% none
% o [table] table object
%
% OUTPUTS
% none
@ -28,29 +28,5 @@ function display(o)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
name = 'report.page.section.table';
disp(' ');
disp([name '.title = ']);
disp(' ');
disp([' ''' o.title '''']);
disp(' ');
disp([name '.showHlines = ']);
disp(' ');
disp(o.showHlines);
disp(' ');
disp([name '.showVlines = ']);
disp(' ');
disp(o.showVlines);
disp(' ');
disp([name '.precision = ']);
disp(' ');
disp(o.precision);
disp(' ');
disp([name '.seriesElements = ']);
disp(' ');
o.seriesElements.getSeriesElements()
reporting_object_display(o);
end

View File

@ -0,0 +1,32 @@
function display(o)
%function display(o)
% Display a Vspace object
%
% INPUTS
% o [vspace] vspace object
%
% OUTPUTS
% none
%
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2013 Dynare Team
%
% This file is part of Dynare.
%
% Dynare is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Dynare is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
reporting_object_display(o);
end

View File

@ -0,0 +1,89 @@
function reporting_object_display(o)
%function reporting_object_display(o)
% Display a Reporting Object
% i.e., one of: elements
% graph
% objArray
% page
% pages
% report
% section
% sections
% series
% seriesElements
% table
% vspace
%
% INPUTS
% o [object] reporting object
%
% OUTPUTS
% none
%
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2013 Dynare Team
%
% This file is part of Dynare.
%
% Dynare is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Dynare is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
fprintf('\n%s Object = \n\n', upper(class(o)));
fields = fieldnames(o);
for i=1:length(fields)
fprintf(' %s: ', fields{i});
val = o.(fields{i});
if iscell(val)
fprintf('{');
for j=1:length(val)
assert(ischar(val{j}));
fprintf('''%s''', val{j});
if j~=length(val)
fprintf(', ');
end
end
fprintf('}');
elseif ischar(val)
fprintf('''%s''', val);
elseif isnumeric(val)
fprintf('%s', num2str(val));
elseif islogical(val)
if val
fprintf('true');
else
fprintf('false');
end
elseif isobject(val)
if isa(val, 'dynDates')
fprintf('<dynDates: %s, ..., %s>', ...
val(1).format, val(end).format);
elseif isa(val, 'dynSeries')
if numel(val) == 1
fprintf('<dynSeries: %s>', val.name{1});
else
fprintf('%s', class(val));
end
else
cl = class(val);
fprintf('%d', val.(['num' upper(cl(1)) cl(2:end)]));
end
else
keyboard
fprintf('fix this');
end
fprintf('\n');
end
fprintf('\n');
end