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()
95 %> \include{lineno} example/timing/Spinner/main.m
97 %> \include{lineno} example/timing/Spinner/main.out.m
102 %> \JoshuaOsborne, May 21 2024, 5:43 AM, University of Texas at Arlington<br>
103 %> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
104 %> \AmirShahmoradi, May 16 2016, 9:03 AM, Oden Institute for Computational Engineering and Sciences (ICES), UT Austin<br>
105 function self = Spinner()
106 self.tickmarks = '|/-\
';
107 self.tickCount = length(self.tickmarks);
108 self.format = [repmat('\b
', 1, self.tickCount + 3), '%s
'];
113 %> Rotate the tick mark of the spinner
114 %> and display the percentage value of the input fraction.<br>
115 %> This is a dynamic method of the class [pm.timing.Spinner](@ref Spinner).<br>
117 %> \param[inout] self : The **implicitly-passed** input argument representing the parent object of the method.<br>
118 %> \param[in] fraction : The input scalar MATLAB fractional real (``0 <= fraction <= 1``)
119 %> representing the fraction of work so far accomplished.<br>
124 %> spinner = pm.timing.Spinner()
125 %> spinner.spin(fraction)
132 %> \JoshuaOsborne, May 21 2024, 5:45 AM, University of Texas at Arlington<br>
133 %> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
134 %> \AmirShahmoradi, May 16 2016, 9:03 AM, Oden Institute for Computational Engineering and Sciences (ICES), UT Austin<br>
135 function spin(self, fraction)
138 self.clock = mod(self.clock, self.tickCount) + 1;
142 fprintf(self.format, [self.tickmarks(self.clock), sprintf(' %3.0f
', 100 * fraction), '%
']);
144 self.clock = self.clock + 1;
145 fprintf('%s
', [self.tickmarks(self.clock), sprintf(' %3.0f
', 100 * fraction), '%
']);
148 % %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()
Return a scalar object of class pm.timing.Spinner.