lexi设计案例分析.ppt

lexi设计案例分析

* 访问动作 Now that we can traverse, we need to add actions while traversing that have state spelling, hyphenation, … Could augment the Iterator classes… …but that would reduce their reusability Could augment the Glyph classes… …but will need to change Glyph classes for each new analysis Will need to encapsulate the analysis in a separate object * Visitor defines action(s) at each step of traversal avoids wiring action(s) into Glyphs iterator calls glyph’s accept(Visitor) at each node accept() calls back on visitor (a form of “static polymorphism” based on method overloading by type) void Charact

文档评论(0)

1亿VIP精品文档

相关文档