0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 function obj = fromTimespanDef(obj, pli)
0018
0019 VERSION = '$Id: fromTimespanDef.m,v 1.3 2008/09/04 13:37:15 ingo Exp $';
0020
0021 ii = timespan.getInfo('timespan', 'From Timespan Definition');
0022
0023
0024 ii.setMversion([VERSION '-->' ii.mversion]);
0025
0026 t1 = pli.find('startT');
0027 if isempty(t1)
0028 t1 = pli.find('start');
0029 end
0030 t2 = pli.find('endT');
0031 if isempty(t2)
0032 t2 = pli.find('end');
0033 end
0034
0035
0036 pl = combine(pli, ii.plists);
0037
0038 tf = pl.find('timeformat');
0039 tz = pl.find('timezone');
0040
0041
0042 if ischar(t1) || isnumeric(t1)
0043 t1 = time(t1);
0044 elseif ~isa(t1, 'time')
0045 error('### The start time must be a string or a time-object. But it is from the class [%s]', class(t1));
0046 end
0047
0048 if ischar(t2) || isnumeric(t2)
0049 t2 = time(t2);
0050 elseif ~isa(t2, 'time')
0051 error('### The end time must be a string or a time-object. But it is from the class [%s]', class(t2));
0052 end
0053
0054 obj.startT = time(t1);
0055 obj.endT = time(t2);
0056
0057
0058 if isempty(tf)
0059 obj.setTimeformat(obj.startT.timeformat, 'internal');
0060 else
0061 obj.setTimeformat(tf, 'internal');
0062 end
0063 if isempty(tz)
0064 obj.setTimezone(obj.startT.timezone, 'internal');
0065 else
0066 obj.setTimezone(tz, 'internal');
0067 end
0068
0069
0070 obj = computeInterval(obj);
0071
0072
0073 obj.addHistory(ii, pl, [], obj.hist);
0074
0075 end