diff --git a/matlab/reporting/@objArray/addObj.m b/matlab/reporting/@objArray/addObj.m index c190b403b7264ef3f688f358d01fb1304ffa872b..3f2bd1f0839acf6aa2de8e5800cf6a5d3f386291 100644 --- a/matlab/reporting/@objArray/addObj.m +++ b/matlab/reporting/@objArray/addObj.m @@ -29,4 +29,5 @@ if nargin == 2 oa.objs{end+1} = varargin{1}; elseif nargin == 3 oa.objs{varargin{2}} = varargin{1}; +end end \ No newline at end of file diff --git a/matlab/reporting/@objArray/getObjs.m b/matlab/reporting/@objArray/getObjs.m index 5074710827d82525cb0f13cf0d7986baa48013ac..6c7dcbeae9550f8633f82fe283befc8982867e84 100644 --- a/matlab/reporting/@objArray/getObjs.m +++ b/matlab/reporting/@objArray/getObjs.m @@ -22,6 +22,7 @@ switch nargin case 1 e = oa.objs; case 2 + assert(isnumeric(varargin{1})); e = oa.objs{varargin{1}}; otherwise error('objArray getObjs: invalid number of arguments'); diff --git a/matlab/reporting/@page/addSection.m b/matlab/reporting/@page/addSection.m index 3b02c922ec3d014c5c52d954b486d0a6367d0b10..4ad61a26bc72a04dde38042c9bc4692475d16b21 100644 --- a/matlab/reporting/@page/addSection.m +++ b/matlab/reporting/@page/addSection.m @@ -30,20 +30,9 @@ function p = addSection(p, varargin) % You should have received a copy of the GNU General Public License % along with Dynare. If not, see <http://www.gnu.org/licenses/>. -assert(nargin >= 1 && nargin <= 3, ['incorrect number of arguments passed ' ... - 'to addSection']); assert(isa(p, 'page'), 'First argument must be a page object'); -if nargin > 1 - assert(isa(varargin{1},'section'), ['Optional 2nd arg to addSection must be a ' ... - 'Section']); - if nargin > 2 - assert(isnumeric(varargin{2}), ['Optional 3rd arg to addSection must be ' ... - 'an index']); - end -end - if nargin == 1 - p.sections = p.sections.addSection(section()); + p.sections = p.sections.addSection(); elseif nargin == 2 || nargin == 3 p.sections = p.sections.addSection(varargin{:}); end diff --git a/matlab/reporting/@page/display.m b/matlab/reporting/@page/display.m new file mode 100644 index 0000000000000000000000000000000000000000..b7ae6c66c7370cc03acf88a6d2213d791a6d9607 --- /dev/null +++ b/matlab/reporting/@page/display.m @@ -0,0 +1,36 @@ +function display(o) +%function display(o) +% Display a Page object +% +% INPUTS +% none +% +% 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/>. + +name = 'report.page'; +disp(' '); +disp([name '.sections = ']); +disp(' '); +disp(o.sections()); +end \ No newline at end of file diff --git a/matlab/reporting/@page/subsasgn.m b/matlab/reporting/@page/subsasgn.m index 385309030ca0448af6d227434def001c908be2e6..ede173bfbf797cb7fd306d30279053b4bba9b0e5 100644 --- a/matlab/reporting/@page/subsasgn.m +++ b/matlab/reporting/@page/subsasgn.m @@ -35,7 +35,7 @@ switch S.type B{index} = V; case '.' switch S.subs - case fields(A) + case fieldnames(A) B.(S.subs) = V; otherwise error(['field ' S.subs 'does not exist in the page class']) diff --git a/matlab/reporting/@pages/display.m b/matlab/reporting/@pages/display.m new file mode 100644 index 0000000000000000000000000000000000000000..89eb1b977903438ce8995e1210f07f11ecc68a23 --- /dev/null +++ b/matlab/reporting/@pages/display.m @@ -0,0 +1,36 @@ +function display(o) +%function display(o) +% Display a Pages object +% +% INPUTS +% none +% +% 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/>. + +name = 'report.pages'; +disp(' '); +disp([name ' = ']); +disp(' '); +disp(getPages(o)); +end \ No newline at end of file diff --git a/matlab/reporting/@report/addPage.m b/matlab/reporting/@report/addPage.m index 9421d2886d84426fb0c44d73d2f88d0122a3e108..8299f973d68b2b05069acfc4fddccab57efa8e9f 100644 --- a/matlab/reporting/@report/addPage.m +++ b/matlab/reporting/@report/addPage.m @@ -43,7 +43,7 @@ if nargin > 1 end if nargin == 1 - r.pages = r.pages.addPage(page()); + r.pages = r.pages.addPage(); elseif nargin == 2 || nargin == 3 r.pages = r.pages.addPage(varargin{:}); end diff --git a/matlab/reporting/@report/display.m b/matlab/reporting/@report/display.m index e1080fa0f6043f2b0e0f98ebbf34f3d892f5ae17..9ed363cedeaf3242376ced8517c1f00d56d4604b 100644 --- a/matlab/reporting/@report/display.m +++ b/matlab/reporting/@report/display.m @@ -1,5 +1,5 @@ -function display(r) -%function display(r) +function display(o) +%function display(o) % Display a Report object % % INPUTS @@ -28,20 +28,21 @@ function display(r) % 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([inputname(1) '.title = ']); +disp([name '.title = ']); disp(' '); -disp([' ''' r.title '''']); +disp([' ''' o.title '''']); disp(' ') -disp([inputname(1) '.orientation = ']); +disp([name '.orientation = ']); disp(' '); -disp([' ''' r.orientation '''']); +disp([' ''' o.orientation '''']); disp(' ') -disp([inputname(1) '.numPages() = ']); +disp([name '.numPages() = ']); disp(' '); -disp([' ' num2str(numPages(r))]); +disp([' ' num2str(numPages(o))]); disp(' '); -disp([inputname(1) '.pages = ']); +disp([name '.pages = ']); disp(' '); -disp(r.pages.getPages()); +disp(o.pages.getPages()); end \ No newline at end of file diff --git a/matlab/reporting/@report/subsasgn.m b/matlab/reporting/@report/subsasgn.m index da1c92e44b78b43ba905a65b9294798e9b5e794d..527e6c905925ef4f16fabb3ffb7516e3cce21df7 100644 --- a/matlab/reporting/@report/subsasgn.m +++ b/matlab/reporting/@report/subsasgn.m @@ -35,7 +35,7 @@ switch S.type B.pages(index) = V; case '.' switch S.subs - case fields(A) + case fieldnames(A) B.(S.subs) = V; otherwise error(['field ' S.subs 'does not exist in the report class']); diff --git a/matlab/reporting/@report/subsref.m b/matlab/reporting/@report/subsref.m index 8d5fbab47d513a80fcabfc92d28ba16f27074e9d..9559393fe62e22803d88c46c1580342f465a08f6 100644 --- a/matlab/reporting/@report/subsref.m +++ b/matlab/reporting/@report/subsref.m @@ -34,9 +34,7 @@ switch S(1).type error(['Report Class: unknown field or method: ' S(1).subs]); end case '()' - index = S(1).subs{:}; - assert(isnumeric(index)); - A = A(index); + A = A.pages.getPages(S(1).subs{:}); case '{}' error(['Report Class: ' S(1).type ' indexing not supported.']); otherwise diff --git a/matlab/reporting/@section/display.m b/matlab/reporting/@section/display.m new file mode 100644 index 0000000000000000000000000000000000000000..e34ede934843051ad90827bd6de5c6920892949b --- /dev/null +++ b/matlab/reporting/@section/display.m @@ -0,0 +1,34 @@ +function display(o) +%function display(o) +% Display a Section object +% +% INPUTS +% none +% +% 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/>. + +name = 'report.page.section'; +disp(' '); +disp([name '.x = ']); +end \ No newline at end of file diff --git a/matlab/reporting/@sections/addSection.m b/matlab/reporting/@sections/addSection.m index fab549127df0454d5f9097a3d36c9309ed1d9ddd..af412a412a1f17d2c0cc8be5397869f9bc711153 100644 --- a/matlab/reporting/@sections/addSection.m +++ b/matlab/reporting/@sections/addSection.m @@ -19,6 +19,11 @@ function ss = addSection(ss, varargin) % along with Dynare. If not, see <http://www.gnu.org/licenses/>. assert(nargin >= 1 && nargin <= 3) +if nargin > 1 + assert(isa(varargin{1},'section'), ['Optional 2nd arg to addSection ' ... + 'must be a Section']); +end + if nargin == 1 ss.objArray = ss.objArray.addObj(section()); else diff --git a/matlab/reporting/@sections/display.m b/matlab/reporting/@sections/display.m new file mode 100644 index 0000000000000000000000000000000000000000..908bd389730e76670f6dc25fd0e2e8024ffcb279 --- /dev/null +++ b/matlab/reporting/@sections/display.m @@ -0,0 +1,36 @@ +function display(o) +%function display(o) +% Display a Sections object +% +% INPUTS +% none +% +% 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/>. + +name = 'reports.page'; +disp(' '); +disp([name '.sections = ']); +disp(' '); +disp(getSections(o)); +end \ No newline at end of file