lecture10 - CompositePattern Compositepattern:Page...

Info iconThis preview shows pages 1–11. Sign up to view the full content.

View Full Document Right Arrow Icon
CSE 335 Dr. Charles B. Owen Object-Oriented Programming 1 Composite Pattern Aggregation and Composition Composite pattern: Page  163 Read UML Book Chapter  3, 4
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CSE 335 Dr. Charles B. Owen Object-Oriented Programming 2 Hierarchical Data Lots of application store data in trees or other hierarchical structure. Graphical models Drawings XML Documents Equations Assemblies Syntax representations Decision trees   1
Background image of page 2
CSE 335 Dr. Charles B. Owen Object-Oriented Programming 3 We’ve been seeing this a lot And we’ll be seeing it more… Or at least variations on the theme I’ve added  operations to Group  to add and remove  children.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CSE 335 Dr. Charles B. Owen Object-Oriented Programming 4 The Problem What if I want to be able to iterate over the tree  in some other order? What if I am only interested in part of the tree?
Background image of page 4
CSE 335 Dr. Charles B. Owen Object-Oriented Programming 5 I could add an iterator to Group, but… Any problems with this? 2
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CSE 335 Dr. Charles B. Owen Object-Oriented Programming 6 We usually don’t have a pointer to Group We have a  pointer to this We would need a pointer to this
Background image of page 6
CSE 335 Dr. Charles B. Owen Object-Oriented Programming 7 The Composite Pattern A simple idea: Add operations to manage children to the abstract base  class.
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CSE 335 Dr. Charles B. Owen Object-Oriented Programming 8 The Complete UML
Background image of page 8
CSE 335 Dr. Charles B. Owen Object-Oriented Programming 9 What should the default (base class) version do?
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CSE 335 Dr. Charles B. Owen
Background image of page 10
Image of page 11
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/12/2010 for the course CSE CSE 335 taught by Professor Owen during the Fall '10 term at Michigan State University.

Page1 / 22

lecture10 - CompositePattern Compositepattern:Page...

This preview shows document pages 1 - 11. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online