text: //
  //  Mark.h
  //  Composite
  //
  //  Created by Carlo Chung on 9/9/10.
  //  Copyright 2010 Carlo Chung. All rights reserved.
  //
  
  #import <UIKit/UIKit.h>
  #import "MarkVisitor.h"
  
  
  @protocol Mark <NSObject, NSCopying, NSCoding>
  
  @property (nonatomic, retain) UIColor *color;
  
  @property (nonatomic, assign) CGFloat size;
  @property (nonatomic, assign) CGPoint location;
  @property (nonatomic, readonly) NSUInteger count;
  @property (nonatomic, readonly) id <Mark> lastChild;
  
  
  - (id) copy;
  - (void) addMark:(id <Mark>) mark;
  - (void) removeMark:(id <Mark>) mark;
  - (id <Mark>) childMarkAtIndex:(NSUInteger) index;
  
  // for the Visitor pattern
  - (void) acceptMarkVisitor:(id <MarkVisitor>) visitor;
  
  // for the Iterator pattern
  - (NSEnumerator *) enumerator;
  
  // for internal iterator implementation
  - (void) enumerateMarksUsingBlock:(void (^)(id <Mark> item, BOOL *stop)) block;
  
  // for a bad example
  - (void) drawWithContext:(CGContextRef) context;
  
  @end