1classdef (Sealed) PollingType
2 % Enumeration of polling service types
4 % Copyright (c) 2012-2026, Imperial College London
15 function text = toText(type)
18 case PollingType.GATED
20 case PollingType.EXHAUSTIVE
22 case PollingType.KLIMITED
24 case PollingType.DECREMENTING
25 text =
'Decrementing';
29 function
id = toId(type)
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
42 case PollingType.EXHAUSTIVE
44 case PollingType.KLIMITED
46 case PollingType.DECREMENTING
47 name =
'DECREMENTING';
49 line_error(mfilename, sprintf(
'Unable to return a PollingType name for value: %d.\n', PollingType.toId(type)));
53 function
id = fromName(name)
54 % ID = FROMNAME(NAME) - Inverse of toName.
57 id = PollingType.GATED;
59 id = PollingType.EXHAUSTIVE;
61 id = PollingType.KLIMITED;
63 id = PollingType.DECREMENTING;
65 line_error(mfilename, sprintf(
'Unable to return a PollingType for name: %s.\n', name));