5.0

5.0 | 2 ratings Rate this file 5 Downloads (last 30 days) File Size: 74.19 KB File ID: #30713

HandleGraphicsSetGet class

by Andrew Newell

 

10 Mar 2011 (Updated 18 Mar 2011)

An extension of the handle graphics set/get class HGSETGET.

Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

| Watch this File

File Information
Description

The HGSETGETPLUS class allows the user to:

* Implement a handle class with a get/set interface.
* Define validation criteria for properties that are checked when the
method SET is called.
* Display those criteria for a given property or all the properties.
* Set defaults for the properties.
* Allow a variety of input types in a consistent manner.

Example:
>> h = hgsetgetplusTemplate

h =

  hgsetgetplusTemplate handle

  Properties:
    length: 0
      unit: 'm'

  Methods, Events, Superclasses

>> set(h)
    length: 'double -and- scalar'
      unit: '[ {m} | cm ]'

>> set(h,'unit','kg')
??? Error using ==> setOneProperty
Expected kg to match one of these strings:

  m, cm

The input, 'kg', did not match any of the valid strings.

------
I would like to thank Jiro Doke for some ideas that got me started and for encouraging me to submit this.

MATLAB release MATLAB 7.11 (2010b)
Other requirements This class requires the MATLAB builtin class hgsetget. It contains a folder with unit tests. To run them, the <http://www.mathworks.com/matlabcentral/fileexchange/22846-matlab-xunit-test-framework Matlab xUnit Test Framework> is needed.
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (2)
10 Mar 2011 Matthew

Professional work. Clear documentation and examples. I also appreciate the unit test provided, which adds greatly to my confidence in this work.
Thanks.

15 Mar 2011 Eric Johnson

This is an excellent submission. My favorite feature is the enumeration of allowable property values for an object. As the reviewer above commented, this is well organized and documented.

Please login to add a comment or rating.
Updates
18 Mar 2011

Added an acknowledgement

Tag Activity for this File
Tag Applied By Date/Time
handle Andrew Newell 10 Mar 2011 13:35:31
set Andrew Newell 10 Mar 2011 13:35:31
get Andrew Newell 10 Mar 2011 13:35:31
oop per isakson 10 Mar 2011 19:26:29
potw Lindsay Coutinho 21 Mar 2011 13:27:23
pick of the week Lindsay Coutinho 21 Mar 2011 13:27:23

Contact us at files@mathworks.com