Exforsys
+ Reply to Thread
Results 1 to 2 of 2

Design Pattern for implicit grouping

This is a discussion on Design Pattern for implicit grouping within the Software Patterns forums, part of the Testing category; Hi, In the context of simple OOP (C#): Given a collection of elements, I need an efficient way to tag ...

  1. #1
    Fernando Cacciola Guest

    Design Pattern for implicit grouping

    Hi,

    In the context of simple OOP (C#):

    Given a collection of elements, I need an efficient way to tag each element
    as belonging to a group.

    I cannot explicitelly bag all these elements into a separate list (use
    explicit grouping):
    I need to keep them independent for most observers except those specifically
    interested in their group structure.

    Groups can be nested (here lies the complexity) so each observer must be
    efficiently able to get the outmost group of each elements as well as the
    entire group hierarchy.

    I must be able to tie items (element or group) to form a new group; and to
    untie a group at any nesting level.

    I know this is not a difficult, but I wanted to know if there any existing
    pattern for it.


    P.S: Of course I can use explicit grouping and use something else to let
    most of the system see it as a lineal collection... but unfortunately I
    can't do that at this point becasuse of the involved changes.

    TIA

    Fernando Cacciola
    SciSoft





  2. #2
    EventHelix.com Guest

    Re: Design Pattern for implicit grouping

    You can declare group manager classes for each of the groupings
    you need. Whenever a user is assigned to the linear list,
    add it to the corresponding group manager classes.

    If a user is removed from the linear list, remove it from all group
    managers.

    The following article might help:
    http://www.eventhelix.com/RealtimeMa...ignPattern.htm

    Deepa
    --
    http://www.EventHelix.com/EventStudio
    EventStudio 2.5 - Automate sequence diagram generation




Latest Article

Network Security Risk Assessment and Measurement

Read More...