Public Member Functions | Static Public Member Functions | Properties

CC3NodeVisitor Class Reference

A CC3NodeVisitor is a context object that is passed to a node when it is visited during a traversal of the node hierarchy. More...

#import <CC3NodeVisitor.h>

Inheritance diagram for CC3NodeVisitor:
Inheritance graph
[legend]

List of all members.

Public Member Functions

(NSString *) - fullDescription
(void) - requestRemovalOf:
(void) - visit:

Static Public Member Functions

(id) + visitor

Properties

CC3PerformanceStatisticsperformanceStatistics
BOOL shouldVisitChildren
CC3NodestartingNode

Detailed Description

A CC3NodeVisitor is a context object that is passed to a node when it is visited during a traversal of the node hierarchy.

To initiate a visitation run, invoke the visit: method on any CC3Node.

Subclasses will override template methods to customize the behaviour prior to, during, and after the node traversal.

If a node is to be removed from the node structural hierarchy during a visitation run, the requestRemovalOf: method can be used instead of directly invoking the remove method on the node itself. A visitation run involves iterating through collections of child nodes, and removing a node during the iteration of a collection raises an error.


Member Function Documentation

- (NSString*) fullDescription

Returns a more detailed description of this instance.

- (void) requestRemovalOf: (CC3Node *)  aNode

Requests the removal of the specfied node.

During a visitation run, to remove a node from the hierarchy, you must use this method instead of directly invoking the remove method on the node itself. Visitation involves iterating through collections of child nodes, and removing a node during the iteration of a collection raises an error.

This method can safely be invoked while a node is being visited. The visitor keeps track of the requests, and safely removes all requested nodes as part of the close method, once the visitation of the full node assembly is finished.

- (void) visit: (CC3Node *)  aNode

Visits the specified node, then if the shouldVisitChildren property is set to YES, invokes this visit: method on each child node as well.

Subclasses will override several template methods to customize node visitation behaviour.

+ (id) visitor

Allocates and initializes an autoreleased instance.


Property Documentation

- (CC3PerformanceStatistics*) performanceStatistics [read, assign]

The performanceStatistics being accumulated during the visitation runs.

This is extracted from the startingNode, and may be nil if that node is not collecting statistics.

- (BOOL) shouldVisitChildren [read, write, assign]

Indicates whether this visitor should traverse the child nodes of any node it visits.

The initial value of this property is YES.

- (CC3Node *) startingNode [read, assign]

The CC3Node on which this visitation traversal was intitiated.

This is the node on which the visit: method was first invoked to begin a traversal of the node structural hierarchy.

This property is only valid during the traversal, and will be nil both before and after the visit: method is invoked.


The documentation for this class was generated from the following file: