2%> This is the base
class for generating objects
3%> that can display the time spinner on the console.<br>
6%> The ``handle`` superclass is essential to allow
7%>
object modification by the
object methods.<br>
10%> See the documentation of the
class constructor.<br>
13%> See below
for information on the attributes (properties).<br>
16%> See below
for information on the methods.<br>
21%> \JoshuaOsborne, May 21 2024, 5:39 AM, University of Texas at Arlington<br>
22%> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
23%> \AmirShahmoradi, May 16 2016, 9:03 AM, Oden Institute
for Computational Engineering and Sciences (ICES), UT Austin<br>
26 properties(Access =
protected)
30 %> The MATLAB ``
char`` vector containing the set of
31 %> characters that represent the passage of time in the spinner.
40 %> The MATLAB integer containing the length of ``tickmarks``.
43 %> This is an internal ``Hidden`` class attribute
44 %> that is inaccessible to the end users.<br>
50 %> The MATLAB ``char`` vector containing the spinner display format.
53 %> This is an internal ``Hidden`` class attribute
54 %> that is inaccessible to the end users.<br>
56 format = [repmat('\b
', 1, 4 + 1), '%s
'];
60 %> The scalar integer representing the index of the ``tickmarks`` attribute.
63 %> This is an internal ``Hidden`` class attribute
64 %> that is inaccessible to the end users.<br>
70 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72 methods(Access = public)
75 %> Return a scalar object of class [pm.timing.Spinner](@ref Spinner).<br>
78 %> This is the constructor of the class [pm.timing.Spinner](@ref Spinner).<br>
80 %> \param[in] tickmarks : The input MATLAB ``char`` vector containing the set of
81 %> characters that represent the passage of time in the spinner.<br>
82 %> (**optional**, default = ``'|/-\
'``)
85 %> ``self`` : The output scalar object of class [pm.timing.Spinner](@ref Spinner).<br>
87 %> \interface{Spinner}
90 %> self = pm.timing.Spinner()
91 %> self = pm.timing.Spinner(tickmarks)
96 %> \include{lineno} example/timing/Spinner/main.m
98 %> \include{lineno} example/timing/Spinner/main.out.m
103 %> \JoshuaOsborne, May 21 2024, 5:43 AM, University of Texas at Arlington<br>
104 %> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
105 %> \AmirShahmoradi, May 16 2016, 9:03 AM, Oden Institute for Computational Engineering and Sciences (ICES), UT Austin<br>
106 function self = Spinner(tickmarks)
110 self.tickmarks = tickmarks;
111 self.tickCount = length(self.tickmarks);
112 self.format = [repmat('\b
', 1, self.tickCount + 3), '%s
'];
117 %> Rotate the tick mark of the spinner
118 %> and display the percentage value of the input fraction.<br>
119 %> This is a dynamic method of the class [pm.timing.Spinner](@ref Spinner).<br>
121 %> \param[inout] self : The **implicitly-passed** input argument representing the parent object of the method.<br>
122 %> \param[in] fraction : The input scalar MATLAB fractional real (``0 <= fraction <= 1``)
123 %> representing the fraction of work so far accomplished.<br>
128 %> spinner = pm.timing.Spinner()
129 %> spinner.spin(fraction)
136 %> \JoshuaOsborne, May 21 2024, 5:45 AM, University of Texas at Arlington<br>
137 %> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
138 %> \AmirShahmoradi, May 16 2016, 9:03 AM, Oden Institute for Computational Engineering and Sciences (ICES), UT Austin<br>
139 function spin(self, fraction)
142 self.clock = mod(self.clock, self.tickCount) + 1;
146 fprintf(self.format, [self.tickmarks(self.clock), sprintf(' %3.0f
', 100 * fraction), '%
']);
148 self.clock = self.clock + 1;
149 fprintf('%s
', [self.tickmarks(self.clock), sprintf(' %3.0f
', 100 * fraction), '%
']);
152 % %fprintf('\b\b\b\b\b
');
This is the base class for generating subclass of MATLAB handle superclass whose annoying methods are...
This is the base class for generating objects that can display the time spinner on the console.
function spin(in self, in fraction)
Rotate the tick mark of the spinner and display the percentage value of the input fraction....
function Spinner(in tickmarks)
Return a scalar object of class pm.timing.Spinner.