IOS design model learning (13) Combination

Source: Internet
Author: User
Tags abstract tree

1 Preface

You can think of a combination as an entity, which contains other entities of the same type. This structure is like a tree connected by a parent node entity and a child node entity. It is like the genealogy of the same ancestor. In the genealogy, each node has the same surname. The combination structure can be very complex, and its internal representation should not be exposed to the client.

2. Details

2.1 Brief Introduction

The combination mode allows us to combine objects of the same base type into a tree structure. The parent node contains child nodes of the same type. In other words, this tree structure forms a "part-whole" hierarchy. It is a hierarchy that contains both the combination of objects (containers) and a single object as a leaf node (primitive. Other nodes contained in each combination can be leaf nodes or other combinations. This relationship is recursively repeated in this hierarchy.

Combine objects into a tree structure to represent the "part-whole" hierarchy. Combination makes the use of a single object and a composite object consistent.

2.2 When to use

(1) to obtain the abstract tree representation of an object (partial-overall hierarchy );

(2) The client wants to process all objects in the composite structure in a unified manner.

3 conclusion

The above is all content and I hope it will help you.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.