File: adapterExample.xotcl

package info (click to toggle)
xotcl 0.85.3-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 2,832 kB
  • ctags: 2,734
  • sloc: ansic: 18,065; tcl: 1,256; makefile: 653; sh: 430
file content (37 lines) | stat: -rw-r--r-- 808 bytes parent folder | download
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
37
# $Id: s.adapterExample.xotcl 1.3 01/03/23 22:24:35+01:00 neumann@somewhere.wu-wien.ac.at $
# 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 metadata add description

FTP instproc init args {
  FTPLIB ftpAdaptee
  [self] setRequest connect FTPLIB_connect
  [self] setAdaptee ftpAdaptee
}
FTP f

f connect
f discard