--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xquery/trunk/XQuery__XQueryAccessedNode.st Tue Apr 08 19:47:42 2008 +0000
@@ -0,0 +1,220 @@
+"{ Package: 'stx:goodies/xmlsuite/xquery' }"
+
+"{ NameSpace: XQuery }"
+
+XQueryAbstractNode subclass:#XQueryAccessedNode
+ instanceVariableNames:'nodeId documentAdaptor constructedParent constructedChildren
+ constructedAttributes'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'XQuery-DataNodes'
+!
+
+
+!XQueryAccessedNode methodsFor:'accessing'!
+
+constructedAttributes
+ ^ constructedAttributes
+
+ "Created: / 03-11-2006 / 17:24:44 / ked"
+!
+
+constructedAttributes:something
+ constructedAttributes := something.
+
+ "Created: / 03-11-2006 / 17:24:44 / ked"
+!
+
+constructedChildren
+ ^ constructedChildren
+
+ "Created: / 03-11-2006 / 17:24:36 / ked"
+!
+
+constructedChildren:something
+ constructedChildren := something.
+
+ "Created: / 03-11-2006 / 17:24:36 / ked"
+!
+
+constructedParent
+ ^ constructedParent
+
+ "Created: / 29-10-2006 / 18:10:43 / ked"
+!
+
+constructedParent:something
+ constructedParent := something.
+
+ "Created: / 29-10-2006 / 18:10:43 / ked"
+!
+
+documentAdaptor
+ ^ documentAdaptor
+
+ "Created: / 19-10-2006 / 11:59:25 / ked"
+!
+
+documentAdaptor:something
+ documentAdaptor := something.
+
+ "Created: / 19-10-2006 / 11:59:25 / ked"
+!
+
+documentURI
+ "Superclass says that I am responsible to implement this method"
+
+ ^documentAdaptor xpathDocumentURI
+
+ "Created: / 20-09-2007 / 14:51:37 / janfrog"
+!
+
+nodeId
+ ^ nodeId
+
+ "Created: / 06-07-2006 / 12:19:29 / ked"
+!
+
+nodeId:something
+ nodeId := something.
+
+ "Created: / 06-07-2006 / 12:19:29 / ked"
+!
+
+nodeParent: parentNode
+
+ self constructedParent: parentNode
+
+ "Created: / 29-03-2007 / 13:57:59 / janfrog"
+! !
+
+!XQueryAccessedNode methodsFor:'comparing'!
+
+= anotherNode
+
+ ^anotherNode class = self class
+ and:[anotherNode nodeId = self nodeId]
+
+ "Created: / 08-11-2006 / 11:55:05 / janfrog"
+! !
+
+!XQueryAccessedNode methodsFor:'copying'!
+
+copyNodeWithParent: aParent
+
+ | createdNode |
+
+ createdNode := self class new.
+
+ createdNode nodeId: self nodeId.
+ createdNode documentAdaptor: self documentAdaptor.
+
+ createdNode constructedParent: aParent.
+
+ self constructedChildren ifNotNil:[
+ createdNode constructedChildren: (self constructedChildren collect:[:node | node copyNodeWithParent: createdNode ]).
+ ].
+
+ self constructedAttributes ifNotNil:[
+ createdNode constructedAttributes: (self constructedAttributes collect:[:node | node copyNodeWithParent: createdNode ]).
+ ].
+
+ ^createdNode.
+
+ "Created: / 03-11-2006 / 16:50:06 / ked"
+ "Modified: / 03-11-2006 / 19:33:03 / ked"
+!
+
+postCopy
+
+ nodeId := documentAdaptor importForeignNode: nodeId adaptor: documentAdaptor.
+ constructedChildren := constructedChildren copy.
+ constructedAttributes := constructedAttributes copy
+
+ "Created: / 05-12-2007 / 14:25:50 / janfrog"
+! !
+
+!XQueryAccessedNode methodsFor:'initialization & release'!
+
+releaseResources
+
+ documentAdaptor releaseResourcesIfNotAlready
+
+ "Created: / 12-12-2006 / 10:50:09 / janfrog"
+! !
+
+!XQueryAccessedNode methodsFor:'printing'!
+
+printOn: aStream
+
+ super printOn: aStream.
+ aStream nextPut:$(.
+ nodeId printOn: aStream.
+ aStream nextPut:$).
+
+ "Created: / 14-02-2007 / 00:03:56 / janfrog"
+! !
+
+!XQueryAccessedNode methodsFor:'private'!
+
+transformNodeIds:nodeIds
+ ^ nodeIds
+ collect:[:nodeId |
+ self class new
+ nodeId: nodeId;
+ documentAdaptor: documentAdaptor]
+
+ "Created: / 18-11-2007 / 08:02:46 / janfrog"
+! !
+
+!XQueryAccessedNode methodsFor:'testing'!
+
+isAttributeNode
+
+ ^documentAdaptor xpathIsAttribute: nodeId
+
+ "Created: / 29-03-2007 / 13:55:25 / janfrog"
+!
+
+isCellStoreNode
+
+ ^documentAdaptor notNil
+ and:[documentAdaptor isKindOf:(Smalltalk at:#'XMLDB::XPathDocumentAdaptor' ifAbsent:[nil])]
+
+ "Created: / 14-11-2007 / 14:05:34 / janfrog"
+!
+
+isDocumentNode
+
+ ^documentAdaptor xpathIsDocument: nodeId
+
+ "Created: / 20-09-2007 / 12:12:25 / janfrog"
+!
+
+isElementNode
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^documentAdaptor xpathIsElement: nodeId
+
+ "Created: / 29-03-2007 / 13:55:25 / janfrog"
+!
+
+isTextNode
+ "raise an error: must be redefined in concrete subclass(es)"
+
+ ^documentAdaptor xpathIsText: nodeId
+
+ "Created: / 29-03-2007 / 13:55:25 / janfrog"
+!
+
+isXQueryAccessedNode
+ ^ true
+
+ "Modified: / 29-10-2006 / 15:30:47 / ked"
+! !
+
+!XQueryAccessedNode class methodsFor:'documentation'!
+
+version
+ ^ '$Header: /opt/data/cvs/stx/goodies/xmlsuite/xquery/XQuery__XQueryAccessedNode.st,v 1.10 2007-12-05 21:09:37 vranyj1 Exp $'
+! !