LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
refreshProcessTypes.m
1function [procid] = refreshProcessTypes(self, statSet, classSet)
2% [PROCTYPE] = REFRESHPROCESSTYPES()
3
4% Copyright (c) 2012-2026, Imperial College London
5% All rights reserved.
6
7M = getNumberOfStations(self);
8K = getNumberOfClasses(self);
9procid = nan(M,K); % disabled
10if nargin<2
11 statSet = 1:M;
12 classSet = 1:K;
13elseif nargin==2
14 line_error(mfilename,'refreshRates requires either 0 or 2 parameters.')
15elseif nargin==3 && isfield(self.sn,'rates') && isfield(self.sn,'scv')
16 % we are only updating selected stations and classes so use the
17 % existing ones for the others
18 procid = self.sn.procid;
19end
20hasOpenClasses = self.hasOpenClasses;
21
22stations = self.stations;
23% determine rates
24for i=statSet
25
26 for r=classSet
27 switch stations{i}.server.className
28 case 'ServiceTunnel'
29 % do nothing
30 switch class(stations{i})
31 case 'Source'
32 if isempty(stations{i}.input.sourceClasses{r}) || stations{i}.input.sourceClasses{r}{end}.isDisabled
33 procid(i,r) = ProcessType.DISABLED;
34 elseif stations{i}.input.sourceClasses{r}{end}.isImmediate
35 procid(i,r) = ProcessType.IMMEDIATE;
36 else
37 procid(i,r) = ProcessType.toId(ProcessType.fromText(class(stations{i}.input.sourceClasses{r}{end})));
38 end
39 case 'Join'
40 procid(i,r) = ProcessType.IMMEDIATE;
41 end
42 otherwise
43 if ~hasOpenClasses || i ~= self.getIndexSourceStation
44 if isempty(stations{i}.server.serviceProcess{r}) || stations{i}.server.serviceProcess{r}{end}.isDisabled
45 procid(i,r) = ProcessType.DISABLED;
46 elseif stations{i}.server.serviceProcess{r}{end}.isImmediate
47 procid(i,r) = ProcessType.IMMEDIATE;
48 else
49 processtype = class(stations{i}.server.serviceProcess{r}{end});
50 processtypeid = ProcessType.fromText(processtype);
51 procid(i,r) = ProcessType.toId(processtypeid);
52 end
53 end
54 end
55 end
56end
57
58if ~isempty(self.sn)
59 self.sn.procid = procid;
60end
61end