eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'Visitor':

Home

everywhere
www.exept.de
for:
[back]

Class: Visitor


Inheritance:

   Object
   |
   +--Visitor
      |
      +--AspectVisitor

Package:
stx:libbasic
Category:
System-Visiting
Version:
rev: 1.6 date: 2009/06/08 16:35:38
user: stefan
file: Visitor.st directory: libbasic
module: stx stc-classLibrary: libbasic
Author:
Stefan Vogel (stefan@zwerg)

Description:


This class is abstract and implements the visitor pattern.
It defines #visitXXX:with: messages for various kinds of objects.
Any of these messsages is eventually mapped to #visitObject:with:.

When a class redefines #acceptVisitor:with:, an method has to be defined here, too.

Subclasses have to define at least #visitObject:with:


Related information:

    [bject>>acceptVisitor]

Instance protocol:

helpers
o  doesNotUnderstand: aMessage
catch unimplemented #visitXXX:with: messages and redirect them to #visitObject:with:.
maybe someone implemented an #acceptVisitor:with: in the XXX class and didn't
implement the corresponding method here.

This should not happen, and a error message is printed, because this can also
occur due to a typo.

o  visitChildrenOf: anObject
recursively enumerate anObjects refs, visiting each of the child objects.
nil childs are not visited

subclass responsibility
o  nextObject
this is sent, when a new Object is going to be visited.
Subclasses may redefine this to perform specific actions

o  visitObject: anObject with: aParameter
visit an object. Subclasses must at least implement this method

** This method raises an error - it must be redefined in concrete classes **

visiting smalltalk types
o  visitBehavior: aSymbol with: aParameter
visit a class

o  visitBitArray: aByteArray with: aParameter
visit an absolute time value

o  visitBlock: aBlock with: aParameter

o  visitBoolean: aBoolean with: aParameter
visit a Boolean

o  visitByteArray: aByteArray with: aParameter
visit a ByteArray value

o  visitCharacter: aCharacter with: aParameter
visit a Character

o  visitCollection: aCollection with: aParameter
visit a Collection

o  visitDate: aDate with: aParameter
visit a date value

o  visitDictionary: aDictionary with: aParameter
visit a Dictionary

o  visitFloat: aFloat with: aParameter
visit a Float

o  visitFraction: aFraction with: aParameter
visit a Fraction

o  visitInteger: anInteger with: aParameter
visit an Integer

o  visitInterval: anInterval with: aParameter
intervals are a special flavor of sequenceable collection (saving memory)
We treat it as SequenceableCollection by default.
Encoders that do a dense representation, redefine this to #visitObject

o  visitNilWith: aParameter
visit a nil

o  visitNumber: aNumber with: aParameter
visit an Integer

o  visitSequenceableCollection: aCollection with: aParameter
visit a SequenceableCollection

o  visitSet: aCollection with: aParameter
visit a Set

o  visitStream: aStream with: aParameter
visit a Stream

o  visitString: aString with: aParameter
visit a String

o  visitSymbol: aSymbol with: aParameter
visit a Symbol

o  visitTimestamp: aTimestamp with: aParameter
visit an timestamp value



ST/X 6.1.1; WebServer 1.620 at exept:8081; Tue, 22 May 2012 23:12:32 GMT