comparison m-toolbox/classes/@stattest/fromDom.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 obj = fromDom(obj, node, inhists)
3
4 % Get shape
5 objShape = utils.xml.getShape(node);
6
7 if any(objShape==0)
8
9 obj = stattest.initObjectWithSize(objShape(1), objShape(2));
10
11 else
12
13 %%%%%%%%%% Get properties from the node attributes
14
15 % Get UUID
16 obj.UUID = utils.xml.mchar(node.getAttribute('UUID'));
17
18 %%%%%%%%%% Get properties from the child nodes
19
20 for ii = 1:node.getLength
21 childNode = node.item(ii-1);
22 if childNode.getNodeType == childNode.ELEMENT_NODE
23
24 nodeName = utils.xml.mchar(childNode.getNodeName());
25 if strcmp(nodeName, 'name')
26 % Get name
27 obj.name = utils.xml.getString(childNode);
28
29 elseif strcmp(nodeName, 'description')
30 % Get description
31 obj.description = utils.xml.getString(childNode);
32
33 elseif strcmp(nodeName, 'hist')
34 % Get hist
35 inhistUUIDs = utils.xml.mchar(childNode.getAttribute('hist_UUID'));
36 if ~isempty(inhistUUIDs)
37 inhistUUIDs = regexp(inhistUUIDs, ' ', 'split');
38 for uu = 1:numel(inhistUUIDs)
39 obj.hist = [obj.hist utils.xml.getHistoryFromUUID(inhists, inhistUUIDs{uu})];
40 end
41 end
42
43 elseif (strcmp(nodeName, 'procinfo'))
44 % Get procinfo
45 obj.procinfo = utils.xml.getObject(childNode, inhists);
46
47 elseif (strcmp(nodeName, 'plotinfo'))
48 % Get plotinfo
49 obj.plotinfo = utils.xml.getObject(childNode, inhists);
50
51 elseif (strcmp(nodeName, 'data'))
52 % Get data
53 obj.data = utils.xml.getCell(childNode, inhists);
54
55 elseif (strcmp(nodeName, 'pvalue'))
56 % Get pvalue
57 obj.pvalue = utils.xml.getNumber(childNode);
58
59 elseif (strcmp(nodeName, 'result'))
60 % Get result
61 obj.result = logical(utils.xml.getNumber(childNode));
62
63 else
64 error('### Found unknown child node [%s]', nodeName);
65 end
66 end
67 end
68
69 end
70
71 end