MATLAB Object-Oriented Programming

(Joyce) #1

How CustomDisplay Works


In this section...
“Steps to Display an Object” on page 18-7
“Methods Called for a Given Object State” on page 18-8

Steps to Display an Object


When displaying an object, MATLAB determines the state of the object and calls the
appropriate method for that state (see “Object States That Affect Display” on page 18-5).

For example, suppose obj is a valid scalar object of a class derived from
CustomDisplay. If you type obj at the command line without terminating the statement
with a semicolon:

>> obj

The following sequence results in the display of obj:

(^1) MATLAB determines the class of obj and calls the disp method to display the object.
(^2) disp calls size to determine if obj is scalar or nonscalar
3 When obj is a scalar handle object, disp calls isvalid to determine if obj is the
handle of a deleted object. Deleted handles in nonscalar arrays do not affect the
display.
(^4) disp calls the state handler method for an object of the state of obj. In this case,
obj is a valid scalar that results in a call to:
displayScalarObject(obj)
(^5) displayScalarObject calls the display part-builder methods to provide the
respective header, property list, and footer.
...
header = getHeader(obj);
disp(header)
...
groups = getPropertyGroups(obj)
displayPropertyGroups(obj,groups)
...
footer = getFooter
disp(footer)
How CustomDisplay Works

Free download pdf