comparison m-toolbox/classes/@ssm/attachToDom.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1
2 function collectedHist = attachToDom(objs, dom, parent, collectedHist)
3
4 if isempty(objs)
5
6 % Create empty ssm node with the attribute 'shape'
7 utils.xml.attachEmptyObjectNode(objs, dom, parent);
8
9 else
10 for oo = 1:numel(objs)
11 obj = objs(oo);
12
13 % Create object node
14 ssmNode = dom.createElement('ssm');
15 ssmNode.setAttribute('shape', sprintf('%dx%d', size(objs)));
16
17 % Call superclass
18 collectedHist = attachToDom@ltpda_uoh(obj, dom, ssmNode, collectedHist);
19
20 % Add amats
21 amatsNode = dom.createElement('amats');
22 collectedHist = utils.xml.attachCellToDom(obj.amats, dom, amatsNode, collectedHist);
23 ssmNode.appendChild(amatsNode);
24
25 % Add bmats
26 bmatsNode = dom.createElement('bmats');
27 collectedHist = utils.xml.attachCellToDom(obj.bmats, dom, bmatsNode, collectedHist);
28 ssmNode.appendChild(bmatsNode);
29
30 % Add cmats
31 cmatsNode = dom.createElement('cmats');
32 collectedHist = utils.xml.attachCellToDom(obj.cmats, dom, cmatsNode, collectedHist);
33 ssmNode.appendChild(cmatsNode);
34
35 % Add dmats
36 dmatsNode = dom.createElement('dmats');
37 collectedHist = utils.xml.attachCellToDom(obj.dmats, dom, dmatsNode, collectedHist);
38 ssmNode.appendChild(dmatsNode);
39
40 % Add timestep
41 timestepNode = dom.createElement('timestep');
42 utils.xml.attachNumberToDom(obj.timestep, dom, timestepNode);
43 ssmNode.appendChild(timestepNode);
44
45 % Add inputs
46 if isa(obj.inputs, 'ltpda_obj')
47 inputsNode = dom.createElement('inputs');
48 collectedHist = obj.inputs.attachToDom(dom, inputsNode, collectedHist);
49 ssmNode.appendChild(inputsNode);
50 end
51
52 % Add states
53 if isa(obj.states, 'ltpda_obj')
54 statesNode = dom.createElement('states');
55 collectedHist = obj.states.attachToDom(dom, statesNode, collectedHist);
56 ssmNode.appendChild(statesNode);
57 end
58
59 % Add outputs
60 if isa(obj.outputs, 'ltpda_obj')
61 outputsNode = dom.createElement('outputs');
62 collectedHist = obj.outputs.attachToDom(dom, outputsNode, collectedHist);
63 ssmNode.appendChild(outputsNode);
64 end
65
66 % Add numparams
67 if isa(obj.numparams, 'ltpda_obj')
68 numparamsNode = dom.createElement('numparams');
69 collectedHist = obj.numparams.attachToDom(dom, numparamsNode, collectedHist);
70 ssmNode.appendChild(numparamsNode);
71 end
72
73 % Add params
74 if isa(obj.params, 'ltpda_obj')
75 paramsNode = dom.createElement('params');
76 collectedHist = obj.params.attachToDom(dom, paramsNode, collectedHist);
77 ssmNode.appendChild(paramsNode);
78 end
79
80 % Add to parent node
81 parent.appendChild(ssmNode);
82
83 end
84 end
85
86 end