comparison m-toolbox/classes/@ltpda_uo/setUUID.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 % SETUUID Set the property 'UUID'
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: SETUUID Set the property 'UUID'
5 %
6 % CALL: objs.setUUID('new UUID');
7 % objs = setUUID(objs, 'new UUID');
8 %
9 % INPUTS: objs - is a general object
10 %
11 % REMARK: This method doesn't add history because it is only for
12 % internal usage. e.g. in addHistoryStep.
13 %
14 % VERSION: $Id: setUUID.m,v 1.4 2011/03/25 13:24:46 ingo Exp $
15 %
16 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17
18 function objs = setUUID(objs, val)
19
20 if nargin<2
21 val = {char(java.util.UUID.randomUUID)};
22 else
23 val = cellstr(val);
24 end
25
26 % Replicate the values in 'val' to the number of AOs
27 if numel(val) <= 1 && numel(objs) ~= 1
28 val = cell(size(objs));
29 val = cellfun(@(x) char(java.util.UUID.randomUUID), val, 'UniformOutput', false);
30 end
31
32 %%% decide whether we modify the ltpda_uo-object, or create a new one.
33 objs = copy(objs, nargout);
34
35 %%% set 'UUID'
36 for ii=1:numel(objs)
37 objs(ii).UUID = val{ii};
38 end
39 end