0
|
1 |
"{ Package: 'stx:goodies/xmlsuite/xquery' }"
|
|
2 |
|
|
3 |
"{ NameSpace: XQuery }"
|
|
4 |
|
|
5 |
XQueryFunction subclass:#LibraryFunction
|
|
6 |
instanceVariableNames:'localName functionLibrary'
|
|
7 |
classVariableNames:''
|
|
8 |
poolDictionaries:''
|
|
9 |
category:'XQuery-Functions'
|
|
10 |
!
|
|
11 |
|
|
12 |
|
|
13 |
!LibraryFunction class methodsFor:'utilities'!
|
|
14 |
|
|
15 |
smalltalkize: localName
|
|
16 |
|
|
17 |
"transforms distinct-values into disticntValues"
|
|
18 |
| input output minusFound|
|
|
19 |
input := localName readStream.
|
|
20 |
output := (String new: localName size) writeStream.
|
|
21 |
minusFound := false.
|
|
22 |
[ input atEnd ] whileFalse: [
|
|
23 |
| c |
|
|
24 |
c := input next.
|
|
25 |
c = $-
|
|
26 |
ifTrue:
|
|
27 |
[minusFound := true]
|
|
28 |
ifFalse:
|
|
29 |
[minusFound
|
|
30 |
ifTrue:
|
|
31 |
[output nextPut:c asUppercase.
|
|
32 |
minusFound := false]
|
|
33 |
ifFalse:
|
|
34 |
[output nextPut:c]]].
|
|
35 |
|
|
36 |
^output contents
|
|
37 |
|
|
38 |
"
|
|
39 |
self smalltalkize: 'doc'
|
|
40 |
|
|
41 |
self smalltalkize: 'distinct-values'
|
|
42 |
"
|
|
43 |
|
|
44 |
"Created: / 28-08-2007 / 23:35:25 / janfrog"
|
|
45 |
! !
|
|
46 |
|
|
47 |
!LibraryFunction methodsFor:'accessing'!
|
|
48 |
|
|
49 |
functionLibrary
|
|
50 |
^ functionLibrary
|
|
51 |
|
|
52 |
"Created: / 28-08-2007 / 23:07:47 / janfrog"
|
|
53 |
!
|
|
54 |
|
|
55 |
smalltalkizedLocalName
|
|
56 |
|
|
57 |
^self class smalltalkize: localName
|
|
58 |
|
|
59 |
"Created: / 28-08-2007 / 23:35:44 / janfrog"
|
|
60 |
! !
|
|
61 |
|
|
62 |
!LibraryFunction methodsFor:'function API'!
|
|
63 |
|
|
64 |
evaluateInContext:context withParameters: parameters forInterpreter: interpreter
|
|
65 |
|
|
66 |
^functionLibrary
|
|
67 |
perform:(self smalltalkizedLocalName, 'InContext:withParameters:forInterpreter:') asSymbol
|
|
68 |
with: context
|
|
69 |
with: parameters
|
|
70 |
with: interpreter
|
|
71 |
|
|
72 |
"Created: / 28-08-2007 / 23:10:46 / janfrog"
|
|
73 |
!
|
|
74 |
|
|
75 |
localName
|
|
76 |
^ localName
|
|
77 |
|
|
78 |
"Created: / 28-08-2007 / 23:07:47 / janfrog"
|
|
79 |
!
|
|
80 |
|
|
81 |
namespaceURI
|
|
82 |
^ functionLibrary namespaceURI
|
|
83 |
|
|
84 |
"Created: / 28-08-2007 / 23:07:47 / janfrog"
|
|
85 |
! !
|
|
86 |
|
|
87 |
!LibraryFunction methodsFor:'initialization'!
|
|
88 |
|
|
89 |
setFunctionLibrary: aFunctionLibrary
|
|
90 |
|
|
91 |
functionLibrary := aFunctionLibrary
|
|
92 |
|
|
93 |
"Created: / 28-08-2007 / 22:44:00 / janfrog"
|
|
94 |
!
|
|
95 |
|
|
96 |
setLocalName: name
|
|
97 |
|
|
98 |
localName := name
|
|
99 |
|
|
100 |
"Created: / 28-08-2007 / 23:08:47 / janfrog"
|
|
101 |
! !
|
|
102 |
|
|
103 |
!LibraryFunction class methodsFor:'documentation'!
|
|
104 |
|
|
105 |
version
|
|
106 |
^ '$Header: /opt/data/cvs/stx/goodies/xmlsuite/xquery/XQuery__LibraryFunction.st,v 1.2 2007-09-21 11:21:48 vranyj1 Exp $'
|
|
107 |
! !
|