hgsetgetex: Extension of hgsetget Class (v.2.5)

版本 1.15.0.0 (24.9 KB) 作者: Kesh Ikuma
Extended HG-style set and get for MATLAB objects
581.0 次下载
更新时间 2014/8/28

查看许可证

--------------------
Caution for updating
--------------------
Following version updates affect derived class programming. Please update the derived classes accordingly.
[v2.3a -> v2.4+]: Constructor execution order has changed from init->processargin->setdefault->processprops to init->setdefault->processargin->processprops.
[v1.2a -> v1.3+]: init() method no longer passes through the constructor input arguments.
------------------
The hgsetgetex class is an abstract class that provides an HG-style property set and get interface. hgsetgetex is a subclass of handle and hgsetget, so any classes derived from hgsetgetex are handle classes.

classdef MyClass < hgsetgetex makes MyClass a subclass of hgsetgetex.

Classes that are derived from hgsetgetex inherit no public properties but do inherit methods that can be overridden as needed.

The key extensions to the built-in hgsetget class are:
1. hgsetgetex class constructor accepts a chain of property name-value pairs to initialize the object in a similar fashion as the HG constructors. In v.2.0+, derived class can override processargin.m to allow other input argument format.

2. hgsetgetex class supports construction of an object array in a similar fashion to the built-in functions like ones, zeros, etc. E.g., MyClass(4,2) creates a 4-by-2 array of MyClass objects.

3. hgsetgetex/set method implements a mechanism to display string options and other descriptions for its properties in its outcome.

4. hgsetgetex/validateproperty protected method may be used during property set methods to validate the new values.

5. hgsetgetex/propopts protected property provides a single location to store property information: option strings, other data type description and validator, and default value.

6. hgsetgetex requires subclass to implement "init" protected method to initialize the propopts struct.

7. hgsetgetex/sortpropopts protected method may be used to sort the display order of the public properties.

8. hgsetgetex supports subclasses of matlab.mixin.Heterogeneous class. When an object array of such subclass is constructed, the array is filled with the subclass objects.

9. A subclass may be based on multiple hgsetgetex-based superclasses. The constructor of the subclass should explicitly call the constructor of one of the hgsetgetex superclasses and its overriding init()/processargin() to account for all superclasses.

In addition to the class definition, hgsetgetex_demo.m file is included in the distribution to demonstrate the basic capability of hgsetgetex.

引用格式

Kesh Ikuma (2024). hgsetgetex: Extension of hgsetget Class (v.2.5) (https://www.mathworks.com/matlabcentral/fileexchange/47045-hgsetgetex-extension-of-hgsetget-class-v-2-5), MATLAB Central File Exchange. 检索时间: .

MATLAB 版本兼容性
创建方式 R2014a
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Construct and Work with Object Arrays 的更多信息
致谢

参考作品: HandleGraphicsSetGet class

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.15.0.0

v2.5 - validateproperty now supports a new propopts.EmptyAllowed logical field.

1.14.0.0

v2.4a - (another) same-day update to fix an array creation bug.

1.13.0.0

Improved support for multiple-inheritance of hgsetgetex-based classes

1.12.0.0

Same-day bug fix for MultiSelect

1.11.0.0

* Better support multiple-inheritance of multiple hgsetgetex-based classes
* Added hgsetgetex.unifyproppairs() static utility function to consolidate the property name-value pairs
* Bug fix in validateproperty() for MultiSelect=true case

1.10.0.0

v2.1-Bug fix in validateproperty.m

1.9.0.0

v2.1 - Bug Fix Release

1.8.0.0

v2.0
- Cleaned up the constructor and added some documentation regarding initializing handle object class properties.
- Supports constructor input arguments that are not array size or property name-value pairs.

1.7.0.0

Added full support for matlab.mixin.Heterogeneous subclasses

1.6.0.0

v1.3 (Jul. 7, 2014):
- (hgsetgetex.m) changed init() arguments. Constructor input arguments are no longer passed through. This was a bad design.

1.5.0.0

Updated information

1.4.0.0

v1.2a - a bug fix in property validation and property set exception handling

1.3.0.0

v1.2 - a couple bug fixes

1.2.0.0

v1.1. - Changed init(obj) abstract function to be a scalar-object function.

1.1.0.0

*bug fix

1.0.0.0