diff --git a/matlab/reports/@objArray/addObj.m b/matlab/reports/@objArray/addObj.m index c190b403b..3f2bd1f08 100644 --- a/matlab/reports/@objArray/addObj.m +++ b/matlab/reports/@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/reports/@objArray/getObjs.m b/matlab/reports/@objArray/getObjs.m index 507471082..6c7dcbeae 100644 --- a/matlab/reports/@objArray/getObjs.m +++ b/matlab/reports/@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/reports/@page/addSection.m b/matlab/reports/@page/addSection.m index 3b02c922e..4ad61a26b 100644 --- a/matlab/reports/@page/addSection.m +++ b/matlab/reports/@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 . -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/reports/@page/display.m b/matlab/reports/@page/display.m new file mode 100644 index 000000000..b7ae6c66c --- /dev/null +++ b/matlab/reports/@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 . + +name = 'report.page'; +disp(' '); +disp([name '.sections = ']); +disp(' '); +disp(o.sections()); +end \ No newline at end of file diff --git a/matlab/reports/@page/subsasgn.m b/matlab/reports/@page/subsasgn.m index 385309030..ede173bfb 100644 --- a/matlab/reports/@page/subsasgn.m +++ b/matlab/reports/@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/reports/@pages/display.m b/matlab/reports/@pages/display.m new file mode 100644 index 000000000..89eb1b977 --- /dev/null +++ b/matlab/reports/@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 . + +name = 'report.pages'; +disp(' '); +disp([name ' = ']); +disp(' '); +disp(getPages(o)); +end \ No newline at end of file diff --git a/matlab/reports/@report/addPage.m b/matlab/reports/@report/addPage.m index 9421d2886..8299f973d 100644 --- a/matlab/reports/@report/addPage.m +++ b/matlab/reports/@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/reports/@report/display.m b/matlab/reports/@report/display.m index e1080fa0f..9ed363ced 100644 --- a/matlab/reports/@report/display.m +++ b/matlab/reports/@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 . +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/reports/@report/subsasgn.m b/matlab/reports/@report/subsasgn.m index da1c92e44..527e6c905 100644 --- a/matlab/reports/@report/subsasgn.m +++ b/matlab/reports/@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/reports/@report/subsref.m b/matlab/reports/@report/subsref.m index 8d5fbab47..9559393fe 100644 --- a/matlab/reports/@report/subsref.m +++ b/matlab/reports/@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/reports/@section/display.m b/matlab/reports/@section/display.m new file mode 100644 index 000000000..e34ede934 --- /dev/null +++ b/matlab/reports/@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 . + +name = 'report.page.section'; +disp(' '); +disp([name '.x = ']); +end \ No newline at end of file diff --git a/matlab/reports/@sections/addSection.m b/matlab/reports/@sections/addSection.m index fab549127..af412a412 100644 --- a/matlab/reports/@sections/addSection.m +++ b/matlab/reports/@sections/addSection.m @@ -19,6 +19,11 @@ function ss = addSection(ss, varargin) % along with Dynare. If not, see . 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/reports/@sections/display.m b/matlab/reports/@sections/display.m new file mode 100644 index 000000000..908bd3897 --- /dev/null +++ b/matlab/reports/@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 . + +name = 'reports.page'; +disp(' '); +disp([name '.sections = ']); +disp(' '); +disp(getSections(o)); +end \ No newline at end of file