Mercurial > hg > ltpda
view m-toolbox/classes/@collection/fromInput.m @ 49:0bcdf74587d1 database-connection-manager
Cleanup
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 07 Dec 2011 17:24:36 +0100 |
parents | f0afece42f48 |
children |
line wrap: on
line source
% Construct a collection object from ltpda_uoh objects. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % FUNCTION: fromInput % % DESCRIPTION: Construct a collection object from ltpda_uoh objects. % % CALL: collection = collection.fromInput(inobjs) % % VERSION: $Id: fromInput.m,v 1.7 2010/06/11 19:19:11 ingo Exp $ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function obj = fromInput(obj, pl) import utils.const.* utils.helper.msg(msg.OPROC1, 'Construct from inputs'); plConfig = collection.getDefaultPlist('From Input'); % Get the collection objects out of the configuration PLIST. inobjs = pl.find('objs'); % Convert inobjs to an cell-array if ~iscell(inobjs) inobjs = num2cell(reshape(inobjs, 1, [])); end % Identify the objects which should go into the collection. [inobjs, plConfig] = collection.identifyInsideObjs(inobjs); % Set the inside objects obj.objs = inobjs; inhists = []; inplists = []; if ~isempty(inobjs) % Loop over the 'inobjs' because it is possible that a plist which % doesn't have a history is in 'inobjs' for ll = 1:numel(inobjs) if isa(inobjs{ll}, 'ltpda_uoh') inhists = [inhists inobjs{ll}.hist]; else inplists = [inplists inobjs{ll}]; end end end % Add the input plists again as a value to the history-plist because the % plists doesn't have history-steps which we can add to the collection % object. if ~isempty(inplists) plHist = plConfig.combine(plist('objs', {inplists})); else plHist = plConfig; end obj.addHistory(collection.getInfo('collection', 'None'), plHist, [], inhists); warning('off', utils.const.warnings.METHOD_NOT_FOUND); obj.setProperties(plConfig); warning('on', utils.const.warnings.METHOD_NOT_FOUND); end