view m-toolbox/classes/@stattest/fromDom.m @ 25:79dc7091dbbc database-connection-manager

Update tests
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source


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