0
|
1 |
"{ Package: 'stx:goodies/xmlsuite/xquery' }"
|
|
2 |
|
|
3 |
"{ NameSpace: XQuery }"
|
|
4 |
|
|
5 |
UpdateCommand subclass:#CompositeCommand
|
|
6 |
instanceVariableNames:'commands'
|
|
7 |
classVariableNames:''
|
|
8 |
poolDictionaries:''
|
|
9 |
category:'XQuery-Update Facility'
|
|
10 |
!
|
|
11 |
|
|
12 |
!CompositeCommand class methodsFor:'documentation'!
|
|
13 |
|
|
14 |
documentation
|
|
15 |
"
|
|
16 |
documentation to be added.
|
|
17 |
|
|
18 |
[author:]
|
|
19 |
Lukas Wroblewski (wrobll1@merunka)
|
|
20 |
|
|
21 |
[instance variables:]
|
|
22 |
|
|
23 |
[class variables:]
|
|
24 |
|
|
25 |
[see also:]
|
|
26 |
|
|
27 |
"
|
|
28 |
!
|
|
29 |
|
|
30 |
history
|
|
31 |
"Created: / 02-01-2008 / 13:04:08 / wrobll1"
|
|
32 |
! !
|
|
33 |
|
|
34 |
!CompositeCommand class methodsFor:'instance creation'!
|
|
35 |
|
|
36 |
new
|
|
37 |
^ self basicNew initialize.
|
|
38 |
!
|
|
39 |
|
|
40 |
with: cmd1 with: cmd2
|
|
41 |
|
|
42 |
^self new
|
|
43 |
add:cmd1;
|
|
44 |
add:cmd2;
|
|
45 |
yourself
|
|
46 |
! !
|
|
47 |
|
|
48 |
!CompositeCommand class methodsFor:'priorities'!
|
|
49 |
|
|
50 |
priority
|
|
51 |
"Superclass says that I am responsible to implement this method"
|
|
52 |
|
|
53 |
self shouldImplement
|
|
54 |
! !
|
|
55 |
|
|
56 |
!CompositeCommand methodsFor:'adding & removing'!
|
|
57 |
|
|
58 |
add: cmd
|
|
59 |
|
|
60 |
commands add: cmd
|
|
61 |
! !
|
|
62 |
|
|
63 |
!CompositeCommand methodsFor:'checks'!
|
|
64 |
|
|
65 |
checkSourceSequence:arg
|
|
66 |
"Superclass says that I am responsible to implement this method"
|
|
67 |
|
|
68 |
self shouldNotImplement
|
|
69 |
!
|
|
70 |
|
|
71 |
checkTargetSequence:arg
|
|
72 |
"Superclass says that I am responsible to implement this method"
|
|
73 |
|
|
74 |
self shouldNotImplement
|
|
75 |
! !
|
|
76 |
|
|
77 |
!CompositeCommand methodsFor:'enumerating'!
|
|
78 |
|
|
79 |
do: aBlock
|
|
80 |
|
|
81 |
commands do:aBlock
|
|
82 |
! !
|
|
83 |
|
|
84 |
!CompositeCommand methodsFor:'executing'!
|
|
85 |
|
|
86 |
execute
|
|
87 |
"Superclass says that I am responsible to implement this method"
|
|
88 |
|
|
89 |
self flatten.
|
|
90 |
commands := commands asSortedCollection.
|
|
91 |
commands do:[:cmd|cmd execute]
|
|
92 |
! !
|
|
93 |
|
|
94 |
!CompositeCommand methodsFor:'flattening'!
|
|
95 |
|
|
96 |
flatten
|
|
97 |
|
|
98 |
| flattenedCommandStream |
|
|
99 |
flattenedCommandStream := OrderedCollection new writeStream.
|
|
100 |
self flattenOn: flattenedCommandStream.
|
|
101 |
commands := flattenedCommandStream contents.
|
|
102 |
!
|
|
103 |
|
|
104 |
flattenOn: aStream
|
|
105 |
|
|
106 |
commands do:[:cmd|cmd flattenOn: aStream].
|
|
107 |
! !
|
|
108 |
|
|
109 |
!CompositeCommand methodsFor:'initialization'!
|
|
110 |
|
|
111 |
initialize
|
|
112 |
"Invoked when a new instance is created."
|
|
113 |
|
|
114 |
"/ please change as required (and remove this comment)
|
|
115 |
commands := SortedCollection new.
|
|
116 |
|
|
117 |
"/ super initialize. -- commented since inherited method does nothing
|
|
118 |
! !
|
|
119 |
|
|
120 |
!CompositeCommand methodsFor:'merging'!
|
|
121 |
|
|
122 |
mergeWith: anotherCmd
|
|
123 |
|
|
124 |
self add: anotherCmd.
|
|
125 |
^self
|
|
126 |
! !
|
|
127 |
|
|
128 |
!CompositeCommand class methodsFor:'documentation'!
|
|
129 |
|
|
130 |
version
|
|
131 |
^ '$Header: /opt/data/cvs/stx/goodies/xmlsuite/xquery/XQuery__CompositeCommand.st,v 1.1 2008-01-02 14:09:05 wrobll1 Exp $'
|
|
132 |
! !
|