1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
# $Id: adapterExample.xotcl,v 1.1 2004/05/23 22:50:39 neumann Exp $
# include the adapter pattern
source adapter.xotcl
@ @File {
description {
Simple adapter pattern example class (FTP requests) taken from the paper
'Filters as a Language Support for Design Patterns in
Object-Oriented Scripting Languages'.
}
}
Class FTPLIB
FTPLIB instproc FTPLIB_connect args {
puts "in ftplib connect"
}
Class Connection
Connection instproc connect args {
puts "in Connection connect"
}
Connection instproc discard args {
puts "in Connection discard"
}
Adapter FTP -superclass Connection
FTP instproc init args {
FTPLIB ftpAdaptee
my setRequest connect FTPLIB_connect
my setAdaptee ftpAdaptee
}
FTP f
f connect
f discard
|