xquery/trunk/XQuery__XQueryContext.st
changeset 0 5057afe1ec87
child 18 3476eed46de5
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xquery/trunk/XQuery__XQueryContext.st	Tue Apr 08 19:47:42 2008 +0000
@@ -0,0 +1,145 @@
+"{ Package: 'stx:goodies/xmlsuite/xquery' }"
+
+"{ NameSpace: XQuery }"
+
+Object subclass:#XQueryContext
+	instanceVariableNames:'dataContext optContext variables nodeSet focus'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'XQuery-Interpreter'
+!
+
+
+!XQueryContext class methodsFor:'instance creation'!
+
+withSingleBoolean: aBoolean
+
+    ^self new
+                dataContextSingle:(
+                    XQuerySequenceItem new
+                        item: (aBoolean);
+                        type: (XQuerySequenceItem typeBoolean)).
+
+    "Created: / 28-12-2006 / 12:03:30 / janfrog"
+    "Modified: / 21-03-2007 / 13:03:41 / janfrog"
+!
+
+withSingleNumber: aNumber
+
+    ^XQueryContext new
+                dataContextSingle:(
+                    XQuerySequenceItem new
+                        item: (aNumber);
+                        type: (XQuerySequenceItem typeNumber)).
+
+    "Created: / 28-12-2006 / 12:04:05 / janfrog"
+    "Modified: / 21-03-2007 / 13:03:49 / janfrog"
+! !
+
+!XQueryContext methodsFor:'accessing'!
+
+dataContext
+    ^ dataContext
+
+    "Created: / 01-09-2006 / 20:51:05 / ked"
+!
+
+dataContext:something 
+    dataContext := something.
+
+    "Created: / 01-09-2006 / 20:51:44 / ked"
+!
+
+dataContextEmpty
+    dataContext := OrderedCollection new.
+
+    "Created: / 01-09-2006 / 20:57:22 / ked"
+!
+
+dataContextSingle:something 
+    dataContext := XQuerySequence new add:something; yourself.
+
+    "Created: / 01-09-2006 / 20:57:38 / ked"
+    "Modified: / 15-09-2006 / 10:35:57 / ked"
+    "Modified: / 21-03-2007 / 13:04:03 / janfrog"
+!
+
+focus
+    ^ focus
+
+    "Created: / 21-03-2007 / 17:32:55 / janfrog"
+!
+
+focus:something
+    focus := something.
+
+    "Created: / 21-03-2007 / 17:32:55 / janfrog"
+!
+
+nodeSet
+    ^ nodeSet
+
+    "Created: / 21-03-2007 / 12:54:08 / janfrog"
+!
+
+nodeSet:something
+    nodeSet := something.
+
+    "Created: / 21-03-2007 / 12:54:08 / janfrog"
+!
+
+optContext
+    ^ optContext
+
+    "Created: / 03-09-2006 / 11:46:33 / ked"
+!
+
+optContext:something 
+    optContext := something.
+
+    "Created: / 03-09-2006 / 11:46:49 / ked"
+!
+
+optContextEmpty
+    optContext := Dictionary new.
+
+    "Created: / 03-09-2006 / 11:47:05 / ked"
+! !
+
+!XQueryContext methodsFor:'accessing - variables'!
+
+variableAt: name
+
+    ^self variables at: name
+
+    "Created: / 20-03-2007 / 23:02:29 / janfrog"
+!
+
+variableAt: name put: value
+
+    ^self variables at: name put: value
+
+    "Created: / 20-03-2007 / 23:02:42 / janfrog"
+!
+
+variables
+
+    ^variables ifNil:[variables := Dictionary new]
+
+    "Created: / 20-03-2007 / 23:03:04 / janfrog"
+! !
+
+!XQueryContext methodsFor:'copying'!
+
+copyContext
+
+    ^self copyToLevel: 2.
+
+    "Created: / 07-10-2006 / 22:30:22 / ked"
+! !
+
+!XQueryContext class methodsFor:'documentation'!
+
+version
+    ^ '$Header: /opt/data/cvs/stx/goodies/xmlsuite/xquery/XQuery__XQueryContext.st,v 1.3 2007-03-28 21:31:18 vranyj1 Exp $'
+! !