LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
PollingType.m
1classdef (Sealed) PollingType
2 % Enumeration of polling service types
3 %
4 % Copyright (c) 2012-2026, Imperial College London
5 % All rights reserved.
6
7 properties (Constant)
8 GATED = 0;
9 EXHAUSTIVE = 1;
10 KLIMITED = 2;
11 DECREMENTING = 3;
12 end
13
14 methods (Static)
15 function text = toText(type)
16 % TEXT = TOTEXT(TYPE)
17 switch type
18 case PollingType.GATED
19 text = 'Gated';
20 case PollingType.EXHAUSTIVE
21 text = 'Exhaustive';
22 case PollingType.KLIMITED
23 text = 'K-Limited';
24 case PollingType.DECREMENTING
25 text = 'Decrementing';
26 end
27 end
28
29 function id = toId(type)
30 % ID = TOID(TYPE)
31 id = type;
32 end
33
34 function name = toName(type)
35 % NAME = TONAME(TYPE) - Canonical name used on the JSON wire.
36 % The numeric ids agree with the Java enum but not with the Python
37 % one, which assigns them via auto(), so names are used to
38 % interchange polling types across codebases.
39 switch PollingType.toId(type)
40 case PollingType.GATED
41 name = 'GATED';
42 case PollingType.EXHAUSTIVE
43 name = 'EXHAUSTIVE';
44 case PollingType.KLIMITED
45 name = 'KLIMITED';
46 case PollingType.DECREMENTING
47 name = 'DECREMENTING';
48 otherwise
49 line_error(mfilename, sprintf('Unable to return a PollingType name for value: %d.\n', PollingType.toId(type)));
50 end
51 end
52
53 function id = fromName(name)
54 % ID = FROMNAME(NAME) - Inverse of toName.
55 switch upper(name)
56 case 'GATED'
57 id = PollingType.GATED;
58 case 'EXHAUSTIVE'
59 id = PollingType.EXHAUSTIVE;
60 case 'KLIMITED'
61 id = PollingType.KLIMITED;
62 case 'DECREMENTING'
63 id = PollingType.DECREMENTING;
64 otherwise
65 line_error(mfilename, sprintf('Unable to return a PollingType for name: %s.\n', name));
66 end
67 end
68 end
69end
Definition Station.m:245