Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Dóra Kocsis
dynare
Commits
fe5f61db
Commit
fe5f61db
authored
Feb 12, 2013
by
Houtan Bastani
Browse files
reporting (WIP)
parent
73218bd8
Changes
40
Hide whitespace changes
Inline
Side-by-side
matlab/dynare_config.m
View file @
fe5f61db
...
...
@@ -62,6 +62,7 @@ addpath([dynareroot '/utilities/tests/'])
addpath
([
dynareroot
'/utilities/dates/'
])
addpath
([
dynareroot
'/utilities/dataset/'
])
addpath
([
dynareroot
'/utilities/general/'
])
addpath
([
dynareroot
'/reports/'
])
% For functions that exist only under some Octave versions
% or some MATLAB versions, and for which we provide some replacement functions
...
...
matlab/reports/@objArray/addObj.m
0 → 100644
View file @
fe5f61db
function
oa
=
addObj
(
oa
,
varargin
)
%function oa = addObj(oa, varargin)
% 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/>.
assert
(
nargin
>=
2
&&
nargin
<=
3
)
assert
(
isa
(
oa
,
'objArray'
),
'First argument must be an objArray'
);
assert
(
isobject
(
varargin
{
1
}),
'Optional 2nd arg must be an object'
);
if
nargin
==
3
assert
(
isnumeric
(
varargin
{
2
}),
'Optional 3rd arg must be an index'
);
end
if
nargin
==
2
oa
.
objs
{
end
+
1
}
=
varargin
{
1
};
elseif
nargin
==
3
oa
.
objs
{
varargin
{
2
}}
=
varargin
{
1
};
end
\ No newline at end of file
matlab/reports/@objArray/display.m
0 → 100644
View file @
fe5f61db
function
display
(
oa
)
%function display(oa)
% Display an objArray 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/>.
disp
(
' '
);
disp
([
inputname
(
1
)
'.objs = '
]);
disp
(
' '
);
disp
(
oa
.
objs
);
end
\ No newline at end of file
matlab/reports/@objArray/getObjs.m
0 → 100644
View file @
fe5f61db
function
e
=
getObjs
(
oa
,
varargin
)
%function e = getObjs(oa, varargin)
% 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/>.
switch
nargin
case
1
e
=
oa
.
objs
;
case
2
e
=
oa
.
objs
{
varargin
{
1
}};
otherwise
error
(
'objArray getObjs: invalid number of arguments'
);
end
end
\ No newline at end of file
matlab/reports/@objArray/numObjs.m
0 → 100644
View file @
fe5f61db
function
no
=
numObjs
(
oa
)
%function no = numObjs(oa)
% 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/>.
no
=
size
(
oa
.
objs
,
2
);
end
\ No newline at end of file
matlab/reports/@objArray/objArray.m
0 → 100644
View file @
fe5f61db
function
oa
=
objArray
(
varargin
)
%function oa = objArray(varargin)
% ObjArray Class Constructor
%
% 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/>.
switch
nargin
case
0
oa
=
struct
;
oa
.
objs
=
cell
(
0
);
oa
=
class
(
oa
,
'objArray'
);
case
1
assert
(
isa
(
varargin
{
1
},
'objArray'
),
[
'ObjArray constructor: the only '
...
'valid arguments are objArray objects'
]);
oa
=
varargin
{
1
};
otherwise
error
(
'ObjArray constructor: invalid number of arguments'
);
end
end
\ No newline at end of file
matlab/reports/@objArray/subsasgn.m
0 → 100644
View file @
fe5f61db
function
B
=
subsasgn
(
A
,
S
,
V
)
% function B = subsasgn(A, S, V)
% 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/>.
B
=
A
;
if
length
(
S
)
>
1
for
i
=
1
:(
length
(
S
)
-
1
)
B
=
subsref
(
B
,
S
(
i
));
end
B
=
subsasgn
(
B
,
S
(
end
),
V
);
B
=
subsasgn
(
A
,
S
(
1
:(
end
-
1
)),
B
);
return
end
switch
S
.
type
case
'()'
index
=
S
.
subs
{:};
assert
(
isnumeric
(
index
));
B
.
objs
{
index
}
=
V
;
otherwise
error
(
'objArray subsasgn syntax error'
)
end
end
\ No newline at end of file
matlab/reports/@objArray/subsref.m
0 → 100644
View file @
fe5f61db
function
A
=
subsref
(
A
,
S
)
%function A = subsref(A, S)
% 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/>.
switch
S
(
1
)
.
type
case
'.'
switch
S
(
1
)
.
subs
case
fieldnames
(
A
)
A
=
A
.
(
S
(
1
)
.
subs
);
case
methods
(
A
)
if
areParensNext
(
S
)
A
=
feval
(
S
(
1
)
.
subs
,
A
,
S
(
2
)
.
subs
{:});
S
=
shiftS
(
S
);
else
A
=
feval
(
S
(
1
)
.
subs
,
A
);
end
otherwise
error
([
'ObjArray Class: unknown field or method: '
S
(
1
)
.
subs
]);
end
case
'()'
A
=
getObjs
(
A
,
S
(
1
)
.
subs
{:});
case
'{}'
error
([
'ObjArray Class: '
S
(
1
)
.
type
' indexing not supported.'
]);
otherwise
error
(
'ObjArray Class: subsref.m impossible case'
)
end
S
=
shiftS
(
S
);
if
length
(
S
)
>=
1
A
=
subsref
(
A
,
S
);
end
end
matlab/reports/@page/addSection.m
0 → 100644
View file @
fe5f61db
function
p
=
addSection
(
p
,
varargin
)
%function p = addSection(p, varargin)
% Add a section to the Cell Array of sections in the report
%
% INPUTS
% 1 args => add empty section
% 2 args => add given section
% 3 args => add section at index
%
% OUTPUTS
% updated report object
%
% 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/>.
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
());
elseif
nargin
==
2
||
nargin
==
3
p
.
sections
=
p
.
sections
.
addSection
(
varargin
{:});
end
end
matlab/reports/@page/numSections.m
0 → 100644
View file @
fe5f61db
function
ns
=
numSections
(
p
)
%function ns = numSections(p)
% return the number of sections currently in the page
%
% 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/>.
ns
=
p
.
sections
.
numSections
();
end
\ No newline at end of file
matlab/reports/@page/page.m
0 → 100644
View file @
fe5f61db
function
p
=
page
(
varargin
)
%function p = page(varargin)
% Page Class Constructor
%
% INPUTS
% 0 args => empty page
% 1 arg (page class) => copy 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/>.
p
=
struct
;
p
.
sections
=
sections
();
switch
nargin
case
0
p
=
class
(
p
,
'page'
);
case
1
assert
(
isa
(
varargin
{
1
},
'page'
),
[
'Page constructor: the only valid '
...
'arguments are page objects'
]);
p
=
varargin
{
1
};
otherwise
error
(
'Page constructor: invalid number of arguments'
);
end
end
\ No newline at end of file
matlab/reports/@page/subsasgn.m
0 → 100644
View file @
fe5f61db
function
B
=
subsasgn
(
A
,
S
,
V
)
% function B = subsasgn(A, S, V)
% 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/>.
B
=
A
;
if
length
(
S
)
>
1
for
i
=
1
:(
length
(
S
)
-
1
)
B
=
subsref
(
B
,
S
(
i
));
end
B
=
subsasgn
(
B
,
S
(
end
),
V
);
B
=
subsasgn
(
A
,
S
(
1
:(
end
-
1
)),
B
);
return
end
switch
S
.
type
case
'()'
index
=
S
.
subs
{:};
assert
(
isnumeric
(
index
));
B
{
index
}
=
V
;
case
'.'
switch
S
.
subs
case
fields
(
A
)
B
.
(
S
.
subs
)
=
V
;
otherwise
error
([
'field '
S
.
subs
'does not exist in the page class'
])
end
otherwise
error
(
'report subsasign syntax error'
)
end
end
\ No newline at end of file
matlab/reports/@page/subsref.m
0 → 100644
View file @
fe5f61db
function
A
=
subsref
(
A
,
S
)
%function A = subsref(A, S)
% 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/>.
switch
S
(
1
)
.
type
case
'.'
switch
S
(
1
)
.
subs
case
fieldnames
(
A
)
A
=
A
.
(
S
(
1
)
.
subs
);
case
methods
(
A
)
if
areParensNext
(
S
)
A
=
feval
(
S
(
1
)
.
subs
,
A
,
S
(
2
)
.
subs
{:});
S
=
shiftS
(
S
);
else
A
=
feval
(
S
(
1
)
.
subs
,
A
);
end
otherwise
error
([
'Page Class: unknown field or method: '
S
(
1
)
.
subs
]);
end
case
'()'
A
=
getSections
(
A
,
S
(
1
)
.
subs
{:});
case
'{}'
error
([
'Page Class: '
S
(
1
)
.
type
' indexing not supported.'
]);
otherwise
error
(
'Page Class: subsref.m impossible case'
)
end
S
=
shiftS
(
S
);
if
length
(
S
)
>=
1
A
=
subsref
(
A
,
S
);
end
end
matlab/reports/@pages/addPage.m
0 → 100644
View file @
fe5f61db
function
ps
=
addPage
(
ps
,
varargin
)
% function ps = addPage(ps, varargin)
% 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/>.
assert
(
nargin
>=
1
&&
nargin
<=
3
)
if
nargin
==
1
ps
.
objArray
=
ps
.
objArray
.
addObj
(
page
());
else
ps
.
objArray
=
ps
.
objArray
.
addObj
(
varargin
{:});
end
end
\ No newline at end of file
matlab/reports/@pages/getPages.m
0 → 100644
View file @
fe5f61db
function
e
=
getPages
(
ps
,
varargin
)
% function e = getPages(ps, varargin)
% 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/>.
e
=
ps
.
objArray
.
getObjs
(
varargin
{:});
end
\ No newline at end of file
matlab/reports/@pages/numPages.m
0 → 100644
View file @
fe5f61db
function
np
=
numPages
(
ps
)
% function np = numPages(ps)
% 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/>.
np
=
ps
.
objArray
.
numObjs
();
end
\ No newline at end of file
matlab/reports/@pages/pages.m
0 → 100644
View file @
fe5f61db
function
ps
=
pages
(
varargin
)
%function ps = pages(varargin)
% Pages Class Constructor
%
% INPUTS
% Optional pages object
%
% OUTPUTS
% pages object
%
% 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/>.
switch
nargin
case
0
ps
=
class
(
struct
,
'pages'
,
objArray
());
case
1
assert
(
isa
(
varargin
{
1
},
'pages'
),
...
[
'With one arg to pages constructor, you must pass an '
...
'pages object or a char.'
]);
ps
=
varargin
{
1
};
otherwise
error
(
'Pages constructor: invalid number of arguments'
);
end
end
\ No newline at end of file
matlab/reports/@pages/subsasgn.m
0 → 100644
View file @
fe5f61db
function
B
=
subsasgn
(
A
,
S
,
V
)
% function B = subsasgn(A, S, V)