Mercurial > hg > ltpda
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m-toolbox/classes/@stattest/fromDom.m Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,71 @@ + +function obj = fromDom(obj, node, inhists) + + % Get shape + objShape = utils.xml.getShape(node); + + if any(objShape==0) + + obj = stattest.initObjectWithSize(objShape(1), objShape(2)); + + else + + %%%%%%%%%% Get properties from the node attributes + + % Get UUID + obj.UUID = utils.xml.mchar(node.getAttribute('UUID')); + + %%%%%%%%%% Get properties from the child nodes + + for ii = 1:node.getLength + childNode = node.item(ii-1); + if childNode.getNodeType == childNode.ELEMENT_NODE + + nodeName = utils.xml.mchar(childNode.getNodeName()); + if strcmp(nodeName, 'name') + % Get name + obj.name = utils.xml.getString(childNode); + + elseif strcmp(nodeName, 'description') + % Get description + obj.description = utils.xml.getString(childNode); + + elseif strcmp(nodeName, 'hist') + % Get hist + inhistUUIDs = utils.xml.mchar(childNode.getAttribute('hist_UUID')); + if ~isempty(inhistUUIDs) + inhistUUIDs = regexp(inhistUUIDs, ' ', 'split'); + for uu = 1:numel(inhistUUIDs) + obj.hist = [obj.hist utils.xml.getHistoryFromUUID(inhists, inhistUUIDs{uu})]; + end + end + + elseif (strcmp(nodeName, 'procinfo')) + % Get procinfo + obj.procinfo = utils.xml.getObject(childNode, inhists); + + elseif (strcmp(nodeName, 'plotinfo')) + % Get plotinfo + obj.plotinfo = utils.xml.getObject(childNode, inhists); + + elseif (strcmp(nodeName, 'data')) + % Get data + obj.data = utils.xml.getCell(childNode, inhists); + + elseif (strcmp(nodeName, 'pvalue')) + % Get pvalue + obj.pvalue = utils.xml.getNumber(childNode); + + elseif (strcmp(nodeName, 'result')) + % Get result + obj.result = logical(utils.xml.getNumber(childNode)); + + else + error('### Found unknown child node [%s]', nodeName); + end + end + end + + end + +end